[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Move include-violation checking into its own function.



commit a5971d732eac650d3d5eefd63df1cd4e3a9b13f5
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Aug 5 17:35:20 2019 -0400

    Move include-violation checking into its own function.
---
 scripts/maint/practracker/practracker.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/scripts/maint/practracker/practracker.py b/scripts/maint/practracker/practracker.py
index 20c8bb5b4..16ccec3d7 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!



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits