mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-19 03:30:12 +02:00
Make lint.py somewhat more readable
This commit is contained in:
parent
482ae77854
commit
e19ef06671
@ -52,17 +52,17 @@ def main():
|
|||||||
regex_warnings = {
|
regex_warnings = {
|
||||||
'Source Code': [
|
'Source Code': [
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'),
|
||||||
"/source is enough on its own"),
|
"/source is often enough on its own"),
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
||||||
"/source is missing")
|
"/source is missing")
|
||||||
],
|
],
|
||||||
'Issue Tracker': [
|
'Issue Tracker': [
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'),
|
||||||
"/issues is enough on its own"),
|
"/issues is often enough on its own"),
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
||||||
"/issues is missing"),
|
"/issues is missing"),
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'),
|
||||||
"/issues is enough on its own"),
|
"/issues is often enough on its own"),
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
|
||||||
"/issues is missing")
|
"/issues is missing")
|
||||||
]
|
]
|
||||||
@ -76,27 +76,18 @@ def main():
|
|||||||
if 'commit' in build and 'disable' not in build:
|
if 'commit' in build and 'disable' not in build:
|
||||||
lastcommit = build['commit']
|
lastcommit = build['commit']
|
||||||
|
|
||||||
|
# Potentially incorrect UCM
|
||||||
if (app['Update Check Mode'] == 'RepoManifest' and
|
if (app['Update Check Mode'] == 'RepoManifest' and
|
||||||
any(s in lastcommit for s in ('.', ',', '_', '-', '/'))):
|
any(s in lastcommit for s in ('.', ',', '_', '-', '/'))):
|
||||||
warn("Last used commit '%s' looks like a tag, but Update Check Mode is RepoManifest" % lastcommit)
|
warn("Last used commit '%s' looks like a tag, but Update Check Mode is RepoManifest" % lastcommit)
|
||||||
|
|
||||||
|
# Summary size limit
|
||||||
summ_chars = len(app['Summary'])
|
summ_chars = len(app['Summary'])
|
||||||
if summ_chars > config['char_limits']['Summary']:
|
if summ_chars > config['char_limits']['Summary']:
|
||||||
warn("Summary of length %s is over the %i char limit" % (
|
warn("Summary of length %s is over the %i char limit" % (
|
||||||
summ_chars, config['char_limits']['Summary']))
|
summ_chars, config['char_limits']['Summary']))
|
||||||
|
|
||||||
if app['Summary']:
|
# Description size limit
|
||||||
lastchar = app['Summary'][-1]
|
|
||||||
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
|
desc_chars = 0
|
||||||
for line in app['Description']:
|
for line in app['Description']:
|
||||||
desc_chars += len(line)
|
desc_chars += len(line)
|
||||||
@ -104,6 +95,20 @@ def main():
|
|||||||
warn("Description of length %s is over the %i char limit" % (
|
warn("Description of length %s is over the %i char limit" % (
|
||||||
desc_chars, config['char_limits']['Description']))
|
desc_chars, config['char_limits']['Description']))
|
||||||
|
|
||||||
|
# No punctuation in summary
|
||||||
|
if app['Summary']:
|
||||||
|
lastchar = app['Summary'][-1]
|
||||||
|
if any(lastchar==c for c in ['.', ',', '!', '?']):
|
||||||
|
warn("Summary should not end with a %s" % lastchar)
|
||||||
|
|
||||||
|
# Common mistakes in urls
|
||||||
|
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))
|
||||||
|
|
||||||
if not appid:
|
if not appid:
|
||||||
print
|
print
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user