Repository navigation
Wrap overlong \usage lines roxygen2-style - #32
Merged
Merged
Conversation
format_usage() previously wrapped only between arguments, so a single argument with a long default (a multi-value c(...) or Sys.getenv()) produced \usage lines wider than 90 characters and an R CMD check NOTE. Adopt roxygen2's algorithm: single line when the bare call is under 80 characters, otherwise one argument per line at two-space indent, with each overlong argument broken at spaces outside quoted strings to the 90-character Rd limit (new wrap_usage_arg() helper, fuzz-verified byte-identical to roxygen2's wrapUsage across 1100+ cases). The width decision is made on the bare name so \method markup and the replacement-function suffix keep headroom, also matching roxygen2.
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.
Closes #29.
Problem
format_usage()wrapped only between arguments, so a single argument with a long default (a multi-valuec(...)choice vector, aSys.getenv("LONG_NAME", "")default) produced\usagelines past 90 characters and anR CMD checkNOTE. This blocked llm.api 0.1.9 release prep.Fix
Adopt roxygen2's algorithm exactly:
\methodmarkup, no<- valuesuffix) is under 80 characters.wrap_usage_arg()helper).\method{}{}markup and the replacement suffix, matching roxygen2.wrap_usage_arg()was fuzz-verified byte-identical to roxygen2's C++wrapUsage()on 1134 cases (real llm.api signatures, quoted strings with spaces, naive-escape behavior, backticks, random char soups, widths 12-90). The end-to-end\usageblock for the issue's repro matches roxygen2 output byte-for-byte.Verification
tools:::.check_Rd_line_widths()comes back clean.Note on branch contents
This branch also merges in
797fb23(Prepare CRAN release 0.4.0), which was on the localrelease-0.4.0branch and never made it back to main after CRAN acceptance — main still said 0.3.3.8. Once main is fast-forwarded to797fb23(git push origin release-0.4.0:mainfrom the local checkout), this PR shrinks to just the #29 commits. Version bumped to 0.4.0.1.