Skip to content

chore: markdown rule generator - #11261

Merged
ematipico merged 1 commit into
mainfrom
chore/markdown-rule-generator
Aug 7, 2026
Merged

ematipico merged 1 commit into
mainfrom
chore/markdown-rule-generator

Conversation

@Netail

@Netail Netail commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Added the xtask & just markdown rule generator

Test Plan

Docs

@changeset-bot

changeset-bot Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 81ba058

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

@Netail
Netail force-pushed the chore/markdown-rule-generator branch from 98463b5 to 81ba058 Compare August 6, 2026 22:18
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The codegen tooling now supports Markdown through the LanguageKind enum, string conversion, and input parsing. New justfile targets generate Markdown lint and assist rules, then regenerate analyser files. Generated rules use Markdown imports, metadata, MdRoot, Markdown diagnostics, .md test files, and Markdown fixtures.

Possibly related PRs

  • biomejs/biome#11253: Adds the Markdown analyser and rule-generation infrastructure used by this change.

Suggested labels: A-Tooling, A-Linter, L-Markdown

Suggested reviewers: dyc3, ematipico

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: a Markdown rule generator.
Description check ✅ Passed The description directly states that the pull request adds an xtask and just-based Markdown rule generator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/markdown-rule-generator

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

@coderabbitai coderabbitai Bot 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.

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 win

Add Markdown codegen tests.

LanguageKind::from_str("markdown") at xtask/codegen/src/generate_new_analyzer_rule.rs:31-45 and 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

📥 Commits

Reviewing files that changed from the base of the PR and between c4a07bf and 81ba058.

📒 Files selected for processing (2)
  • justfile
  • xtask/codegen/src/generate_new_analyzer_rule.rs

Comment on lines +613 to +615
fn run(ctx: &RuleContext<Self>) -> Self::Signals {{
let _node = ctx.query();
None

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.

🎯 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's boilerplate

@ematipico
ematipico merged commit 1d24304 into main Aug 7, 2026
1 check passed
@ematipico
ematipico deleted the chore/markdown-rule-generator branch August 7, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants