aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2017-02-05 04:52:08 -0500
committerTim Harder <radhermit@gmail.com>2017-02-05 04:59:01 -0500
commitd4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7 (patch)
treee21a20c0e2051b2b0884cc64f0226a278c5c4364 /doc/generate
parentrepo_metadata: minor docstring formatting consistency fix (diff)
downloadpkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.tar.gz
pkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.tar.bz2
pkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.zip
doc: add generated checks list to doc output
Diffstat (limited to 'doc/generate')
-rwxr-xr-xdoc/generate/pkgcheck/checks.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/generate/pkgcheck/checks.py b/doc/generate/pkgcheck/checks.py
new file mode 100755
index 00000000..7b96c1e9
--- /dev/null
+++ b/doc/generate/pkgcheck/checks.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Output rst doc for defined pkgcheck checks.
+
+from collections import defaultdict
+
+from pkgcore.plugin import get_plugins
+from snakeoil.sequences import unstable_unique
+
+from pkgcheck import plugins
+
+
+def _rst_header(char, text):
+ print('\n' + text)
+ print(char * len(text))
+
+
+checks = sorted(unstable_unique(
+ get_plugins('check', plugins)),
+ key=lambda x: x.__name__)
+
+d = defaultdict(list)
+for check in checks:
+ d[check.scope].append(check)
+
+_rst_header('=', 'Checks')
+
+scopes = ('version', 'package', 'category', 'repository')
+for scope in reversed(sorted(d)):
+ _rst_header('-', scopes[scope].capitalize() + ' scope')
+ checks = sorted(d[scope], key=lambda x: x.__name__)
+
+ for check in checks:
+ if check.__doc__ is not None:
+ try:
+ summary, explanation = check.__doc__.split('\n', 1)
+ except ValueError:
+ summary = check.__doc__
+ explanation = None
+ else:
+ summary = None
+
+ print('\n{}'.format(check.__name__))
+ if summary:
+ print('\t' + summary)
+ if explanation:
+ print('\n\t' + explanation.strip())