mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-02 19:56:52 +00:00
Remove enabled extensions from options.select
When taking advantage of the --select flag for off-by-default extensions, we neglected to take into account the fact that leaving the extension names in the select list would cause different behaviour in pep8. This should remedy this. Related to GitLab bug #67
This commit is contained in:
parent
b8457ebb24
commit
5b7dc3927a
1 changed files with 8 additions and 1 deletions
|
|
@ -168,9 +168,16 @@ class StyleGuide(object):
|
|||
|
||||
def _disable_extensions(parser, options):
|
||||
ignored_extensions = set(getattr(parser, 'ignored_extensions', []))
|
||||
select = set(options.select)
|
||||
|
||||
enabled_extensions = ignored_extensions.intersection(select)
|
||||
# Remove any of the selected extensions from the extensions ignored by
|
||||
# default.
|
||||
ignored_extensions -= set(options.select)
|
||||
ignored_extensions -= select
|
||||
|
||||
for extension in enabled_extensions:
|
||||
options.select.remove(extension)
|
||||
|
||||
# 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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue