Skip to content

chore(help-md-gen): address roborev #2146 review findings#3859

Merged
jqnatividad merged 1 commit into
masterfrom
roborev-fix-help-md-gen-2146
May 15, 2026
Merged

chore(help-md-gen): address roborev #2146 review findings#3859
jqnatividad merged 1 commit into
masterfrom
roborev-fix-help-md-gen-2146

Conversation

@jqnatividad
Copy link
Copy Markdown
Collaborator

Summary

Three LOW-severity follow-ups to #3858 from roborev job 2146:

  • Drop boolean from 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.

No behavior change for any current command: qsv --generate-help-md produces byte-identical output.

Test plan

  • cargo build --locked --bin qsv -F all_features
  • cargo clippy --bin qsv -F all_features -- -D warnings
  • cargo test --bin qsv -F all_features help_markdown_gen25/25 pass (new test: test_extract_arg_types_handles_generic_args_and_no_space_before_brace covers Args<'a>, Args<T>, and Args{)
  • cargo +nightly fmt
  • ./target/debug/qsv --generate-help-md — clean working tree (no doc changes vs master)

🤖 Generated with Claude Code

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>
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 boolean display type and clarifying that bool maps to flag.
  • Replace substring-based struct Args detection with a regex-based match that tolerates pub(...), generics (e.g. Args<'a>, Args<T>), and struct Args{ formatting.
  • Add test coverage for the new Args-struct matching shapes and document the single-line type-capture limitation.

@jqnatividad jqnatividad merged commit f7fd392 into master May 15, 2026
21 checks passed
@jqnatividad jqnatividad deleted the roborev-fix-help-md-gen-2146 branch May 15, 2026 23:36
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.

2 participants