shellcheck: move common directives to .shellcheckrc

This simplifies our CI command line and makes it easier to document
expected usage (in HACKING.md).

There unfortunately isn't a way to set --checked-sourced or our default
warning level in .shellcheckrc, and our `find` command is still a bit
unwieldy, but this is still a net improvement.
This commit is contained in:
Jon Parise
2026-01-16 09:28:19 -05:00
parent af2d33895d
commit bf1ca59196
3 changed files with 30 additions and 2 deletions

View File

@@ -164,6 +164,28 @@ alejandra .
Make sure your Alejandra version matches the version of Alejandra in [devShell.nix](https://github.com/ghostty-org/ghostty/blob/main/nix/devShell.nix).
### ShellCheck
Bash scripts are checked with [ShellCheck](https://www.shellcheck.net/) in CI.
Nix users can use the following command to run ShellCheck over all of our scripts:
```
nix develop -c shellcheck \
--check-sourced \
--severity=warning \
$(find . \( -name "*.sh" -o -name "*.bash" \) -type f ! -path "./zig-out/*" ! -path "./macos/build/*" ! -path "./.git/*" | sort)
```
Non-Nix users can [install ShellCheck](https://github.com/koalaman/shellcheck#user-content-installing) and then run:
```
shellcheck \
--check-sourced \
--severity=warning \
$(find . \( -name "*.sh" -o -name "*.bash" \) -type f ! -path "./zig-out/*" ! -path "./macos/build/*" ! -path "./.git/*" | sort)
```
### Updating the Zig Cache Fixed-Output Derivation Hash
The Nix package depends on a [fixed-output