chiark / gitweb /
Switch all headers to python3
[fdroidserver.git] / fdroidserver / lint.py
index 5932bd618bcf6b7eaa1a27247ff181a92b34d326..f02bb7ed98403c4438a995b912ed301bcafaf644 100644 (file)
@@ -1,5 +1,4 @@
-#!/usr/bin/env python2
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python3
 #
 # lint.py - part of the FDroid server tool
 # Copyright (C) 2013-2014 Daniel Martí <mvdan@mvdan.cc>
@@ -66,7 +65,9 @@ regex_checks = {
     'Source Code': http_checks,
     'Repo': https_enforcings,
     'Issue Tracker': http_checks + [
-        (re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
+        (re.compile(r'.*github\.com/[^/]+/[^/]+/*$'),
+         "/issues is missing"),
+        (re.compile(r'.*gitlab\.com/[^/]+/[^/]+/*$'),
          "/issues is missing"),
     ],
     'Donate': http_checks + [
@@ -74,6 +75,12 @@ regex_checks = {
          "Flattr donation methods belong in the FlattrID flag"),
     ],
     'Changelog': http_checks,
+    'Author Name': [
+        (re.compile(r'^\s'),
+         "Unnecessary leading space"),
+        (re.compile(r'.*\s$'),
+         "Unnecessary trailing space"),
+    ],
     'License': [
         (re.compile(r'^(|None|Unknown)$'),
          "No license specified"),
@@ -87,6 +94,10 @@ regex_checks = {
          "No need to specify that the app is for Android"),
         (re.compile(r'.*[a-z0-9][.!?]( |$)'),
          "Punctuation should be avoided"),
+        (re.compile(r'^\s'),
+         "Unnecessary leading space"),
+        (re.compile(r'.*\s$'),
+         "Unnecessary trailing space"),
     ],
     'Description': [
         (re.compile(r'^No description available$'),
@@ -287,6 +298,8 @@ def check_bulleted_lists(app):
 def check_builds(app):
     for build in app.builds:
         if build.disable:
+            if build.disable.startswith('Generated by import.py'):
+                yield "Build generated by `fdroid import` - remove disable line once ready"
             continue
         for s in ['master', 'origin', 'HEAD', 'default', 'trunk']:
             if build.commit and build.commit.startswith(s):
@@ -295,7 +308,7 @@ def check_builds(app):
                 ref = srclib.split('@')[1].split('/')[0]
                 if ref.startswith(s):
                     yield "Branch '%s' used as commit in srclib '%s'" % (s, srclib)
-        if build.target and build.method() == 'gradle':
+        if build.target and build.build_method() == 'gradle':
             yield "target= has no gradle support"
 
 
@@ -348,7 +361,7 @@ def main():
         if warns:
             anywarns = True
             for warn in warns:
-                print "%s: %s" % (appid, warn)
+                print("%s: %s" % (appid, warn))
 
     if anywarns:
         sys.exit(1)