diff options
Diffstat (limited to 'scripts/doxy-coverage.py')
-rwxr-xr-x | scripts/doxy-coverage.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/doxy-coverage.py b/scripts/doxy-coverage.py index 9c39b349aa..b721d57a7d 100755 --- a/scripts/doxy-coverage.py +++ b/scripts/doxy-coverage.py @@ -158,18 +158,25 @@ def report (files, exclude_dirs): total_yes += doc_yes total_no += doc_no - print ('%3d%% - %s - (%d of %d)'%(doc_per, f, doc_yes, (doc_yes + doc_no))) + if not ns.quiet: + print ('%3d%% - %s - (%d of %d)'%(doc_per, f, doc_yes, (doc_yes + doc_no))) - defs_sorted = defs.keys() - defs_sorted.sort() - for d in defs_sorted: - if not defs[d]: - print ("\t", d) + defs_sorted = defs.keys() + defs_sorted.sort() + for d in defs_sorted: + if not defs[d]: + print ("\t", d) total_all = total_yes + total_no total_per = total_yes * 100 / total_all - print() - print("%d%% API documentation coverage" %(total_per)) + if not ns.quiet: + print() + print("%d%% API documentation coverage (%d out of %d)" %(total_per, total_yes, total_all)) + + if ns.json: + with open(ns.json, "w") as f: + f.write('{"documented": %d, "total": %d}\n' % (total_yes, total_all)) + return (ns.threshold - total_per, 0)[total_per > ns.threshold] @@ -179,6 +186,8 @@ def main(): parser.add_argument ("dir", action="store", help="Path to Doxygen's XML doc directory") parser.add_argument ("--noerror", action="store_true", help="Do not return error code after execution") parser.add_argument ("--threshold", action="store", help="Min acceptable coverage percentage (Default: %s)"%(ACCEPTABLE_COVERAGE), default=ACCEPTABLE_COVERAGE, type=int) + parser.add_argument ("--quiet", action="store_true", help="Don't output report to standard output") + parser.add_argument ("--json", action="store", help="Output json coverage report to specified json file") parser.add_argument("--excludedirs", nargs='+', help="List of directories to be excluded from coverage analysis", type=str, default=[]) |