mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 04:06:54 +00:00
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:
parent
b301532636
commit
2d5a6b1670
1 changed files with 7 additions and 5 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue