chore: markdown rule generator - #11261
Conversation
|
98463b5 to
81ba058
Compare
WalkthroughThe codegen tooling now supports Markdown through the Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
xtask/codegen/src/generate_new_analyzer_rule.rs (1)
14-41: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd Markdown codegen tests.
LanguageKind::from_str("markdown")atxtask/codegen/src/generate_new_analyzer_rule.rs:31-45and the Markdown fixture branches at lines 648-673 have no direct tests. Add tests for parsing and generated valid and invalid Markdown fixtures. The existing analyser fixtures do not cover this generator path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@xtask/codegen/src/generate_new_analyzer_rule.rs` around lines 14 - 41, Add focused tests for the Markdown generator path: verify LanguageKind::from_str parses "markdown", and exercise the Markdown fixture branches in the generator with both valid and invalid inputs. Reuse the existing analyzer codegen test structure and fixture assertions so the tests confirm generated output and diagnostics without changing production behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@xtask/codegen/src/generate_new_analyzer_rule.rs`:
- Around line 613-615: Update the generated rule template around run and
invalid.md generation so diagnostic fixtures are emitted only when the generated
rule logic can return a matching signal; otherwise generate only the valid
fixture. Ensure the default run implementation does not produce an unsatisfiable
invalid.md test.
---
Outside diff comments:
In `@xtask/codegen/src/generate_new_analyzer_rule.rs`:
- Around line 14-41: Add focused tests for the Markdown generator path: verify
LanguageKind::from_str parses "markdown", and exercise the Markdown fixture
branches in the generator with both valid and invalid inputs. Reuse the existing
analyzer codegen test structure and fixture assertions so the tests confirm
generated output and diagnostics without changing production behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7d623326-fcb4-4ff9-a446-724e28bd05f7
📒 Files selected for processing (2)
justfilextask/codegen/src/generate_new_analyzer_rule.rs
| fn run(ctx: &RuleContext<Self>) -> Self::Signals {{ | ||
| let _node = ctx.query(); | ||
| None |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not generate an unsatisfiable diagnostic fixture.
run always returns None at Lines 613-615. Therefore, diagnostic cannot run. The generated invalid.md at Line 668 requires diagnostics, so a newly generated Markdown lint rule creates a test that cannot pass.
Generate the diagnostic fixture only with rule logic that emits a matching signal. Alternatively, generate only a valid fixture until the rule implementation adds a regression case. The existing Markdown fixture convention at crates/biome_markdown_analyze/tests/specs/nursery/useConsistentHeaderLevel/invalid.md:1-7 confirms that this marker requires diagnostics.
Also applies to: 668-668
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@xtask/codegen/src/generate_new_analyzer_rule.rs` around lines 613 - 615,
Update the generated rule template around run and invalid.md generation so
diagnostic fixtures are emitted only when the generated rule logic can return a
matching signal; otherwise generate only the valid fixture. Ensure the default
run implementation does not produce an unsatisfiable invalid.md test.
Summary
Added the xtask & just markdown rule generator
Test Plan
Docs