summaryrefslogtreecommitdiff
path: root/scripts/maint/practracker/practracker.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-07-17 15:06:34 +0200
committerNick Mathewson <nickm@torproject.org>2019-07-18 09:28:08 -0400
commita5e1fa3a036b0200e049625c427080881b276730 (patch)
tree6e7d108d1f80951ad9c24bcc57de8d3f6ca4c89e /scripts/maint/practracker/practracker.py
parent78768aafe1068bd76419944bea1ed3453d85edfe (diff)
downloadtor-a5e1fa3a036b0200e049625c427080881b276730.tar.gz
tor-a5e1fa3a036b0200e049625c427080881b276730.zip
Practracker: add a --list-overstrict option
This option lists every exception that is stricter than it needs to be. Part of 30752
Diffstat (limited to 'scripts/maint/practracker/practracker.py')
-rwxr-xr-xscripts/maint/practracker/practracker.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/maint/practracker/practracker.py b/scripts/maint/practracker/practracker.py
index 0dc63f765c..1b6502fe5a 100755
--- a/scripts/maint/practracker/practracker.py
+++ b/scripts/maint/practracker/practracker.py
@@ -56,6 +56,7 @@ else:
def consider_file_size(fname, f):
"""Consider file size issues for 'f' and return the number of new issues was found"""
file_size = metrics.get_file_len(f)
+
if file_size > MAX_FILE_SIZE:
p = problem.FileSizeProblem(fname, file_size)
if ProblemVault.register_problem(p):
@@ -164,6 +165,8 @@ def main(argv):
parser = argparse.ArgumentParser(prog=progname)
parser.add_argument("--regen", action="store_true",
help="Regenerate the exceptions file")
+ parser.add_argument("--list-overstrict", action="store_true",
+ help="List over-strict exceptions")
parser.add_argument("--exceptions",
help="Override the location for the exceptions file")
parser.add_argument("topdir", default=".", nargs="?",
@@ -213,6 +216,15 @@ See doc/HACKING/HelpfulTools.md for more information on using practracker.\
""".format(found_new_issues, exceptions_file)
print(new_issues_str)
+ if args.list_overstrict:
+ def k_fn(tup):
+ return tup[0].key()
+ for (ex,p) in sorted(ProblemVault.list_overstrict_exceptions(), key=k_fn):
+ if p is None:
+ print(ex, "->", 0)
+ else:
+ print(ex, "->", p.metric_value)
+
sys.exit(found_new_issues)
if __name__ == '__main__':