fix(api-docs/cpp): silence remaining SC2016 false positives#73
fix(api-docs/cpp): silence remaining SC2016 false positives#73WomB0ComB0 merged 1 commit intomainfrom
Conversation
Two more single-quoted patterns in cpp template flagged by actionlint shellcheck SC2016 on vcpkg (caller pinned to @main, not the older bd95037 SHA other source repos use): sed inline-stripper with literal backticks (annotated with shellcheck disable; double quotes would require ugly backslash escapes), and the build-pages-index sed switched to double-quoted with the literal $ end-anchor escaped as \\$.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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.
Code Review
This pull request updates the API documentation workflow by adding ShellCheck suppression comments and modifying sed syntax to avoid linting warnings. Feedback suggests that using double quotes for sed patterns may be fragile and recommends sticking to single quotes with explicit disable comments to ensure robustness against special characters in filenames. Additionally, the review highlights potential improvements for handling file paths in monorepos and refining the scope of file discovery in CI to prevent failures.
| run: | | ||
| find . -name "*.md" -type f \ | ||
| | sed 's|^\./||; s|\.md$||' \ | ||
| | sed "s|^\./||; s|\.md\$||" \ |
There was a problem hiding this comment.
While switching to double quotes silences the ShellCheck SC2016 false positive, using | as a delimiter in sed can be fragile if any generated file paths contain that character. Since find . output always contains /, the pipe delimiter is generally safer than a slash, but if the environment allows for arbitrary filenames, it could still fail. A more robust way to handle the extension stripping while keeping ShellCheck happy would be to use single quotes and a disable comment, or use a different tool like basename or shell parameter expansion. Additionally, ensure that the documentation configuration includes the relative path to the package directory in source code links to ensure they resolve correctly in a monorepo, and consider using find with -maxdepth 2 or explicit project lists to limit discovery scope in CI.
References
- When configuring source code links in documentation generators for monorepos, the base URL must include the relative path to the package directory to ensure 'View source' links resolve correctly to the file locations.
- Prefer explicit project lists over automated discovery in CI workflows if the repository structure contains duplicate project configurations.
- In CI workflows, dynamically discover build artifacts (e.g., using 'find' with '-maxdepth 2') instead of hardcoding paths to ensure consistency and prevent failures.
Follow-up to #72. The previous fix only addressed the
findglob; vcpkg`s actionlint then surfaced two more SC2016 false positives in the same template (shellcheck reports one per file per run, so each fix unmasks the next).Findings closed by this PR
sed -i -E 's/inline//g'Backticks in the sed pattern are literal characters matching the markdown code-span delimiters around the word
inlinein moxygen output. shellcheck SC2016 thinks they are command substitution and flags the line.Switching to double quotes would require
"s/ \\\\\\inline\\\//g"— ugly. Annotated with# shellcheck disable=SC2016and a comment explaining the rationale.sed 's|^\\./||; s|\\.md$||'The
$is a regex end-of-line anchor, not parameter expansion. Switched to double-quoted with\\$escape — clean and equivalent.Why this only matters for vcpkg
vcpkg
ssecurity.ymlcallsresq-software/.github/.github/workflows/security-scan.yml@main(floating). The other 4 source repos pin commitbd95037`, which evidently treats SC2016 as advisory rather than fatal. Once they update their pin they will hit the same problem; the same patterns exist in their templates (see follow-up note below).Out of scope
The
sed "s|\\.md\\$||"end-anchor pattern exists identically in the python, dotnet, typescript, and rust templates (line 510, 472, 457, 597 respectively). Not preemptively fixed in this PR to avoid triggering 4 unnecessary cross-repo sync cycles for repos where actionlint currently passes. When their security-scan pin updates, fix them then.Test plan
gates / Security / actionlintcheck should passRelated