-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Official API for seeing selected error codes / document existing way of doing it #1776
Comments
You've explained that you want to do this, not why and without that, the default answer is no. Also, nothing except what is documented as the public API is guaranteed to exist long term or to remain where you're importing it from. |
Your pull request also doesn't explain why. It looks like you're adding custom behavior that would otherwise be a flake8 (not plugin) behavior and you're trying to shoehorn something into flake8 that will almost certainly break in the future just by the normal course of development here. At this point, it seems like you should be creating a custom linter CLI, not a flake8 plugin, and I thoroughly implore you to consider that option if you're intent on continuing down the path you're taking there. Flake8 isn't designed to support your needs there nor should it be |
The reason is to speed up the plugin when disabling checks and to ease debugging while developing for stepping through the visitor.
of course, which is why I'm asking for an official API for doing it. I made sure to implement it in flake8-trio in a way that would be relatively easy to disable if/when it breaks in flake8.
Flake8 could maybe disable a whole plugin, but I don't see how it could disable parts of a plugin depending on which checks are selected. |
you can use an the reason we ask for a "why" is because you're stuck in an XY problem |
describe the request
When implementing python-trio/flake8-async#91 I wanted to be able to access what error codes have been selected/ignored by the user.
https://flake8.pycqa.org/en/latest/plugin-development/plugin-parameters.html#registering-options mentions creating a parallel
--select
option, but having to register--select
,--ignore
,--extend-select
,--extend-ignore
etc and also recreating flake8's complicated logic for those seemed like a foolish task - and I ended up working around that by importingDecisionEngine
andDecision
fromflake8.style_guide
. It ended up working fairly well, though it became very involved to get it working in my tests - also needing to importflake8.main.options.register_default_options
and manually addingextended_default_select
andextended_default_ignore
to getDecisionEngine.decision_for
to work.It all works in the end, but this seems like something that maybe should be easily accessible without having to delve into flake8's code and yank out undocumented functionality that one cannot rely on being stable.
The text was updated successfully, but these errors were encountered: