Fix ShellCheck findings in lib-deps-check and update-doc-db workflows - #7669
Conversation
Clear four of the five ShellCheck findings reported in RustPython#7653. The fifth finding is in upgrade-pylib.lock.yml — a gh-aw-generated file marked "DO NOT EDIT" whose source .md does not contain the flagged pattern — and is out of scope here; it will resolve via the in-flight gh-aw version bump (RustPython#7650). lib-deps-check.yaml: * SC2076: replace `=~ " $module "` (quoted regex interpreted literally) with `== *" $module "*` glob match. Same intent (literal substring), same semantics across regex metachars. * SC2086: quote `$GITHUB_OUTPUT` in the output redirect. update-doc-db.yml: * SC2129: collapse the eight sequential `echo ... >> $OUTPUT_FILE` lines (plus one `cat ... >> $OUTPUT_FILE`) into a single grouped redirect `{ ...; } > "$OUTPUT_FILE"`. Drops the now-redundant `echo -n '' > $OUTPUT_FILE` truncate. * SC2016: add `# shellcheck disable=SC2016` above the block; the backticks in the auto-generated-header comment are literal Markdown, not command substitution. Verified locally with shellcheck 0.11.0: both modified blocks produce no ShellCheck output. Semantic equivalence of the lib-deps-check change confirmed across six test inputs including regex metachars and glob-meaningful characters.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request addresses ShellCheck warnings in GitHub Actions workflows by refactoring shell script patterns. Changes include switching module detection from regex-based to wildcard-based matching, consolidating multiple echo statements into grouped redirects, and properly quoting variable references to improve script robustness. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Thanks for checking :) |
|
@youknowone the fifth ShellCheck alert is in a file you generated. Please regenerate |
| # shellcheck disable=SC2016 | ||
| { |
There was a problem hiding this comment.
I may have meant this:
| # shellcheck disable=SC2016 | |
| { | |
| { | |
| # shellcheck disable=SC2016 |
...but if it works, it works. ¯\_(ツ)_/¯
|
gh-aw is the generator |
Clears four of the five ShellCheck findings reported in #7653.
Scope
The fifth finding (
upgrade-pylib.lock.yml:511) is in a gh-aw-generated file marked "DO NOT EDIT" whose source.mddoesn't contain the flagged pattern — the `cat << EOF >> "$GH_AW_PROMPT"` sequence is injected by gh-aw's compile step for prompt assembly, not user-controlled workflow code. Per discussion on the issue, it will resolve via the in-flight gh-aw version bump in #7650.Changes
lib-deps-check.yamlSC2076 — replace `=~ " $module "` (quoted regex interpreted literally) with `== " $module "` glob match. Same intent (literal substring check), same semantics across both regex and glob metacharacters.
SC2086 — quote `$GITHUB_OUTPUT` in the output redirect.
update-doc-db.ymlSC2129 — collapse the eight sequential `echo ... >> $OUTPUT_FILE` lines (plus one `cat ... >> $OUTPUT_FILE`) into a single grouped redirect `{ ...; } > "$OUTPUT_FILE"`. Drops the now-redundant `echo -n '' > $OUTPUT_FILE` truncate (the grouped `>` handles truncation).
SC2016 — add `# shellcheck disable=SC2016` above the block; the backticks in the auto-generated-header comment are literal Markdown for the output
.rsfile, not command substitution.Verification
Both modified blocks produce no ShellCheck output with shellcheck 0.11.0.
Semantic equivalence of the
lib-deps-check`=~` → glob change was probed across six test inputs including regex metacharacters and glob-meaningful characters — outputs identical to the prior behavior in every case.Closes #7653 (scoped to findings 1-4, per maintainer discussion above).
Summary by CodeRabbit