Comments (5)
from flake8-bugbear.
I changed handling of it to require explicit selection because "enable-extension" doesn't work as expected.
Note that with 16.12.1 you don't have to "enable-extensions" at all. It's enough for you to ignore=E501
for all optional warnings (including the ones from pycodestyle) to be turned on implicitly. This is misleading and exactly why I did something custom here.
The enable-extensions=
line did nothing for you all along.
from flake8-bugbear.
Ok, so you no longer enable the B9* checks when ignore=E501
is used, understandable, I also find using ignore
to enable the optional rules strange behaviour..
So understandable you require the user to explicitly chose the rules, but is that not exactly what enable-extensions
is for? Or do not have access to the list of enabled extensions?
Forcing explicit selection of ALL (i.e. normally default) rules just to use some B9 rules seems strange.
from flake8-bugbear.
I haven't really looked too long for why enabled extensions don't work. I'd accept a pull request with a fix.
from flake8-bugbear.
I'm also running into this. I have a lot of flake8 plugins that implicitly enable a bunch of different codes, all of which get lost when I specify an explicit select
in my config (unless I duplicate the list, but I do not really care much for that).
Looking at the code, it seems that enabled-extensions
causes the plugin manager to enable these plugins: https://github.com/PyCQA/flake8/blob/52210149474a876c06922ae2c296445af5bdb108/src/flake8/plugins/manager.py#L214-L215
Enabling a plugin, causes its "name" (which is really a prefix for codes) to be added to the extended select list (which causes the code to be implicitly selected). https://github.com/PyCQA/flake8/blob/52210149474a876c06922ae2c296445af5bdb108/src/flake8/plugins/manager.py#L188-L191
The "name" for bugbear is "B":
Line 60 in 6bf40ea
AFAICS, the bugbear plugin is enabled by default, so enable_extensions
is essentially a no-op.
One way to fix this would be to let bugbear specify multiple entrypoints: One for B0 and one for B3, both of which are enabled by default (like now), and one for B9 which is disabled by default: https://github.com/PyCQA/flake8/blob/52210149474a876c06922ae2c296445af5bdb108/src/flake8/plugins/manager.py#L516-L517
AFAICS only one of these three plugins actually has to do work, the others can be empty and just serve to prefill the list of included codes. If you do this, you can use enable_extensions
to enable the B9
plugin, without having to specify select
.
However, I'm not exactly sure that this is really reliable, since I'm not sure if this empty plugin approach is really future-proof (or that it works at all...).
In the end, I suspect this is really something that flake8 might need to solve, except that its select/ignore handling seems quite complex already, as well as its plugin handling (probably because it supports pep8 and pyflakes plugins as well, dunno).
from flake8-bugbear.
Related Issues (20)
- B902: False positive when using the attrs library HOT 6
- Policy on bugbears in usage of popular third party libraries HOT 2
- B026 False negative on class methods HOT 1
- B017: False negative when "from" imports used HOT 2
- Improve unit test runner HOT 2
- Feature request: a rule for calling super().__init__() in custom exception's __init__() HOT 2
- Feature request: a rule for detecting calls to mutate all-caps "constants" HOT 1
- B035: False positive for comprehensions that use a walrus operator
- Couple new rule suggestions HOT 2
- Rule to detect changes to iterable object of loop HOT 5
- Error in latest version of flake8-bugbear 24.1.15 HOT 4
- B038 false positive in 24.1.15 + 24.1.16 HOT 5
- B018 doesn't trigger for useless expressions involving multiple variables HOT 3
- B909 improvements HOT 4
- B038 false positives HOT 5
- How to handle B015 within pytest.raises blocks
- B031 does not take into account if-else statements
- B909 has several false positives on black codebase HOT 7
- B023: false positive for nested function inside loop HOT 1
- B024 false negative when there's a class var
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-bugbear.