Skip to content

[ruff] Remove lint.external hint for Ruff-specific suppressions (RUF102) - #27923

Merged
ntBre merged 1 commit into
astral-sh:mainfrom
waterWang:fix/suppression-external-tip
Aug 28, 2026
Merged

ntBre merged 1 commit into
astral-sh:mainfrom
waterWang:fix/suppression-external-tip

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Remove the "Add non-Ruff rule codes to the lint.external configuration option" help message from the suppression path (RUF102/RUF104).

The # ruff: ignore directive is a Ruff-specific suppression mechanism. When a user writes an unknown code in a # ruff: ignore directive, it is typically a typo or a rule name with preview disabled — not a non-Ruff rule code. The help message suggesting to add the code to lint.external is therefore misleading in this context.

The noqa path (RUF102) still handles this tip for # noqa directives, which is the appropriate context for external rule codes.

Closes #27880.

Changes

  1. suppression.rs: Removed the has_unknown_code field from SuppressionDiagnostic and the help message that was emitted when it was set.
  2. ignore.md: Removed the "Add non-Ruff rule codes" help lines from suppression test snapshots.
  3. range_suppressions.snap: Updated snapshot to reflect the removal of the help message.

Remove the "Add non-Ruff rule codes to the `lint.external`
configuration option" help message from the suppression path
(RUF102/RUF104). The `# ruff: ignore` directive is a Ruff-specific
suppression mechanism and should not suggest adding codes to
`lint.external`. The noqa path (RUF102) still handles this tip
for `# noqa` directives, which is the appropriate context for
external rule codes.

Closes astral-sh#27880.
@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre August 20, 2026 03:10
@astral-sh-bot

astral-sh-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre changed the title fix: remove "Add non-Ruff rule codes" help from suppression path [ruff] Remove lint.external hint for Ruff-specific suppressions (RUF102) Aug 28, 2026

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

It turned out that we actually discussed this hint a bit in #25614 (comment), but I'm not sure why I ended up preserving it. This change makes sense to me now.

@ntBre ntBre added bug Something isn't working diagnostics Related to reporting of diagnostics. labels Aug 28, 2026
@ntBre
ntBre merged commit ee3e087 into astral-sh:main Aug 28, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working diagnostics Related to reporting of diagnostics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Add non-Ruff rule codes to the lint.external configuration option" tip still given in # ruff: ignore directive

2 participants