summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2019-09-25 16:03:42 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-09-25 16:03:42 +0200
commitad83f4c340fe711de9039c9a9e7202f88a055f83 (patch)
tree04bdc3d1427519cb29d2a6b288e2abfa07a55bbc
parentd0e8d22ae03e7066b5557f9f50bd08e2fa2768ea (diff)
downloadqutebrowser-ad83f4c340fe711de9039c9a9e7202f88a055f83.tar.gz
qutebrowser-ad83f4c340fe711de9039c9a9e7202f88a055f83.zip
Add check for missing userscript description
-rw-r--r--scripts/dev/misc_checks.py38
-rw-r--r--tox.ini1
2 files changed, 38 insertions, 1 deletions
diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py
index c1619439b..c92c4cc96 100644
--- a/scripts/dev/misc_checks.py
+++ b/scripts/dev/misc_checks.py
@@ -29,6 +29,7 @@ import subprocess
import tokenize
import traceback
import collections
+import pathlib
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
@@ -146,9 +147,42 @@ def check_vcs_conflict():
return None
+def check_userscripts_descriptions():
+ """Make sure all userscripts are described properly."""
+ folder = pathlib.Path('misc/userscripts')
+ readme = folder / 'README.md'
+
+ described = set()
+ for line in readme.open('r'):
+ line = line.strip()
+ if line == '## Others':
+ break
+
+ match = re.fullmatch(r'- \[([^]]*)\].*', line)
+ if match:
+ described.add(match.group(1))
+
+ present = {path.name for path in folder.iterdir()}
+ present.remove('README.md')
+
+ missing = present - described
+ additional = described - present
+ ok = True
+
+ if missing:
+ print("Missing userscript descriptions: {}".format(missing))
+ ok = False
+ if additional:
+ print("Additional userscript descriptions: {}".format(additional))
+ ok = False
+
+ return ok
+
+
def main():
parser = argparse.ArgumentParser()
- parser.add_argument('checker', choices=('git', 'vcs', 'spelling'),
+ parser.add_argument('checker',
+ choices=('git', 'vcs', 'spelling', 'userscripts'),
help="Which checker to run.")
args = parser.parse_args()
if args.checker == 'git':
@@ -157,6 +191,8 @@ def main():
ok = check_vcs_conflict()
elif args.checker == 'spelling':
ok = check_spelling()
+ elif args.checker == 'userscripts':
+ ok = check_userscripts_descriptions()
return 0 if ok else 1
diff --git a/tox.ini b/tox.ini
index 57bb7dc47..344ccde97 100644
--- a/tox.ini
+++ b/tox.ini
@@ -75,6 +75,7 @@ commands =
{envpython} scripts/dev/misc_checks.py git
{envpython} scripts/dev/misc_checks.py vcs
{envpython} scripts/dev/misc_checks.py spelling
+ {envpython} scripts/dev/misc_checks.py userscripts
[testenv:vulture]
basepython = {env:PYTHON:python3}