-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Overriding built-in default ignores through an extension #284
Comments
In GitLab by @snoack on Jan 10, 2019, 15:09 changed title from Overriding built-in default ignores though an extension to Overriding built-in default ignores th{+r+}ough an extension |
In GitLab by @snoack on Jan 10, 2019, 15:12 changed the description |
In GitLab by @sigmavirus24 on Jan 11, 2019, 04:06 To be brief (because I don't have oodles of time right now to respond, frankly) this isn't what these were designed for. We'd probably want an entirely separate set of APIs for a "plugin" that defines a style guide which we don't have today. |
In GitLab by @warsaw on Mar 11, 2019, 15:52 I have a similar use case. I want to add a new code in a new version of my plugin, but I would like to suppress it by default. Only if a user calls flake8 with |
In GitLab by @warsaw on Mar 11, 2019, 15:59 mentioned in merge request warsaw/flufl.flake8!1 |
In GitLab by @asottile on Mar 11, 2019, 22:30 One way to do that with the current facilities is to separate the "optional" things into a separate "plugin" (can be in the same distribution) For instance: [options.entry_points]
flake8.extension =
U1 = foo.MainPlugin
U9 = foo.ExperimentalPlugin And then in your plugin set class ExperimentalPlugin:
# ...
off_by_default = True Then users can opt into this set of optional codes with --enable-extension=U9 It ~works (we're using this strategy at work), I think we'd have a better solution with the |
Question on this via PyCQA/flake8-bugbear#266, am I correct that the following should now yield an ignored-by-default error code (
Verbose output:
|
it's a little weird, but by using |
Ah I see, if
to:
For both paths I think I would be expecting that |
yeah there's probably a better middle ground than assuming any time |
lgtm, thanks for the help :) |
In GitLab by @snoack on Jan 10, 2019, 14:17
We'd like to centralize our flake8 configuration through an extension, rather than duplicating the error codes to be selected/ignored in each of our project's
tox.ini
. It's already possible to add default ignores and selects through an extension:However, if I select an error code that flake8 ignores by default, the built-in default ignore takes precedence. There is also an
remove_default_ignore()
method but it only removes ignores that have been preiosly added by this plugin, it doesn't have any effect on the built-in default ignores either.The text was updated successfully, but these errors were encountered: