Conversation
32ee1f8 to
6093c08
Compare
There was a problem hiding this comment.
Pull request overview
Adds ShellCheck into the repo’s local tooling (Nix devShell + pre-commit) and fixes ShellCheck-triggered quoting issues in several shell scripts, with a repo-wide .shellcheckrc to suppress selected rules.
Changes:
- Add a local
shellcheckpre-commit hook and a root.shellcheckrcconfiguration. - Add
pkgs.shellcheckto the Nixweb-sessiontoolchain. - Fix unquoted variable expansions / command substitutions in multiple
.shscripts.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| nix/home/shell/bash-init.sh | Quotes command substitutions for LESS_TERMCAP_* env vars used by the custom man() wrapper. |
| flake.nix | Adds pkgs.shellcheck to the web-session tool bundle so pre-commit can run it via Nix. |
| cluster/k8s/agents/devbot/docker/desktop/entrypoint.sh | Quotes $RESOLUTION when passed to vncserver -geometry. |
| cluster/k8s/agents/devbot/docker/build.sh | Quotes Docker tag variables in docker build/docker push. |
| .shellcheckrc | Introduces centralized ShellCheck rule suppressions for the repo. |
| .pre-commit-config.yaml | Adds a local shellcheck hook (system-provided, via Nix devShell/web-session). |
| .github/scripts/run-ansible-lint.sh | Documents intentional word-splitting and suppresses SC2086 for the lint invocation. |
.shellcheckrc
Outdated
| # SC2148: Tips depend on target shell (missing shebang). | ||
| # Many .sh files are sourced snippets (profile.d, shell init). | ||
| disable=SC2148 |
There was a problem hiding this comment.
Disabling SC2148 globally can cause ShellCheck to fall back to its default shell for files without a shebang, which can mis-lint (or fail on) bash-specific sourced snippets. Since the repo has sourced bash scripts without shebangs (e.g. nix/home/shell/bash-init.sh uses local), consider either adding # shellcheck shell=bash (or a shebang) to those snippets, or setting an explicit default shell in this config, instead of suppressing SC2148 everywhere.
| # SC2148: Tips depend on target shell (missing shebang). | |
| # Many .sh files are sourced snippets (profile.d, shell init). | |
| disable=SC2148 | |
| # Default shell: many sourced snippets are bash (no shebang). | |
| # This avoids mis-linting bash-specific code as /bin/sh. | |
| shell=bash |
a1eb10f to
75a6c94
Compare
856db3b to
d2aba90
Compare
Add shellcheck pre-commit hook and .shellcheckrc config. Add shellcheck to devShell (flake.nix). Default shell set to bash for sourced snippets. Exclude .envrc and .zsh files from checking. run-ansible-lint.sh: add SC2086 inline disable for intentional word splitting. Low-value rules (style suggestions in debug/one-off scripts) disabled in .shellcheckrc with TODO to tighten incrementally. https://claude.ai/code/session_01TVjKdv6UebLZt9FP7ZuAbt
d2aba90 to
73f0629
Compare
Summary
.shellcheckrcconfigbuild.sh,entrypoint.sh,bash-init.sh,run-ansible-lint.shpkgs.shellcheckto devShell inflake.nixTest plan
shellcheckpasses on all tracked.shfilespre-commit run shellcheck --all-filespasseshttps://claude.ai/code/session_01TVjKdv6UebLZt9FP7ZuAbt