From 2d5a6b1670d8e9c5c4490fee645289520794993f Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 18 Dec 2014 15:25:36 -0600 Subject: [PATCH] Prevent unintended behaviour modifying options.ignore 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. --- flake8/engine.py | 12 +++++++----- 1 file 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):