Repository navigation
style(scripts): format shell scripts and fix shellcheck findings - #452
Conversation
Reformat every shell script with shfmt 3.14.1 under the central .editorconfig (4-space indent for *.sh) and apply shellcheck 0.11.0's autofixes for SC2250/SC2248 under the central .shellcheckrc. The five SC2312 notes are resolved without changing failure behaviour: command substitutions whose failure was already masked are split out with `|| true`, and the two `docker exec ... | grep -q` probes, where `timeout` is expected to stop index-now, get a justified directive. Ships the central .editorconfig and .shellcheckrc (identical to the config-sync PR #450) so this PR's lint run enforces the result. Closes #451
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the shell-script formatting and lint-configuration updates.
No open issues 🎉
What changed in this PR
Aligns hadiscover’s development and CI shell scripts with the central lint configuration from #450, addressing #451 while preserving existing failure-handling behavior.
Changes:
- Reformats all 21 shell scripts to four-space indentation and standardizes variable braces and quoting.
- Resolves masked-return warnings through explicit failure handling or documented ShellCheck suppressions.
- Adds the central ShellCheck configuration and updates EditorConfig to enforce consistent formatting.
| File | Description |
|---|---|
stop.sh |
Standardizes indentation and variable braces. |
start.sh |
Formats conditionals and braces PID references. |
setup.sh |
Formats setup steps and separates Python version capture. |
backend/entrypoint.sh |
Reformats startup branches. |
.shellcheckrc |
Enables style-level reporting and optional checks. |
.github/scripts/wait-for-healthy.sh |
Quotes the counter and preserves waiting after inspect failures. |
.github/scripts/validate-version.sh |
Formats validation and braces variable references. |
.github/scripts/test-integration.sh |
Formats checks and documents the timeout-pipeline suppression. |
.github/scripts/test-index-now.sh |
Formats checks and documents the timeout-pipeline suppression. |
.github/scripts/test-frontend.sh |
Standardizes formatting and response-variable references. |
.github/scripts/test-backend-api.sh |
Standardizes formatting and response-variable references. |
.github/scripts/start-integration-containers.sh |
Formats argument validation and container startup. |
.github/scripts/start-container.sh |
Standardizes indentation and variable braces. |
.github/scripts/start-backend-container.sh |
Formats validation and Docker arguments. |
.github/scripts/publish-db-release.sh |
Reformats release checks and publishing commands. |
.github/scripts/extract-version.sh |
Formats version-selection branches and variable references. |
.github/scripts/download-search-index.sh |
Extracts timestamp capture while preserving failure tolerance. |
.github/scripts/create-github-release.sh |
Reformats release commands and argument arrays. |
.github/scripts/cleanup-containers.sh |
Reformats validation and cleanup loop. |
.github/scripts/check-if-prerelease.sh |
Formats prerelease detection and variable references. |
.editorconfig |
Sets global formatting defaults and four-space shell indentation. |
.devcontainer/post-start.sh |
Reformats frontend startup-status branches. |
.devcontainer/post-create.sh |
Formats environment setup and braces the Codespace variable. |
Review effort: Balanced
The config-sync PR #450 brings in the central
.shellcheckrc(all optional checks, style severity) and an.editorconfigwith[*.sh] indent_size = 4. Under them,lint / shellcheckandlint / shfmtfail on the scripts already onmain. This PR makes the scripts pass, with no change in behaviour.What changed:
*.shfiles reformatted from tabs to 4 spaces under the new.editorconfig. Whitespace only.$VARto${VAR}) in 15 scripts and one SC2248 ([ $elapsed -lt ...to[ "${elapsed}" -lt ...) inwait-for-healthy.sh.wait-for-healthy.sh: thedocker inspectstatus moves intohealth_status=... || true, so a missing container still means "keep waiting".setup.sh:python3 --versionis captured with|| true, thencutreads it from a here-string.download-search-index.sh: the timestamp moves intogenerated_at=... || trueahead of the heredoc.test-index-now.sh,test-integration.sh:timeoutis expected to stopindex-nowwith a non-zero exit and onlygrep's result matters, so these two get a# shellcheck disable=SC2312with that reason..editorconfigand.shellcheckrc: byte-identical to chore: sync config files from central repo #450, so this PR's own lint run enforces the result. chore: sync config files from central repo #450 then no longer changes them.Checked locally on downloaded copies (no clone): shellcheck 0.11.0 and
shfmt -d3.14.1 report nothing,bash -npasses for every script, and a diff that ignores indentation and${}braces shows only the SC2312 edits above. File modes (755) are unchanged.Closes #451
Summary by CodeRabbit