diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 3def6ff7..56989a1d 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -18,6 +18,7 @@ # along with this program. If not, see . from optparse import OptionParser +import re import common, metadata config = None @@ -48,6 +49,25 @@ def main(): allapps = metadata.read_metadata(xref=False) apps = common.read_app_args(args, allapps, False) + regex_warnings = { + 'Source Code': [ + (re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'), + "/source is enough on its own"), + (re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'), + "/source is missing") + ], + 'Issue Tracker': [ + (re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'), + "/issues is enough on its own"), + (re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'), + "/issues is missing"), + (re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'), + "/issues is enough on its own"), + (re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'), + "/issues is missing") + ] + } + for app in apps: appid = app['id'] lastcommit = '' @@ -70,6 +90,13 @@ def main(): if any(lastchar==c for c in ['.', ',', '!', '?']): warn("Summary should not end with a %s" % lastchar) + for f in ['Source Code', 'Issue Tracker']: + if f not in regex_warnings: + continue + for m, r in regex_warnings[f]: + if m.match(app[f]): + warn("%s url '%s': %s" % (f, app[f], r)) + desc_chars = 0 for line in app['Description']: desc_chars += len(line)