summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <ian.cordasco@rackspace.com>2014-12-18 15:25:36 -0600
committerIan Cordasco <ian.cordasco@rackspace.com>2014-12-18 15:25:37 -0600
commit2d5a6b1670d8e9c5c4490fee645289520794993f (patch)
tree5d497a1e1f697f18de0ea75f170e40505d31cf27
parentb301532636b60683b339a2d081728d22957a142f (diff)
downloadflake8-feature/register-optional-checks.tar.gz
Prevent unintended behaviour modifying options.ignorefeature/register-optional-checks
Previously, it was entirely plausible for us to remove something from options.ignore overzealously. This is more confined logic and much more akin to what I was intending the behaviour to be.
-rw-r--r--flake8/engine.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/flake8/engine.py b/flake8/engine.py
index b77199b..cdad7f9 100644
--- a/flake8/engine.py
+++ b/flake8/engine.py
@@ -101,11 +101,13 @@ class StyleGuide(pep8.StyleGuide):
def _disable_extensions(parser, options):
- select = set(options.select)
- ignore = set(options.ignore)
- ignore.update(getattr(parser, 'ignored_extensions', []))
- ignore -= select
- options.ignore = tuple(ignore)
+ ignored_extensions = set(getattr(parser, 'ignored_extensions', []))
+ # Remove any of the selected extensions from the extensions ignored by
+ # default.
+ ignored_extensions -= set(options.select)
+ # Whatever is left afterwards should be unioned with options.ignore and
+ # options.ignore should be updated with that.
+ options.ignore = tuple(ignored_extensions.union(options.ignore))
def get_style_guide(**kwargs):