1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

Simplify lint http warnings

This commit is contained in:
Daniel Martí 2015-06-03 20:55:08 +02:00
parent 5cab5956e3
commit 756f4a2363

View File

@ -27,60 +27,40 @@ from collections import Counter
config = None config = None
options = None options = None
def enforce_https(domain):
return (re.compile(r'.*[^sS]://[^/]*' + re.escape(domain) + r'/.*'),
domain + " URLs should always use https://")
http_warnings = [
(re.compile(r'.*/$'),
"HTTP links shouldn't end with a slash"),
# TODO enable in August 2015, when Google Code goes read-only
# (re.compile(r'.*://code\.google\.com/.*'),
# "code.google.com will be soon switching down, perhaps the project moved to github.com?"),
]
regex_warnings = { regex_warnings = {
'Web Site': [ 'Web Site': http_warnings + [
(re.compile(r'.*[^sS]://github\.com/.*'),
"github URLs should always use https:// not http://"),
# TODO enable in August 2015, when Google Code goes read-only
# (re.compile(r'.*://code\.google\.com/.*'),
# "code.google.com will be soon switching down, perhaps it moved to github.com?"),
], ],
'Source Code': [ 'Source Code': http_warnings + [
(re.compile(r'.*[^sS]://github\.com/.*'),
"github URLs should always use https:// (not http://, git://, or git@)"),
(re.compile(r'.*[^sS]://dl\.google\.com/.*'),
"dl.google.com URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
"gitorious URLs should always use https:// (not http://, git://, or git@)"),
# TODO enable in August 2015, when Google Code goes read-only
# (re.compile(r'.*://code\.google\.com/.*'),
# "code.google.com will be soon switching down, perhaps it moved to github.com?"),
], ],
'Repo': [ 'Repo': [
(re.compile(r'.*[^sS]://dl\.google\.com/.*'), enforce_https('github.com'),
"dl.google.com URLs should always use https:// not http://"), enforce_https('gitorious.org'),
(re.compile(r'.*[^sS]://github\.com/.*'), enforce_https('apache.org'),
"github URLs should always use https:// (not http://, git://, or git@)"), enforce_https('google.com'),
(re.compile(r'.*[^sS]://gitorious\.org/.*'), enforce_https('svn.code.sf.net'),
"gitorious URLs should always use https:// (not http://, git://, or git@)"), enforce_https('googlecode.com'),
(re.compile(r'.*[^sS]://[^.]*\.googlecode\.com/svn/?.*'),
"Google Code SVN URLs should always use https:// (not http:// or svn://)"),
(re.compile(r'.*[^sS]://svn\.apache\.org/repos/?.*'),
"Apache SVN URLs should always use https:// (not http:// or svn://)"),
(re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'),
"Sourceforge SVN URLs should always use https:// (not http:// or svn://)"),
# TODO enable in August 2015, when Google Code goes read-only
# (re.compile(r'.*://code\.google\.com/.*'),
# "code.google.com will be soon switching down, perhaps it moved to github.com?"),
], ],
'Issue Tracker': [ 'Issue Tracker': http_warnings + [
(re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'), (re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
"/issues is missing"), "/issues is missing"),
(re.compile(r'.*[^sS]://github\.com/.*'),
"github URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
"gitorious URLs should always use https:// not http://"),
# TODO enable in August 2015, when Google Code goes read-only # TODO enable in August 2015, when Google Code goes read-only
# (re.compile(r'.*://code\.google\.com/.*'), # (re.compile(r'.*://code\.google\.com/.*'),
# "code.google.com will be soon switching down, perhaps it moved to github.com?"), # "code.google.com will be soon switching down, perhaps it moved to github.com?"),
], ],
'Changelog': [ 'Changelog': http_warnings + [
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
"code.google.com URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://github\.com/.*'),
"github URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
"gitorious URLs should always use https:// not http://"),
], ],
'License': [ 'License': [
(re.compile(r'^(|None|Unknown)$'), (re.compile(r'^(|None|Unknown)$'),