diff options
author | Tim Harder <radhermit@gmail.com> | 2017-02-05 04:52:08 -0500 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2017-02-05 04:59:01 -0500 |
commit | d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7 (patch) | |
tree | e21a20c0e2051b2b0884cc64f0226a278c5c4364 /doc | |
parent | repo_metadata: minor docstring formatting consistency fix (diff) | |
download | pkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.tar.gz pkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.tar.bz2 pkgcheck-d4fc7ba70fb6c775d50796e2f6e5370d3bccb1b7.zip |
doc: add generated checks list to doc output
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/generate/pkgcheck/checks.py | 47 | ||||
-rw-r--r-- | doc/man/pkgcheck.rst | 1 |
2 files changed, 48 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()) diff --git a/doc/man/pkgcheck.rst b/doc/man/pkgcheck.rst index 22a088b5..89d7f7bd 100644 --- a/doc/man/pkgcheck.rst +++ b/doc/man/pkgcheck.rst @@ -11,6 +11,7 @@ pkgcheck is a QA utility based on **pkgcore**\(5) similar to **repoman**\(1) fro .. include:: pkgcheck/main_options.rst +.. include:: pkgcheck/checks.rst .. include:: pkgcheck/check_keywords.rst Reporting Bugs |