summaryrefslogtreecommitdiff
path: root/src/flake8
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2017-05-27 19:22:38 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2017-05-27 19:22:38 -0500
commit2baaf00e83073a749238798983de4b8161e3e328 (patch)
treeb385062c83f3a2f81acb93586b8cfb93a38a0c83 /src/flake8
parentd890b8b6833689aa0a67abb8f406082f4dd8ad81 (diff)
downloadflake8-2baaf00e83073a749238798983de4b8161e3e328.tar.gz
Further refine our logic handling selection
There was a *very* subtle bug in how we handle blanket select statements with error codes that are in our DEFAULT_IGNORE. In the specific case, users were specifying ``--select E`` and E126 was not being properly reported. This unveiled further logic bugs as we refined this. Closes #318
Diffstat (limited to 'src/flake8')
-rw-r--r--src/flake8/style_guide.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py
index fb0df3a..38fc29a 100644
--- a/src/flake8/style_guide.py
+++ b/src/flake8/style_guide.py
@@ -74,6 +74,10 @@ class StyleGuide(object):
reverse=True,
))
self._ignored = tuple(sorted(options.ignore, reverse=True))
+ self._using_default_ignore = set(self._ignored) == set(defaults.IGNORE)
+ self._using_default_select = (
+ set(self._selected) == set(defaults.SELECT)
+ )
self._decision_cache = {}
self._parsed_diff = {}
@@ -135,14 +139,15 @@ class StyleGuide(object):
ignore = find_first_match(code, self._ignored)
if select and ignore:
+ if self._using_default_ignore and not self._using_default_select:
+ return Decision.Selected
return find_more_specific(select, ignore)
if extra_select and ignore:
return find_more_specific(extra_select, ignore)
- if select or (extra_select and self._selected == defaults.SELECT):
+ if select or (extra_select and self._using_default_select):
return Decision.Selected
- if select is None and extra_select is None and ignore is not None:
- return Decision.Ignored
- if self._selected != defaults.SELECT and select is None:
+ if ((select is None and extra_select is None) or
+ (not self._using_default_ignore and select is None)):
return Decision.Ignored
return Decision.Selected