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

per-file-ignores specified in file #1325

Closed
bagerard opened this issue Apr 29, 2021 · 8 comments
Closed

per-file-ignores specified in file #1325

bagerard opened this issue Apr 29, 2021 · 8 comments

Comments

@bagerard
Copy link
Contributor

I know the feature exists at the config level (per-file-ignores) but I see added value for large projects in having it explicitely defined in the file itself instead of being centralized in the config.

This would be something like # flake8 noqa: A1,F821 on top of the file, extending the # flake8: noqa feature that ignores the whole file

I manage to make this work by patching flake8's Violation class from a plugin but that's clearly a hack, I was wondering if the feature was of interest for you? Let me know what you think

@asottile
Copy link
Member

dupe #1079

@bagerard
Copy link
Contributor Author

bagerard commented Apr 29, 2021

sorry for the dupe, I still believe it would help in some cases but I understand why you don't want to bake that in flake8 itself. Thanks for the blazing fast feedback

@asottile
Copy link
Member

it may be a possible extension in the future, but for now it'd be difficult to hack it on. I'm currently (slowly) working on a reorganization that would make a feature like this easy

@bagerard
Copy link
Contributor Author

HI @asottile, sorry to bother you with this again but could you mind provide an update on this "reorganization task"? Not pushing but just so that I have an idea if it was done or will/won't be done. In fact it's unclear to what task you are referring to and it would be helpful if you could link a ticket or something. Thanks ;)

@asottile
Copy link
Member

I wouldn't count on it happening any time soon, there's a lot of structural change that needs to happen for this to be possible without ballooning complexity

additionally, you can already accomplish what you want today via per-file-ignores so this feature likely won't ever be implemented

@bagerard
Copy link
Contributor Author

Alright, no problem, thanks for the update 👍

@bagerard
Copy link
Contributor Author

For future ref, I ended up implementing this as a plugin https://github.com/bagerard/flake8-in-file-ignores

@asottile
Copy link
Member

mutating the options like that is going to break. I would not recommend that

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

No branches or pull requests

2 participants