FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow multiple per-file-ignores for the same pattern in flake8 plugin by dedi · Pull Request #217 · python-lsp/python-lsp-server · GitHub

Allow multiple per-file-ignores for the same pattern in flake8 plugin - #217

Merged
ccordoba12 merged 3 commits into
python-lsp:developfrom
dedi:flake8-fix-per-file-ignores
May 31, 2022
Merged

Allow multiple per-file-ignores for the same pattern in flake8 plugin#217
ccordoba12 merged 3 commits into
python-lsp:developfrom
dedi:flake8-fix-per-file-ignores

Conversation

dedi commented May 31, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

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:

[flake8]
per-file-ignores = __init__.py: F401, F403

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

[flake8]
per-file-ignores = 
    __init__.py: F401
    __init__.py: F403

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).

Copy link
Copy Markdown
Member

Hey @dedi, thanks a lot for your contribution! Could you add a test for this? That way it won't regress in the future.

dedi commented May 31, 2022

Copy link
Copy Markdown
Contributor Author

Sure, sorry I missed that. The regression test is now there.

ccordoba12 added this to the v1.5.0 milestone May 31, 2022

ccordoba12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for your help @dedi!

ccordoba12 changed the title Allow multiple per-file-ignores for the same pattern in flake8 plugin. Allow multiple per-file-ignores for the same pattern in flake8 plugin May 31, 2022
ccordoba12 merged commit 66c7cca into python-lsp:develop May 31, 2022
dedi deleted the flake8-fix-per-file-ignores branch June 1, 2022 04:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL