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.
This commit is contained in:
Ian Cordasco 2014-12-18 15:25:36 -06:00
parent b301532636
commit 2d5a6b1670

View file

@ -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):