Allow multiple per-file-ignores for the same pattern in flake8 plugin #217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why this is needed:
In flake8, support for multiple ignores for the same pattern is allowed, but is currently not supported by the flake8 plugin.
If I have something like the following in my project's setup.cfg file:
Then running flake8 manually from the command line seems to behave as expected (ignore errors F401 and F403 from all
__init__.py
files), but running it from inside pylsp causes an error to be written to the log, and flake8 doesn't actually run. This small and admittedly not very elegant piece of code lets the flake8 plugin accept such a configuration.(In fact, with my version of flake8 (3.8.4), I couldn't find any way to write the above which would work both under pylsp and when running flake8 manually. A configuration of the form
which seem to be valid according to the flake8 spec, doesn't actually make flake8 ignore both errors, so this fix is the only way I found to have a configuration which behaves identically when running either manually or under pylsp)
(edit: some typos. Sorry).