Commit 4ddf73d
committed
feat(lint): add Rust doc comment linting support
Extract markdown from `///` and `//!` doc comments in `.rs` files, lint
each block as standalone markdown, and apply fixes with prefix restoration.
Architecture follows the embedded markdown pattern:
- Library crate (`src/doc_comment_lint.rs`): extraction + check-only logic
- Binary crate (`src/file_processor/doc_comments.rs`): fix mode + restoration
- Integration in processing pipeline for check, fix, and diff modes
Key behaviors:
- Groups contiguous same-kind doc comment lines into blocks
- Strips prefixes for linting, restores them faithfully after fixes
- Preserves original indentation, prefix style (space/tab/none)
- Remaps line and column numbers to original file positions
- Skips MD025, MD041, MD047, MD052 for doc comments
- Handles `///content` (no space), `///`, `///\t`, and indented blocks
- Processes blocks in reverse order to maintain byte offsets during fixes
- Trailing newline preservation for idempotent fix application
Validated against serde (208 files), tokio (765 files), and ripgrep
(100 files) with zero crashes and no false positives from extraction.
Closes #4381 parent 5b51ab8 commit 4ddf73d
File tree
6 files changed
+1340
-0
lines changed- src
- file_processor
- tests
6 files changed
+1340
-0
lines changed
0 commit comments