[tor-commits] [tor/master] practracker: Improvements based on last Nick's review.

nickm at torproject.org nickm at torproject.org
Wed Mar 13 13:30:09 UTC 2019


commit ec8c5b3fea78b2596d3b68571fd47b8e41d4a3ea
Author: George Kadianakis <desnacked at riseup.net>
Date:   Tue Mar 12 14:35:26 2019 +0200

    practracker: Improvements based on last Nick's review.
---
 scripts/maint/practracker/metrics.py | 6 +++---
 scripts/maint/practracker/problem.py | 3 ++-
 scripts/maint/practracker/util.py    | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/maint/practracker/metrics.py b/scripts/maint/practracker/metrics.py
index c7d2091d0..56b9e8383 100644
--- a/scripts/maint/practracker/metrics.py
+++ b/scripts/maint/practracker/metrics.py
@@ -26,8 +26,8 @@ def get_function_lines(f):
     """
 
     # Skip lines with these terms since they confuse our regexp
-    REGEXP_CONFUSE_TERMS = ["MOCK_IMPL", "ENABLE_GCC_WARNINGS", "ENABLE_GCC_WARNING", "DUMMY_TYPECHECK_INSTANCE",
-                            "DISABLE_GCC_WARNING", "DISABLE_GCC_WARNINGS"]
+    REGEXP_CONFUSE_TERMS = {"MOCK_IMPL", "ENABLE_GCC_WARNINGS", "ENABLE_GCC_WARNING", "DUMMY_TYPECHECK_INSTANCE",
+                            "DISABLE_GCC_WARNING", "DISABLE_GCC_WARNINGS"}
 
     in_function = False
     for lineno, line in enumerate(f):
@@ -43,7 +43,7 @@ def get_function_lines(f):
                 in_function = True
 
         else:
-            # Fund the end of a function
+            # Find the end of a function
             if line.startswith("}"):
                 n_lines = lineno - func_start
                 in_function = False
diff --git a/scripts/maint/practracker/problem.py b/scripts/maint/practracker/problem.py
index 00e029d1c..60ee3eb24 100644
--- a/scripts/maint/practracker/problem.py
+++ b/scripts/maint/practracker/problem.py
@@ -8,6 +8,7 @@ get worse.
 """
 
 import os.path
+import sys
 
 class ProblemVault(object):
     """
@@ -23,7 +24,7 @@ class ProblemVault(object):
             with open(exception_fname, 'r') as exception_f:
                 self.register_exceptions(exception_f)
         except IOError:
-            print("No exception file provided")
+            print("No exception file provided", file=sys.stderr)
 
     def register_exceptions(self, exception_file):
         # Register exceptions
diff --git a/scripts/maint/practracker/util.py b/scripts/maint/practracker/util.py
index 966c62515..63de72d5a 100644
--- a/scripts/maint/practracker/util.py
+++ b/scripts/maint/practracker/util.py
@@ -2,7 +2,7 @@ import os
 
 # We don't want to run metrics for unittests, automatically-generated C files,
 # external libraries or git leftovers.
-EXCLUDE_SOURCE_DIRS = ["/src/test/", "/src/trunnel/", "/src/ext/", "/.git/"]
+EXCLUDE_SOURCE_DIRS = {"/src/test/", "/src/trunnel/", "/src/ext/", "/.git/"}
 
 def get_tor_c_files(tor_topdir):
     """





More information about the tor-commits mailing list