Skip to content

Commit 0375968

Browse files
committed
ci: answer the shellcheck and actionlint findings
Nine findings across the shell scripts and the `run:` blocks, reducing to three causes. None had ever been reported by anything the repository runs: shellcheck and actionlint are not installed here, and SonarQube's shell analysis arrives after the merge. SC1091, twice, was real. `. "$(dirname "$0")/../trains.sh"` is a path shellcheck cannot resolve statically, so it was skipping the sourced file entirely — the single source of truth for the release trains went unchecked in both scripts that read it. A `# shellcheck source=` directive fixes the analysis, not just the message. The other seven are false positives, each annotated where it fires rather than disabled repository-wide. SC2016 (five) reads the Markdown backticks in a printf format as command substitution; every one of these formats emits a step summary or a pull-request comment. SC2317 (two) calls the hook's two rule functions unreachable, because they are reached through the `"rule_${rule}"` dispatch a static reader cannot follow — the rule's own message says to ignore it when the call is indirect. A `.shellcheckrc` would have silenced all seven in one line and blinded both rules everywhere else, including where they are right. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017bxVrnCNsXW3RvwmLc9Kvy
1 parent 9616bf1 commit 0375968

6 files changed

Lines changed: 9 additions & 0 deletions

File tree

.claude/hooks/coding-rules.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ display="${file##*/}"
6161
# (documentation routinely shows `var` in sample code), an anonymous type (C#
6262
# gives no other spelling), and an occurrence inside a string literal (the
6363
# analyzer suites embed C# fixtures that deliberately use `var`).
64+
# shellcheck disable=SC2317 # reached through the `"rule_${rule}"` dispatch in the run section below
6465
rule_explicit_types() {
6566
awk -v name="$display" '
6667
{
@@ -93,6 +94,7 @@ rule_explicit_types() {
9394
' "$file"
9495
}
9596

97+
# shellcheck disable=SC2317 # reached through the `"${rule}_hint"` dispatch in the run section below
9698
explicit_types_hint() {
9799
printf '%s' "Coding rule — explicit types (CLAUDE.md, \"Coding rules\"). This file now declares
98100
inferred types:

.github/workflows/adr-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ jobs:
123123
if [ "$needs" = "true" ] && [ -n "$report" ]; then
124124
printf '%s\n' "$report" >> "$GITHUB_STEP_SUMMARY"
125125
else
126+
# shellcheck disable=SC2016 # the backticks are Markdown, not command substitution
126127
printf '### 🏛️ ADR check (advisory)\n\nNo architectural decision detected on `%s` versus `%s`. Nothing to flag.\n' \
127128
"$BRANCH" "$BASE" >> "$GITHUB_STEP_SUMMARY"
128129
fi

.github/workflows/dependabot-autofix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,16 @@ jobs:
302302
patch="$(jq -r '.patch // ""' verdict.json)"
303303
msg="$(jq -r '.commit_message // ""' verdict.json)"
304304
if [ -n "$patch" ]; then
305+
# shellcheck disable=SC2016 # the backticks are Markdown, not command substitution
305306
printf 'Apply it yourself:\n\n```diff\n%s\n```\n\n' "$patch"
307+
# shellcheck disable=SC2016 # the backticks are Markdown, not command substitution
306308
[ -n "$msg" ] && printf 'Commit it as:\n\n```\n%s\n```\n\n' "$msg"
307309
fi
308310
else
309311
printf '**🧑 Needs a human** — %s.\n\n' "$category"
310312
[ -n "$explanation" ] && printf '%s\n\n' "$explanation"
311313
fi
314+
# shellcheck disable=SC2016 # the backticks are Markdown, not command substitution
312315
printf '_No dependency version was changed. See `%s`._\n' "$doc"
313316
} > comment-body.md
314317

tools/analyzer-count-check/check-analyzer-count.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ fi
6868

6969
if [ "$status" -ne 0 ]; then
7070
printf '\nUpdate the bullet in FirstClassErrors/README.nuget.md to read:\n' >&2
71+
# shellcheck disable=SC2016 # the backticks are Markdown code spans in the format string, not command substitution
7172
printf ' **%s Roslyn analyzers in the box (`%s`-`%s`).**\n' "$count" "$low" "$high" >&2
7273
exit 1
7374
fi

tools/changelog/collect-prs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set -eu
2828
component="${1:-}"
2929
# Tag prefix and train scopes come from tools/trains.sh (the single source of truth
3030
# shared with release-notes.sh), so the changelog and the release notes never diverge.
31+
# shellcheck source=tools/trains.sh
3132
. "$(dirname "$0")/../trains.sh"
3233
prefix="$(prefix_of "$component")"
3334
train_scopes="$(scopes_of "$component")"

tools/packaging/release-notes.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ end_ref="${3:-$current_tag}"
3030

3131
# Tag prefix and train scopes come from tools/trains.sh (the single source of truth
3232
# shared with the changelog tooling), so the two can never disagree on the partition.
33+
# shellcheck source=tools/trains.sh
3334
. "$(dirname "$0")/../trains.sh"
3435
prefix="$(prefix_of "$scope")"
3536
train_scopes="$(scopes_of "$scope")"

0 commit comments

Comments
 (0)