Skip to content

Conversation

@amyreese
Copy link
Member

@amyreese amyreese commented Dec 19, 2025

Summary

Combines diagnostics for matched suppression comments, so that ranges and autofixes for both
the #ruff:disable and #ruff:enable comments will be reported as a single diagnostic.

Test Plan

Snapshot changes, added new snapshot for full output from preview mode rather than just a diff.

Issue #3711

@amyreese amyreese added rule Implementing or modifying a lint rule suppression Related to supression of violations e.g. noqa preview Related to preview mode features labels Dec 19, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 19, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

I've a few nit comments and a suggestion on how to encode the invariant that a suppression always has at least a disable comment.

I also think we should delete the _full test. It's not clear what value it adds over the existing test

97 | # ruff: enable[YF829]
| -----
|
help: Remove the rule code
Copy link
Member

Choose a reason for hiding this comment

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

I think the help text here is a bit misleading. It should probably be: Remove the invalid suppression

}
}

fn delete_code_or_comment(
Copy link
Member

Choose a reason for hiding this comment

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

Let's create an issue to track fixing delete_code_or_comment to correctly handle the cases where a suppression comment contains repeated codes (in which case code_index will always delete the first unused code but never the second).

The unwrap call in delete_code_or_comment also deserves a commetn why it is okay to call unwrap there OR, even better, use expect

@amyreese amyreese force-pushed the amy/group-diagnostics branch from 0f38751 to e067aa0 Compare January 6, 2026 02:23
@amyreese amyreese merged commit 21c5cfe into main Jan 7, 2026
40 checks passed
@amyreese amyreese deleted the amy/group-diagnostics branch January 7, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview mode features rule Implementing or modifying a lint rule suppression Related to supression of violations e.g. noqa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants