diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-08-05 17:35:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-08-05 17:48:06 -0400 |
commit | a5971d732eac650d3d5eefd63df1cd4e3a9b13f5 (patch) | |
tree | 50b3c5648857a0858a3181f189af7010c1793b71 /scripts/maint/practracker/practracker.py | |
parent | 2a3c727dfed7465090c2b9bae2f5ac88b3c6dca0 (diff) | |
download | tor-a5971d732eac650d3d5eefd63df1cd4e3a9b13f5.tar.gz tor-a5971d732eac650d3d5eefd63df1cd4e3a9b13f5.zip |
Move include-violation checking into its own function.
Diffstat (limited to 'scripts/maint/practracker/practracker.py')
-rwxr-xr-x | scripts/maint/practracker/practracker.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/maint/practracker/practracker.py b/scripts/maint/practracker/practracker.py index 20c8bb5b4e..16ccec3d70 100755 --- a/scripts/maint/practracker/practracker.py +++ b/scripts/maint/practracker/practracker.py @@ -83,6 +83,14 @@ def consider_function_size(fname, f): canonical_function_name = "%s:%s()" % (fname, name) yield problem.FunctionSizeItem(canonical_function_name, lines) +def consider_include_violations(fname, real_fname, f): + n = 0 + for item in includes.consider_include_rules(real_fname, f): + n += 1 + if n: + yield problem.DependencyViolationItem(fname, n) + + ####################################################### def consider_all_metrics(files_list): @@ -119,12 +127,8 @@ def consider_metrics_for_file(fname, f): # Check for "upward" includes f.seek(0) - n = 0 - for item in includes.consider_include_rules(real_fname, f): - n += 1 - if n: - yield problem.DependencyViolationItem(fname, n) - + for item in consider_include_violations(fname, real_fname, f): + yield item HEADER="""\ # Welcome to the exceptions file for Tor's best-practices tracker! |