[tor-commits] [stem/master] Only require 'pycodestyle.ignore' snippets to only need the prefix

atagar at torproject.org atagar at torproject.org
Tue Apr 18 16:43:10 UTC 2017


commit b0542926f6debb7e6b31a62d520d4dacc7ac6127
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Apr 18 09:47:04 2017 -0700

    Only require 'pycodestyle.ignore' snippets to only need the prefix
    
    Changing our ignore rules to be a prefix match rather than an exact match. This
    way users don't need to deal with the headache of inline comments and such.
    
    We needed a new ignore rule because the version of pycodestyle differs between
    my netbook and pc, so a minor issue slipped in.
---
 stem/util/test_tools.py | 6 +++++-
 test/settings.cfg       | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index 0b44d3a..51ac244 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -232,6 +232,10 @@ def stylistic_issues(paths, check_newlines = False, check_exception_keyword = Fa
   .. versionchanged:: 1.4.0
      Added the prefer_single_quotes option.
 
+  .. versionchanged:: 1.6.0
+     Changed 'pycodestyle.ignore' code snippets to only need to match against
+     the prefix.
+
   :param list paths: paths to search for stylistic issues
   :param bool check_newlines: check that we have standard newlines (\\n), not
     windows (\\r\\n) nor classic mac (\\r)
@@ -260,7 +264,7 @@ def stylistic_issues(paths, check_newlines = False, check_exception_keyword = Fa
 
   def is_ignored(path, rule, code):
     for ignored_path, ignored_rule, ignored_code in ignore_for_file:
-      if path.endswith(ignored_path) and ignored_rule == rule and ignored_code == code.strip():
+      if path.endswith(ignored_path) and ignored_rule == rule and code.strip().startswith(ignored_code):
         return True
 
     return False
diff --git a/test/settings.cfg b/test/settings.cfg
index 11137b4..f11b1f5 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -135,6 +135,7 @@ pycodestyle.ignore stem/descriptor/__init__.py => E402: import stem.descriptor.n
 pycodestyle.ignore stem/descriptor/__init__.py => E402: import stem.descriptor.microdescriptor
 pycodestyle.ignore stem/descriptor/__init__.py => E402: import stem.descriptor.tordnsel
 pycodestyle.ignore stem/descriptor/__init__.py => E402: import stem.descriptor.hidden_service_descriptor
+pycodestyle.ignore test/util.py => E402: import test.runner
 
 # False positives from pyflakes. These are mappings between the path and the
 # issue.



More information about the tor-commits mailing list