fix(doc-markdown): wrap ignore_comments and ignore_strings in backticks#612
fix(doc-markdown): wrap ignore_comments and ignore_strings in backticks#612EffortlessSteven wants to merge 4 commits intomainfrom
Conversation
…down Work item: work-452a2701
Work item: work-d4a75f70 This ADR documents the decision to update diffguard.toml.example to demonstrate the tags and test_cases features, which already exist in the codebase but are missing from the example file. - Add tags = ["safety"] to rust.no_unwrap (consistent with built_in.json) - Add [[rule.test_cases]] blocks with positive and negative test cases - Keep additions minimal (~10 lines) per plan review recommendations
Work item: work-d4a75f70 - Add tags = ["safety"] to rust.no_unwrap (consistent with built_in.json) - Add [[rule.test_cases]] blocks with positive and negative test cases - Positive case: input with .unwrap() should_match = true - Negative case: input with .ok() should_match = false Closes #463
…eError Doc writer: add missing docstrings to public types in diffguard-diff. - ChangeKind: explain Added/Changed/Deleted semantics - DiffLine: document path, line, content, kind fields - DiffStats: document files and lines count fields - DiffParseError: document MalformedHunkHeader and Overflow variants All predicate functions already had #[must_use] and docstrings from prior implementation work (issue #498, PR #511).
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 31 minutes and 38 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 189b7b00c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let mut out = vec![b' '; len]; | ||
|
|
||
| // This will fail to compile until handle_normal_mode is implemented | ||
| let _i = p.handle_normal_mode(bytes, &mut out, 0, len); |
There was a problem hiding this comment.
Remove integration tests that call private Preprocessor handlers
This new integration test invokes Preprocessor internals (handle_normal_mode and similar) that are not part of the crate’s public API, and the file even documents that it is expected to fail compilation; because files under tests/ are compiled by cargo test, this change makes the diffguard-domain test target fail to build in CI.
Useful? React with 👍 / 👎.
| #[test] | ||
| fn summarize_empty_history_yields_zero_totals() { | ||
| let history = TrendHistory { | ||
| schema: TREND_HISTORY_SCHEMA_V2.to_string(), |
There was a problem hiding this comment.
Replace non-existent V2 trend schema references in edge-case tests
The test file references TREND_HISTORY_SCHEMA_V2, but the analytics crate only defines TREND_HISTORY_SCHEMA_V1; this unresolved symbol prevents the test target from compiling, so cargo test -p diffguard-analytics will fail at build time.
Useful? React with 👍 / 👎.
| let lines: Vec<&str> = source.lines().collect(); | ||
|
|
||
| // Line 398 (1-indexed) = index 397 (0-indexed) | ||
| let line_398 = lines.get(397).expect("Line 398 should exist"); |
There was a problem hiding this comment.
Avoid hard-coded source line assertions in doc_markdown_fix tests
This test assumes the ignore_comments doc string lives at fixed line 398 (lines.get(397)), but this same commit shifted those comments to later lines, so the assertion now checks the wrong source line and fails even when the documentation is correct; matching by nearby text/function context is needed to keep this test stable.
Useful? React with 👍 / 👎.
| let has_negative_case = rule_block.contains("[[rule.test_cases]]") | ||
| && rule_block.contains("should_match = false") | ||
| && !rule_block.contains(".unwrap()") | ||
| && !rule_block.contains(".expect()"); |
There was a problem hiding this comment.
Restrict negative-case predicate to a single test case block
The negative-case check requires the entire rust.no_unwrap rule block to contain no .unwrap()/.expect(), but the same block is expected to include a positive case containing .unwrap(); with both present (as in the updated example), has_negative_case is always false and this test deterministically fails.
Useful? React with 👍 / 👎.
| /// | ||
| /// Stored as `u64` to avoid silent truncation for very large diffs | ||
| /// (those with more than 2^32 - 1 unique lines). | ||
| pub lines_scanned: u64, |
There was a problem hiding this comment.
Bump/regenerate schemas after widening lines_scanned to u64
Changing DiffMeta.lines_scanned to u64 alters the serialized contract, but the checked-in JSON schemas still declare lines_scanned as uint32 (schemas/diffguard.check.schema.json and schemas/diffguard.trend-history.v1.schema.json), so large outputs can violate the published schemas and break downstream validators unless schemas/versioning are updated in lockstep.
Useful? React with 👍 / 👎.
Fix clippy::doc_markdown warnings in diffguard-types/src/lib.rs by wrapping bare identifiers in doc comments with backticks.
Changes
ignore_comments→ `ignore_comments`ignore_strings→ `ignore_strings`Note
The issue description incorrectly stated lines 398 and 402, but the actual doc comments are at lines 402 and 406. The task list correctly identified the line numbers.
Fixes work-452a2701