diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-09-18 08:49:57 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-09-18 10:28:33 -0400 |
commit | 25d55fa01ebc8d9bc8cd52672605636a9261ddf5 (patch) | |
tree | a8b1b75272b10df27ea7d9c60c9a6010977fd496 /scripts | |
parent | d6d3e829dd20b78e2b80e52f0e3865a1002e653b (diff) | |
download | tor-25d55fa01ebc8d9bc8cd52672605636a9261ddf5.tar.gz tor-25d55fa01ebc8d9bc8cd52672605636a9261ddf5.zip |
Practracker: do not list problems when told to --list-overbroad.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/maint/practracker/practracker.py | 9 | ||||
-rw-r--r-- | scripts/maint/practracker/util.py | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/scripts/maint/practracker/practracker.py b/scripts/maint/practracker/practracker.py index ce9c5f5d82..6f1a771efc 100755 --- a/scripts/maint/practracker/practracker.py +++ b/scripts/maint/practracker/practracker.py @@ -224,6 +224,11 @@ def main(argv): filt.addThreshold(problem.DependencyViolationItem("*.c", int(args.max_dependency_violations))) filt.addThreshold(problem.DependencyViolationItem("*.h", int(args.max_dependency_violations))) + if args.list_overbroad and args.regen: + print("Cannot use --regen with --list-overbroad", + file=sys.stderr) + sys.exit(1) + # 1) Get all the .c files we care about files_list = util.get_tor_c_files(TOR_TOPDIR, args.include_dir) @@ -239,6 +244,10 @@ def main(argv): ProblemVault = problem.ProblemVault(exceptions_file) problem_file = sys.stdout + if args.list_overbroad: + # If we're listing overbroad exceptions, don't list problems. + problem_file = util.NullFile() + # 2.1) Adjust the exceptions so that we warn only about small problems, # and produce errors on big ones. if not (args.regen or args.list_overbroad or args.strict): diff --git a/scripts/maint/practracker/util.py b/scripts/maint/practracker/util.py index 4b42565528..df629110c2 100644 --- a/scripts/maint/practracker/util.py +++ b/scripts/maint/practracker/util.py @@ -41,3 +41,10 @@ def get_tor_c_files(tor_topdir, include_dirs=None): files_list.append(full_path) return files_list + +class NullFile: + """A file-like object that we can us to suppress output.""" + def __init__(self): + pass + def write(self, s): + pass |