-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Explicitly define enabled flake8 errors and warnings #12600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't really understand what this is actually changing.
This is not changing any config to a different behaviour, but it is taking existing implicit configuration, and turning it into something explicit. It's needed to add something like Bugbear's B90 codes, see here under "opinionated warnings" Furthermore, it is also helpful when asking questions like "which flake8 lints are actually enabled?", as the flake8 site does not elaborate on this, and someone would have to;
This is not changing anything, but improving on two fronts;
|
Does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this is useful.
- We're not spending our time updating the config often, writing new lints for flake8 ourselves; we trust flake8 to provide sensible defaults.
- As of Lock Dependencies in Synapse #11537, a fixed version of flake8 is pinned for use in CI, so we are running the same set of defaults and hence the same set of lints everywhere.
- Turning on any additional checks (e.g. the B90x series of lints you mention) should be perfectly possible using the
extend-select
config option as mentioned here.
Additionally, AFAICS the proposed change is identical to #9370, which we closed last year. I am minded to close this too.
...it does, it seems to have been added very recently. This kinda defeats the point of the PR. I'll close this, in the future I might add B90 lints under extend-select. |
Closes #9366 either way or the other.
I think #9366 has existed for quite some time now, the last action being to enable
B90
, a set of opinionated lints.However, this was blocked by having all flake8 lints be explicitly defined (using
select=
), as there is no way to "add" a lint code to check.B90
being optional required this.This PR could unblock that effort, but I'd want to petition this anyway, as I think now it'd be a good time to look at this again with fresh eyes.
If this PR goes through, I might make an issue about adding
B90
, discussing the pros and cons of those lints.The advantages of doing this would be;
B90
) easily.Disadvantages would be;
E
,W
, andF
, which are all already the categories flake8 operate in. Any new lints would most likely be added to those, and automatically included here.[1]: Currently the only way to find flake8 defaults are to run
flake8
with verbose on, and watching a line where it tells about overriding a set of defaults. Here I copied that list as it was per flake84.0.1
.Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)
Signed-off-by: Jonathan de Jong <[email protected]>