Repository navigation
Description
Problem
build.sh mixes tab- and space-based indentation. Most of the file is indented with 2 spaces, but a few blocks use tabs, and one block even mixes both within itself.
Counting leading whitespace in build.sh (at the current master, 7acb32f):
- 76 lines start with a space
- 11 lines start with a tab (the
updpkgsums,test, andpost_processblocks)
The post_process block is the clearest offender — three lines are tab-indented while the eval line beside them is space-indented:
if [ -n "$post_process" ]; then
<TAB>echo '::group::Executing post process commands'
<TAB>cd /tmp/local-repo/
eval "$post_process" # <-- 2 spaces, not a tab
<TAB>echo '::endgroup::'
fi
This renders unevenly depending on each viewer's tab width and makes diffs noisier than they need to be (it surfaced while reviewing #52).
Proposal
Standardize on spaces only, at 2-space indentation — that is already the majority style in build.sh and matches entrypoint.sh. A one-time reformat of the tab-indented blocks would bring the repo to a single consistent style.
Tooling to keep it consistent going forward
The repo currently has no formatter, linter, or CI wired up, so nothing prevents mixed indentation from creeping back in. Options, roughly from lightest to strongest:
-
.editorconfig— the baseline. An editor-agnostic file that declares the intended style so most IDEs/editors indent correctly on save. Covers every file type, not just shell:root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false
-
shfmt(mvdan/sh) — the gofmt/prettier of shell. It reformats scripts to a canonical style (shfmt -i 2 -w build.sh) and reads.editorconfigautomatically. In CI,shfmt -d .prints a diff and exits non-zero on any deviation, so unformatted code fails the check. This is the strongest guarantee for shell specifically. -
editorconfig-checker— validates all files against.editorconfigin CI (broader than shell; catches Dockerfile/YAML/Markdown too). -
A CI workflow — since there is no
.github/workflows/yet, a smalllintworkflow runningshfmt -d(and, complementarily,shellcheckfor correctness) on push/PR would enforce this automatically.shellcheckalone is not enough for this: it is a correctness/portability linter and does not check indentation style. -
pre-commit— optional local enforcement via a git hook (there are ready-madeshfmt/editorconfig-checker/shellcheckhooks) so violations are caught before they are even pushed.
A reasonable minimum is .editorconfig + shfmt -d in CI: the first declares intent to editors, the second mechanically enforces it. editorconfig-checker and pre-commit are nice-to-haves on top.
I'm happy to open a PR for whichever combination you prefer (e.g. reformat build.sh to spaces + add .editorconfig + a shfmt CI check).
Activity