chiark / gitweb /
lint: catch more incorrect lists
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 31 Aug 2015 22:25:41 +0000 (15:25 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 31 Aug 2015 22:25:41 +0000 (15:25 -0700)
fdroidserver/lint.py

index e0807f72c655500291fd9db25c67607d23c6342f..805f22b1fc0b0d3a4a8f3dd848ab3e95d628ac80 100644 (file)
@@ -260,28 +260,30 @@ def main():
                 or any(not desc[l - 1] and not desc[l] for l in range(1, len(desc)))):
             warn("Description has an extra empty line")
 
+        for l in app['Description']:
+            for um in desc_url.finditer(l):
+                url = um.group(1)
+                for m, r in http_warnings:
+                    if m.match(url):
+                        warn("URL '%s' in Description: %s" % (url, r))
+
         # Check for lists using the wrong characters
         validchars = ['*', '#']
         lchar = ''
         lcount = 0
         for l in app['Description']:
             if len(l) < 1:
+                lcount = 0
                 continue
 
-            for um in desc_url.finditer(l):
-                url = um.group(1)
-                for m, r in http_warnings:
-                    if m.match(url):
-                        warn("URL '%s' in Description: %s" % (url, r))
-
-            c = l.decode('utf-8')[0]
-            if c == lchar:
+            ld = l.decode('utf-8')
+            if ld[0] == lchar and ld[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)
                     break
             else:
-                lchar = c
+                lchar = ld[0]
                 lcount = 1
 
         # Regex checks in all kinds of fields