Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignore-names option initialization #111

Merged
merged 2 commits into from Feb 4, 2019

Conversation

jparise
Copy link
Member

@jparise jparise commented Feb 4, 2019

cls.ignore_names starts life as a list, which is used as the default
value for the ignore-names option, and then it becomes a frozenset()
once the option is set.

Unfortunately, when flake8's --config option is used, it appears we run
those this sequence more than once, and that results in the frozenset()
being passed as the option's default value, which breaks flake8.

This change moves the default ignore-names list to a module-level
constant alongside the other default lists. This avoids the problem
described above and has the nice side-effect of making the code more
consistent.

@jparise jparise mentioned this pull request Feb 4, 2019
@jparise jparise added the bug label Feb 4, 2019
cls.ignore_names starts life as a list, which is used as the default
value for the ignore-names option, and then it becomes a frozenset()
once the option is set.

Unfortunately, when flake8's --config option is used, it appears we run
those this sequence more than once, and that results in the frozenset()
being passed as the option's default value, which breaks flake8.

This change moves the default ignore-names list to a module-level
constant alongside the other default lists. This avoids the problem
described above and has the nice side-effect of making the code more
consistent.
@jparise
Copy link
Member Author

jparise commented Feb 4, 2019

I've also noticed that none of our tests exercise the --ignore-names option. That's something that should also be improved.

@jparise jparise merged commit 7654783 into PyCQA:master Feb 4, 2019
@jparise jparise deleted the ignore-names-default branch February 4, 2019 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants