chore(lint): shellcheck and shfmt every tracked shell file - #25
Merged
Merged
Conversation
added 5 commits
September 16, 2026 16:35
Widen mise.toml's lint task to shellcheck every tracked *.sh/*.bash/*.bats
file (was lib/scripts/common only). Fix or pragma every finding this
surfaced:
- SC2016 (34x): a same-line-preceding disable, all deliberate literal
${...} written into a generated compose.yaml/Dockerfile/TS file or
matched against one, never meant to expand in this shell.
- SC2015 (5x): disabled in splice guards (`grep && grep || die`) β
die firing when any grep fails is the intended behaviour.
- SC1003 (3x): disabled alongside SC2016 in a Dockerfile RUN block
where the trailing backslashes are literal line continuations.
- SC2154 (2x): disabled in tests/helpers/setup.bash's assert_ok β
status/output are bats' own run-captured variables.
- SC1090 (3x): `# shellcheck source=/dev/null` on tests/service.bats'
dynamic driver sources, matching the convention services/*/drivers
already use.
- SC2031/SC2167 (6x): disabled β tests/service.bats sources
lib/service.sh, whose functions reuse the loop variable names
`driver`/`service`; shellcheck's merged-scope analysis flags them
even though they're read-only here.
- SC2034: removed an unused `row` local in tests/wizard.bats.
- SC2164: guarded `cd` in tests/install.bats' setup.
- SC2005: dropped a useless `echo $(cat ...)` in tests/publish.bats.
- SC2317 (5x): tests/.shellcheckrc disables it for tests/ only β
shellcheck parses a .bats file's @test blocks as one flat script,
so a `return` at the end of one marks every later @test unreachable.
shfmt 3.14.1 is pinned in [tools] here too (mise.lock records it) so it
is available for the next commit, which widens the lint task to run it
and reformats the tree β kept separate so this commit stays pure
shellcheck content, since the pre-commit hook lints the whole tree at
each commit and the two checks can't both go green until shfmt has run.
No behaviour change: mise run test-unit (196/196) passes unchanged.
git ls-files -- scaffold '*.sh' '*.bash' '*.bats' | xargs shfmt -i 2 -ci -w across the whole tree, and widen mise.toml's lint task with the matching shfmt -d line so this is enforced going forward. Layout only β git diff -w still shows changes because shfmt moves `\`-continued && / || onto the trailing end of the previous line and expands one-liners like `local x; x="$(...)"` onto two lines, not because meaning changed. mise run lint and mise run test-runner (265/265: 196 unit + 69 integration) both pass.
5 tasks
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.
What this changes
First of five cleanup PRs (spec:
docs/superpowers/specs/2026-09-16-clean-shell-and-comments-design.md).shfmt = "3.14.1";mise run lintnow runs shellcheck andshfmt -i 2 -ci -dover every tracked shell file, includingservices/,tests/*.batsandtests/helpers/, which were never linted beforetests/.shellcheckrcdisables SC2317 for bats'@testbodies7b1ef84is theshfmt -wpass; it also carries the second line of[tasks.lint], because the whole-tree pre-commit lint could not pass with either half aloneNo behaviour change.
How it was verified
mise run lintβ exit 0mise run test-runnerβ 265/265 (196 unit + 69 integration), exit 0Checklist
mise run lintpassesmise run test-runnerpasses