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

Remove redundant Bugbear disabling in stubs #13308

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Dec 26, 2024

Ref #13295
https://docs.astral.sh/ruff/rules/#flake8-bugbear-b

Back then, all rules applied on all files indiscriminately. Now Ruff does special case stubs. Meaning that rules that don't apply to stubs don't need to be disabled by us anymore.

@JelleZijlstra
Copy link
Member

This is flake8-bugbear, not bandit. Still makes sense to change though (I reran a flaky job).

@AlexWaygood
Copy link
Member

I see that this simplifies our config, but Ruff doesn't have great coverage for stubs in its test suite. And I still basically think there's ~no benefit from having any of the flake8-bugbear rules being run on our stubs. So I would probably slightly lean towards keeping this blnaket exclusion, just in case Ruff adds some new flake8-bugbear rules in the future that don't make sense for stubs and forgets to explicitly skip the rule for stubs. (That would be a bug in Ruff! But it also sounds like a very plausible bug.)

@Avasam Avasam changed the title Remove redundant Bandit disabling in stubs Remove redundant Bugbear disabling in stubs Dec 26, 2024
@Avasam
Copy link
Collaborator Author

Avasam commented Dec 28, 2024

[...] just in case Ruff adds some new flake8-bugbear rules in the future that don't make sense for stubs and forgets to explicitly skip the rule for stubs. (That would be a bug in Ruff! But it also sounds like a very plausible bug.)

Honestly, for me it's less about config simplification (although I do like having less arbitrary exclusions), and more that I would like such a Ruff "bug" about rules misapplying to stubs to be found and reported! (as long as it's for a rule group we do use outside of stubs, to lint our scripts and tests)

Since we pin our dependencies, it wouldn't make our tests "suddenly start failing". And since we autoupdate through PRs, such changes can be caught earlier.

I'm also unsure atm if Ruff's ecosystem check can bypass per-file exclusions to see if it would incorrectly apply a rule to stubs.

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

Successfully merging this pull request may close these issues.

3 participants