chore(help-md-gen): address roborev #2146 review findings#3859
Merged
Conversation
Three LOW-severity follow-ups to the help-md-gen Type-column work (roborev job 2146 on commit ae4a5c3): - Drop "boolean" from the `classify_rust_type` and `extract_arg_types_from_source` docstrings — the function never returns "boolean" (bool maps to "flag"), so the docs were out of sync with the implementation. - Replace the substring-based `struct Args` lookup with a regex (`(?m)^\s*(?:pub(?:\([^)]*\))?\s+)?struct\s+Args\b`) so future generic-parameter or no-space-before-brace shapes (`struct Args<'a>`, `struct Args<T>`, `struct Args{`) keep working. Word-boundary anchored to avoid matching `ArgsExtra`. - Document the single-line type-capture limitation in the function docstring (a future `flag_x:\n Option<…>,` field would silently fall back to "string"). Added a unit test exercising the new generic-args path. No behavior change for any current command — `qsv --generate-help-md` produces identical output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is a small follow-up to the help-markdown generator improvements, keeping documentation accurate and making the Args-struct discovery logic more robust to future Rust syntax shapes (generics and brace spacing) without changing current generated output.
Changes:
- Align docstrings with actual behavior by removing the nonexistent
booleandisplay type and clarifying thatboolmaps toflag. - Replace substring-based
struct Argsdetection with a regex-based match that toleratespub(...), generics (e.g.Args<'a>,Args<T>), andstruct Args{formatting. - Add test coverage for the new
Args-struct matching shapes and document the single-line type-capture limitation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three LOW-severity follow-ups to #3858 from roborev job 2146:
booleanfromclassify_rust_typeandextract_arg_types_from_sourcedocstrings — the function never returnsboolean(boolmaps toflag), so the docs were out of sync with the implementation.struct Argslookup with a regex ((?m)^\s*(?:pub(?:\([^)]*\))?\s+)?struct\s+Args\b) so future generic-parameter or no-space-before-brace shapes (struct Args<'a>,struct Args<T>,struct Args{) keep working. Word-boundary anchored to avoid matchingArgsExtra.flag_x:\n Option<…>,field would silently fall back tostring.No behavior change for any current command:
qsv --generate-help-mdproduces byte-identical output.Test plan
cargo build --locked --bin qsv -F all_featurescargo clippy --bin qsv -F all_features -- -D warningscargo test --bin qsv -F all_features help_markdown_gen— 25/25 pass (new test:test_extract_arg_types_handles_generic_args_and_no_space_before_bracecoversArgs<'a>,Args<T>, andArgs{)cargo +nightly fmt./target/debug/qsv --generate-help-md— clean working tree (no doc changes vs master)🤖 Generated with Claude Code