Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hirokiokada77
Copy link
Contributor

Summary

This PR fixes an issue where biome_analyze did not correctly handle range suppressions specified using only a category (such as lint instead of lint/correctness/noUnusedVariables).

Closes #7877.

Test Plan

A test case was added to:

  • crates/biome_cli/tests/cases/suppressions.rs

Docs

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: a618040

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added A-CLI Area: CLI A-Linter Area: linter labels Nov 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Walkthrough

This pull request fixes range suppressions to properly handle suppressed categories, addressing issue #7877. Changes to the suppression matching logic now search backwards for active range suppressions and consider both category-wide and per-filter semantics when determining if a suppression applies. A new test validates that range suppressions using only a category explanation work correctly.

Suggested labels

A-Linter

Suggested reviewers

  • ematipico
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing range suppression handling for categories in biome_analyze.
Description check ✅ Passed The description clearly relates to the changeset, explaining the fix for range suppressions with categories and referencing the closed issue.
Linked Issues check ✅ Passed The PR adequately addresses issue #7877 by modifying range suppression logic to handle category-only suppressions and adding test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing range suppression handling: logic fixes in suppressions.rs, test additions, and a changeset entry.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_cli/tests/cases/suppressions.rs (1)

461-490: Test validates the fix correctly.

The test structure is sound and follows existing patterns. The category-only suppression is properly exercised.

Optional suggestion: The test name includes syntax_rule but actually tests the lint category. Consider renaming to lint_range_suppression_category_only for clarity, or add additional tests for other categories (syntax, action) to ensure comprehensive coverage.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ba4157 and a618040.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/tests/snapshots/main_cases_suppressions/syntax_rule_range_suppression_category_only.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/rare-bees-hug.md (1 hunks)
  • crates/biome_analyze/src/suppressions.rs (2 hunks)
  • crates/biome_cli/tests/cases/suppressions.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • .changeset/rare-bees-hug.md
🧬 Code graph analysis (2)
crates/biome_cli/tests/cases/suppressions.rs (1)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_cli_snapshot (407-409)
crates/biome_analyze/src/suppressions.rs (1)
crates/biome_js_analyze/src/suppressions.tests.rs (1)
  • suppression (107-215)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (3)
.changeset/rare-bees-hug.md (1)

1-13: LGTM!

The changeset clearly documents the fix with a helpful example. Good work addressing issue #7877.

crates/biome_analyze/src/suppressions.rs (2)

278-304: Range end matching logic is correct.

The backward search properly handles category-only range ends by matching against suppressed_categories. The use of .rev() and the is_ended filter ensures nested suppressions work correctly (LIFO behavior).


339-345: Correct implementation of category-wide suppression matching.

The logic now properly checks both suppressed_categories (for category-wide suppressions like lint) and filters_by_category (for specific rule suppressions). This is precisely the fix needed for issue #7877 whilst maintaining backward compatibility.

Copy link
Member

@ematipico ematipico 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!

@ematipico ematipico added this pull request to the merge queue Nov 20, 2025
Merged via the queue into biomejs:main with commit e9f068e Nov 20, 2025
14 checks passed
@github-actions github-actions bot mentioned this pull request Nov 20, 2025
@hirokiokada77 hirokiokada77 deleted the fix/range-suppressions branch November 20, 2025 16:54
ryan-m-walker pushed a commit to ryan-m-walker/biome that referenced this pull request Nov 23, 2025
l0ngvh pushed a commit to l0ngvh/biome that referenced this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 Range suppression doesn't work with lint category

2 participants