Skip to content

Conversation

@Conaclos
Copy link
Member

Summary

Address #7758 (comment)

This PR updates the biome_analyze CONTRIBUTING guide and update rules_check xtask to emit diagnostic when a rule has a severity level unexpected in regard of its group.
Also, I added the exceptions we have. There era r5e more exceptions than I expected.

We should consider removing these exceptions in a future major version by moving the rules to other groups or by updating their severity. A third possibility is to relax some checks.

Test Plan

Everything should be green on CI.

Docs

I updated the contributing guide.

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

⚠️ No Changeset found

Latest commit: cce7aa4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Conaclos Conaclos requested review from a team October 22, 2025 19:49
@github-actions github-actions bot added A-Linter Area: linter A-Tooling Area: internal tools labels Oct 22, 2025
@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch 2 times, most recently from 0569488 to 5e7cf14 Compare October 22, 2025 19:51
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

Adds documentation to crates/biome_analyze/CONTRIBUTING.md describing rule groups, mandatory severities per category, guidance for promoting rules out of the nursery, and rule domains with an explicit RuleDomain import/example; includes a minor formatting tweak. In xtask/rules_check/src/lib.rs the previous single-field Errors(String) was replaced by a struct Errors { message: String } with a const fn new(message: String) -> Self, std::error::Error implementation and updated Display. Legacy helper constructors were removed and call sites updated to use Errors::new(...). Validation logic for group/severity combinations was expanded and error messages were adjusted accordingly.

Possibly related PRs

Suggested reviewers

  • ematipico
  • siketyan

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "chore: document rule-group severity relation and update rules_check" accurately reflects the two main changes in this PR: updates to the CONTRIBUTING.md documentation about rule-group severity relationships and enhancements to the rules_check xtask to validate severity levels. The title is concise, specific, and clearly communicates the primary focus of the changeset without unnecessary noise.
Description Check ✅ Passed The description is well-related to the changeset, providing context through a GitHub issue reference and explaining both the documentation updates and the new diagnostic validation logic for rule severities. It includes relevant details about exceptions being documented and discusses future considerations for handling them, plus a test plan and documentation note. This is more than sufficient for a lenient description check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch conaclos/rule-group-severity-check

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50762 50762 0
Passed 49558 49558 0
Failed 1162 1162 0
Panics 42 42 0
Coverage 97.63% 97.63% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6657 6657 0
Passed 2221 2221 0
Failed 4436 4436 0
Panics 0 0 0
Coverage 33.36% 33.36% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18805 18805 0
Passed 14375 14375 0
Failed 4429 4429 0
Panics 1 1 0
Coverage 76.44% 76.44% 0.00%

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: 1

📜 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 ad55b35 and 5e7cf14.

📒 Files selected for processing (2)
  • crates/biome_analyze/CONTRIBUTING.md (2 hunks)
  • xtask/rules_check/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/CONTRIBUTING.md
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • xtask/rules_check/src/lib.rs
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : When returning a code action, set category to ctx.action_category(ctx.category(), ctx.group()) and applicability via ctx.metadata().applicability()

Applied to files:

  • xtask/rules_check/src/lib.rs
🧬 Code graph analysis (1)
xtask/rules_check/src/lib.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (3)
  • Severity (9269-9269)
  • Category (8836-9259)
  • RuleCategory (9638-9638)
🪛 LanguageTool
crates/biome_analyze/CONTRIBUTING.md

[style] ~521-~521: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...relevant to Biome maintainers when they want to move (promote) a rule to a group that i...

(REP_WANT_TO_VB)


[uncategorized] ~526-~526: Loose punctuation mark.
Context: ...llow these constraints. - correctness, security, and a11y rules must h...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~528-~528: Possible missing comma found.
Context: ...ould certainly be in another group (for example suspicious instead of correctness)....

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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). (10)
  • GitHub Check: Test Node.js API
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: autofix
  • GitHub Check: Parser conformance
🔇 Additional comments (5)
crates/biome_analyze/CONTRIBUTING.md (1)

519-537: Clear documentation of group-severity relationships.

This guidance helps maintainers understand the expected severity levels for each rule group, and appropriately acknowledges legacy exceptions. Well done.

xtask/rules_check/src/lib.rs (4)

35-48: LGTM: Clean refactoring to explicit fields.

The shift from a tuple struct to explicit fields improves clarity. Using &'static str for compile-time metadata is appropriate.


50-93: Excellent error messages with clear guidance.

The pattern-matched messages are helpful and actionable. The unreachable! at line 89 is acceptable for a build-time tool—it'll fail fast if a new group isn't handled.


112-165: Logic correctly implements group-severity constraints.

The validation logic matches the documented requirements, with legacy exceptions appropriately inline-commented. Whilst the exception lists are lengthy, the PR objectives acknowledge this—good candidate for future cleanup tracking.


49-49: Good practice: implementing std::error::Error.

This enables the type to work with standard error-handling patterns.

@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch from 5e7cf14 to e18ed57 Compare October 22, 2025 20:04
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: 1

🧹 Nitpick comments (1)
crates/biome_analyze/CONTRIBUTING.md (1)

523-535: Tidy the plural phrasing

Those bullets currently read “Rules that belongs…”. Could you switch them to “Rules that belong…” (and similarly for each occurrence) to keep the prose crisp?

📜 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 5e7cf14 and e18ed57.

📒 Files selected for processing (2)
  • crates/biome_analyze/CONTRIBUTING.md (2 hunks)
  • xtask/rules_check/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/CONTRIBUTING.md
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • xtask/rules_check/src/lib.rs
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : When returning a code action, set category to ctx.action_category(ctx.category(), ctx.group()) and applicability via ctx.metadata().applicability()

Applied to files:

  • xtask/rules_check/src/lib.rs
🧬 Code graph analysis (1)
xtask/rules_check/src/lib.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (3)
  • Severity (9269-9269)
  • Category (8836-9259)
  • RuleCategory (9638-9638)
🪛 LanguageTool
crates/biome_analyze/CONTRIBUTING.md

[style] ~521-~521: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...relevant to Biome maintainers when they want to move (promote) a rule to a group that i...

(REP_WANT_TO_VB)


[uncategorized] ~526-~526: Loose punctuation mark.
Context: ...llow these constraints. - correctness, security, and a11y rules must h...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~528-~528: Possible missing comma found.
Context: ...ould certainly be in another group (for example suspicious instead of correctness)....

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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). (10)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
  • GitHub Check: Parser conformance

@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch from e18ed57 to b080a4d Compare October 22, 2025 20:25
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
xtask/rules_check/src/lib.rs (2)

401-403: Typo in comment.

“arent't” → “aren't”.

-    /// that arent't present in the source code but only in the AST.
+    /// that aren't present in the source code but only in the AST.

617-623: Fix: pass correct language types to create_analyzer_options for CSS and GraphQL.

Line 617 (CSS block) incorrectly uses JsonLanguage—should be CssLanguage. Line 663 (GraphQL block) incorrectly uses JsonLanguage—should be GraphqlLanguage. Both mismatches will cause incorrect analysis settings.

-                let options = create_analyzer_options::<JsonLanguage>(
+                let options = create_analyzer_options::<CssLanguage>(
                     &workspace_settings,
                     project_key,
                     &file_path,
                     test,
                 );
-                let options = create_analyzer_options::<JsonLanguage>(
+                let options = create_analyzer_options::<GraphqlLanguage>(
                     &workspace_settings,
                     project_key,
                     &file_path,
                     test,
                 );
♻️ Duplicate comments (1)
crates/biome_analyze/CONTRIBUTING.md (1)

519-539: Thanks for nailing down group↔severity (incl. Actions=info).

Content matches the new checker. One tiny prose tweak: add a comma after “for example” for readability in Line 528.

-  If `error` is too strict for a rule, then it should certainly be in another group (for example `suspicious` instead of `correctness`).
+  If `error` is too strict for a rule, then it should certainly be in another group (for example, `suspicious` instead of `correctness`).
🧹 Nitpick comments (4)
xtask/rules_check/src/lib.rs (4)

70-87: Polish Display messages: grammar and clarity.

Minor English fixes and a slightly friendlier nudge.

- "Rules that belongs to the group '{group}' must not have a severity set to 'error'. Lower down the severity or change the group of the rule."
+ "Rules that belong to the group '{group}' must not have a severity set to 'error'. Lower the severity or change the group of the rule."
- "Rules that belongs to the group '{group}' must have a severity set to 'warn'. Set the severity to 'warn' or change the group of the rule."
+ "Rules that belong to the group '{group}' must have a severity set to 'warn'. Set the severity to 'warn' or change the group of the rule."
- "Rules that belongs to the group '{group}' must have a severity set to 'warn' or 'error'. Change the severity or change the group of the rule."
+ "Rules that belong to the group '{group}' must have a severity set to 'warn' or 'error'. Change the severity or change the group of the rule."
- "The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belongs to the group {group} must have a severity set to 'error'. Set the severity to 'error' or change the group of the rule."
+ "The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belong to the group '{group}' must have a severity set to 'error'. Set the severity to 'error' or change the group of the rule."

88-91: Avoid panic on unknown group.

unreachable! will explode if a new group lands before this code is updated. Emit a generic message instead.

-            _ => {
-                unreachable!("Unhandled group");
-            }
+            _ => write!(
+                f,
+                "The rule '{rule_name}' belongs to the unrecognised group '{group}' with severity '{rule_severity}'. Please update rules_check to handle this group."
+            ),

112-160: Complex condition is getting unwieldy; consider extracting helpers and exception sets.

For readability and maintenance, lift each group check into a dedicated fn and move exception rule names into const slices per group. This makes adding/removing exceptions in a future major less error‑prone.


338-345: Nit: use usize for a count.

diagnostic_count is a count; usize is more idiomatic than i32.

-    diagnostic_count: i32,
+    diagnostic_count: usize,
📜 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 e18ed57 and b080a4d.

📒 Files selected for processing (2)
  • crates/biome_analyze/CONTRIBUTING.md (2 hunks)
  • xtask/rules_check/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • xtask/rules_check/src/lib.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/CONTRIBUTING.md
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Place new rules in the "nursery" group initially
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : When returning a code action, set category to ctx.action_category(ctx.category(), ctx.group()) and applicability via ctx.metadata().applicability()

Applied to files:

  • xtask/rules_check/src/lib.rs
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
🪛 LanguageTool
crates/biome_analyze/CONTRIBUTING.md

[style] ~521-~521: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...relevant to Biome maintainers when they want to move (promote) a rule to a group that i...

(REP_WANT_TO_VB)


[uncategorized] ~526-~526: Loose punctuation mark.
Context: ...llow these constraints. - correctness, security, and a11y rules must h...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~528-~528: Possible missing comma found.
Context: ...ould certainly be in another group (for example suspicious instead of correctness)....

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Parser conformance
  • GitHub Check: autofix
🔇 Additional comments (1)
crates/biome_analyze/CONTRIBUTING.md (1)

547-559: Rule domains snippet LGTM.

Import and example are clear and consistent with existing guidance. No changes needed.

@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch from b080a4d to ea5e153 Compare October 22, 2025 20:41
@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch 2 times, most recently from 48e6542 to d21e71c Compare October 23, 2025 20:19
@Conaclos Conaclos requested a review from ematipico October 23, 2025 20:19
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)
xtask/rules_check/src/lib.rs (1)

39-39: Remove misleading const modifier.

The const fn modifier here provides no practical benefit since String cannot be constructed in const contexts anyway. All call sites use format!(...), which isn't const-evaluable.

Apply this diff:

-    const fn new(message: String) -> Self {
+    fn new(message: String) -> Self {
📜 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 ea5e153 and d21e71c.

📒 Files selected for processing (2)
  • crates/biome_analyze/CONTRIBUTING.md (2 hunks)
  • xtask/rules_check/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/CONTRIBUTING.md
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • xtask/rules_check/src/lib.rs
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Place new rules in the "nursery" group initially
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Place new rules in the "nursery" group initially

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
🪛 LanguageTool
crates/biome_analyze/CONTRIBUTING.md

[style] ~522-~522: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...relevant to Biome maintainers when they want to move (promote) a rule to a group that i...

(REP_WANT_TO_VB)


[uncategorized] ~527-~527: Loose punctuation mark.
Context: ...llow these constraints. - correctness, security, and a11y rules must h...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~529-~529: Possible missing comma found.
Context: ...ould certainly be in another group (for example suspicious instead of correctness)....

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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). (8)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
  • GitHub Check: Parser conformance
🔇 Additional comments (3)
crates/biome_analyze/CONTRIBUTING.md (2)

519-540: Excellent documentation of severity requirements.

This section clearly documents all the group/severity constraints that the rules_check xtask now enforces. The guidance will help maintainers avoid validation errors when promoting rules from nursery.


541-572: Clear and helpful domain documentation.

This section provides a solid explanation of rule domains with a practical example. The note about consulting maintainers before adding new domains is a sensible safeguard.

xtask/rules_check/src/lib.rs (1)

60-142: Comprehensive severity validation logic.

The expanded validation enforces all the group/severity constraints now documented in CONTRIBUTING.md. The TODO comments for legacy exceptions are appropriately placed, and error messages clearly guide developers to fix validation failures.

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.

Just one comment to address

@Conaclos Conaclos force-pushed the conaclos/rule-group-severity-check branch from d21e71c to cce7aa4 Compare October 24, 2025 20:54
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: 1

📜 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 d21e71c and cce7aa4.

📒 Files selected for processing (2)
  • crates/biome_analyze/CONTRIBUTING.md (3 hunks)
  • xtask/rules_check/src/lib.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/CONTRIBUTING.md
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • xtask/rules_check/src/lib.rs
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Place new rules in the "nursery" group initially
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Choose rule severity appropriately (error/warn/info); set severity in declare_lint_rule! only when deviating from default

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Documentation for rules must have a single-line first paragraph, include ## Examples with ### Invalid then ### Valid, and document options under ## Options with properly marked code blocks

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Place new rules in the "nursery" group initially

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
📚 Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Use RuleDomain(s) only when applicable and list them in declare_lint_rule! domains; recommended rules with domains are enabled based on manifest detection

Applied to files:

  • crates/biome_analyze/CONTRIBUTING.md
🧬 Code graph analysis (1)
xtask/rules_check/src/lib.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (3)
  • Severity (9269-9269)
  • Category (8836-9259)
  • RuleCategory (9638-9638)
🪛 LanguageTool
crates/biome_analyze/CONTRIBUTING.md

[style] ~523-~523: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...relevant to Biome maintainers when they want to move (promote) a rule to a group that i...

(REP_WANT_TO_VB)


[uncategorized] ~528-~528: Loose punctuation mark.
Context: ...llow these constraints. - correctness, security, and a11y rules must h...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~530-~530: Possible missing comma found.
Context: ...ould certainly be in another group (for example suspicious instead of correctness)....

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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 Node.js API
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Parser conformance
  • GitHub Check: autofix
🔇 Additional comments (3)
crates/biome_analyze/CONTRIBUTING.md (2)

29-29: LGTM!

TOC entry correctly added for the new section.


520-574: Excellent documentation of group/severity constraints.

The new sections clearly document the severity requirements for each rule group and provide helpful guidance on rule domains. All previously requested improvements have been addressed, including the action severity requirement.

xtask/rules_check/src/lib.rs (1)

68-141: Comprehensive validation logic with clear error messages.

The expanded group/severity checks align well with the updated documentation. The exception lists are properly marked for future cleanup, and the error messages provide actionable guidance.

Comment on lines +39 to 41
const fn new(message: String) -> Self {
Self { message }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove const – String isn't const-compatible.

This won't compile; const fn cannot accept String parameters because heap allocation isn't const-evaluable.

Apply this diff:

-    const fn new(message: String) -> Self {
+    fn new(message: String) -> Self {
         Self { message }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const fn new(message: String) -> Self {
Self { message }
}
fn new(message: String) -> Self {
Self { message }
}
🤖 Prompt for AI Agents
In xtask/rules_check/src/lib.rs around lines 39 to 41, the constructor is
declared as `const fn new(message: String) -> Self` which is invalid because
`String` cannot be used in const functions; change the signature to a normal
function by removing `const` so it reads `fn new(message: String) -> Self { Self
{ message } }` (alternatively consider accepting `&str` and cloning if you
prefer), ensuring the implementation stays the same but is non-const.

@Conaclos Conaclos merged commit ee2f5bf into main Oct 24, 2025
13 of 14 checks passed
@Conaclos Conaclos deleted the conaclos/rule-group-severity-check branch October 24, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Tooling Area: internal tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants