Add shellcheck to CI (refs #1) - #6
Merged
Merged
Conversation
Introduces a shellcheck job to the existing Go workflow that runs on every PR and lints install.sh and build.sh. Also fixes the one warning shellcheck flagged in build.sh (SC2046, unquoted command substitution inside `git rev-parse --short`) so the new job passes from day one. shellcheck won't catch the specific `curl -L -o <URL>` bug from #1 (curl flag semantics aren't in shellcheck's domain), so this is the "belt-and-suspenders" half of the test plan posted on that issue, not the load-bearing test. A behavioral test that runs the download step against a local fixture server is still needed to cover #1 directly. Refs #1
Replaces the hard-coded `install.sh build.sh` argument list with a discovery step that finds every tracked shell script in the repo, regardless of directory. shellcheck has no built-in recursive mode, so discovery is done externally via `git ls-files`: - any tracked file with a known shell extension (.sh/.bash/.ksh/.zsh) - any tracked file whose first line is a shell shebang Scoping to `git ls-files` means newly added or renamed scripts are picked up automatically on the PR that introduces them, and we don't scan vendored/build artifacts that aren't under version control. Refs #1
dolph
commented
Apr 26, 2026
| # picks up newly added or renamed scripts on the PR that introduces them. | ||
| mapfile -t scripts < <( | ||
| { | ||
| git ls-files -- '*.sh' '*.bash' '*.ksh' '*.zsh' |
Owner
Author
There was a problem hiding this comment.
We can safely assume all shell files in this repo are .sh
2 tasks
dolph
added a commit
that referenced
this pull request
Apr 26, 2026
Simplify shellcheck discovery to .sh only (review feedback from #6)
This was referenced Apr 27, 2026
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.
Summary
shellcheckjob to.github/workflows/go.ymlthat runs on every PR (and push tomain).build.sh, an unquoted command substitution nested insidegit rev-parse --short. Quoting the inner$(git rev-list -1 HEAD)resolves the warning so the new job is green from the start.Refs #1.
Discovery approach
shellcheck has no built-in recursive / directory-scan option (
shellcheck --helpconfirmsFILES...is a hard requirement), so discovery is done externally. The step usesgit ls-files, which has two nice properties:.git/, vendored deps, or local untracked artifacts.git ls-filesoutput on the PR that introduces them, so they get linted on that same PR with no manual update to the workflow.Two predicates feed into the script list, then deduped via
sort -u:*.sh/*.bash/*.ksh/*.zsh.^#!.*sh([[:space:]]|$)— covers#!/bin/sh,#!/bin/bash,#!/usr/bin/env bash,#!/bin/dash -x,#!/bin/zsh, etc., catching scripts without a conventional extension.Tested locally on this branch: discovers
build.shandinstall.sh, shellcheck exits 0.Scope note
This is the belt-and-suspenders half of the test plan posted on #1, not the load-bearing test. shellcheck doesn't model curl's flag semantics, so it does not catch the specific
curl -L -o <URL>bug from that issue. A behavioral test — running the download step against a local HTTP fixture in CI and asserting that aussherbinary file actually lands in cwd — is still needed to cover #1 directly. That belongs in a separate PR.What this PR does buy us: cheap, automatic coverage for the broader class of shell-script bugs (unquoted expansions,
[[vs[, dead code, missing--separators, etc.) for every shell script in the repo, now and in the future.Test plan
install.shandbuild.shlocally.shellcheckexits 0 against the discovered set../build.shstill runs end-to-end andGIT_COMMITis populated correctly after the SC2046 fix (tests pass,--versionprints expected commit SHA).shellcheckjob passing alongside the existingbuildjob..shextension, as long as it has a shell shebang) is automatically linted with no further workflow changes.https://claude.ai/code/session_013HnepY8MhhxrJJjE5ysW47