Skip to content

[flake8-bugbear] Tag certain B007 diagnostics as unnecessary#23453

Merged
ntBre merged 1 commit intoastral-sh:mainfrom
denyszhak:fix/b007-unnecessary-tag-certain
Feb 20, 2026
Merged

[flake8-bugbear] Tag certain B007 diagnostics as unnecessary#23453
ntBre merged 1 commit intoastral-sh:mainfrom
denyszhak:fix/b007-unnecessary-tag-certain

Conversation

@denyszhak
Copy link
Contributor

@denyszhak denyszhak commented Feb 20, 2026

Closes #23452

Summary

Adds DiagnosticTag::Unnecessary to B007 diagnostics only when certainty is Certain, so editors can dim definitely-unused loop control variables without dimming uncertain cases.

Test Plan

Added new test and manually tested in VSCode.

image

@denyszhak denyszhak force-pushed the fix/b007-unnecessary-tag-certain branch from e5af86c to 8302bb1 Compare February 20, 2026 18:30
@denyszhak denyszhak force-pushed the fix/b007-unnecessary-tag-certain branch from 8302bb1 to 8a95432 Compare February 20, 2026 18:39
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 20, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ntBre ntBre added the diagnostics Related to reporting of diagnostics. label Feb 20, 2026
@ntBre ntBre changed the title [flake8-bugbear] tag certain B007 diagnostics as unnecessary [flake8-bugbear] Tag certain B007 diagnostics as unnecessary Feb 20, 2026
@ntBre ntBre merged commit 66defe9 into astral-sh:main Feb 20, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[B007] Add Unnecessary tag for certain unused loop control variables (editor dimming)

2 participants