mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-05 08:51:06 +03:00
lint: catch more incorrect lists
This commit is contained in:
parent
12926420a6
commit
23794446f7
1 changed files with 13 additions and 11 deletions
|
@ -260,28 +260,30 @@ def main():
|
||||||
or any(not desc[l - 1] and not desc[l] for l in range(1, len(desc)))):
|
or any(not desc[l - 1] and not desc[l] for l in range(1, len(desc)))):
|
||||||
warn("Description has an extra empty line")
|
warn("Description has an extra empty line")
|
||||||
|
|
||||||
# Check for lists using the wrong characters
|
|
||||||
validchars = ['*', '#']
|
|
||||||
lchar = ''
|
|
||||||
lcount = 0
|
|
||||||
for l in app['Description']:
|
for l in app['Description']:
|
||||||
if len(l) < 1:
|
|
||||||
continue
|
|
||||||
|
|
||||||
for um in desc_url.finditer(l):
|
for um in desc_url.finditer(l):
|
||||||
url = um.group(1)
|
url = um.group(1)
|
||||||
for m, r in http_warnings:
|
for m, r in http_warnings:
|
||||||
if m.match(url):
|
if m.match(url):
|
||||||
warn("URL '%s' in Description: %s" % (url, r))
|
warn("URL '%s' in Description: %s" % (url, r))
|
||||||
|
|
||||||
c = l.decode('utf-8')[0]
|
# Check for lists using the wrong characters
|
||||||
if c == lchar:
|
validchars = ['*', '#']
|
||||||
|
lchar = ''
|
||||||
|
lcount = 0
|
||||||
|
for l in app['Description']:
|
||||||
|
if len(l) < 1:
|
||||||
|
lcount = 0
|
||||||
|
continue
|
||||||
|
|
||||||
|
ld = l.decode('utf-8')
|
||||||
|
if ld[0] == lchar and ld[1] == ' ':
|
||||||
lcount += 1
|
lcount += 1
|
||||||
if lcount > 3 and lchar not in validchars:
|
if lcount > 2 and lchar not in validchars:
|
||||||
warn("Description has a list (%s) but it isn't bulleted (*) nor numbered (#)" % lchar)
|
warn("Description has a list (%s) but it isn't bulleted (*) nor numbered (#)" % lchar)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
lchar = c
|
lchar = ld[0]
|
||||||
lcount = 1
|
lcount = 1
|
||||||
|
|
||||||
# Regex checks in all kinds of fields
|
# Regex checks in all kinds of fields
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue