Skip to content

Commit 7793c82

Browse files
committed
ci: add scripts-only shellcheck gate
Lint only the scripts directory in CI with configurable ShellCheck excludes, and document the local command contributors should run before pushing. Made-with: Cursor
1 parent 36837b7 commit 7793c82

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ concurrency:
1313
env:
1414
CARGO_TERM_COLOR: always
1515
RUST_BACKTRACE: 1
16+
SHELLCHECK_EXCLUDES: ""
1617
REGISTRY: ghcr.io
1718
IMAGE_NAME: ${{ github.repository }}
1819

@@ -238,12 +239,17 @@ jobs:
238239
239240
- name: Run shellcheck
240241
run: |
241-
mapfile -t shell_files < <(find . -type f -name "*.sh")
242+
mapfile -t shell_files < <(find scripts -type f -name "*.sh")
242243
if [ "${#shell_files[@]}" -eq 0 ]; then
243-
echo "No shell scripts found"
244+
echo "No shell scripts found in scripts/"
244245
exit 0
245246
fi
246-
shellcheck -S error "${shell_files[@]}"
247+
shellcheck_cmd=(shellcheck -S error)
248+
if [ -n "${SHELLCHECK_EXCLUDES}" ]; then
249+
shellcheck_cmd+=(-e "${SHELLCHECK_EXCLUDES}")
250+
echo "Running shellcheck with excludes: ${SHELLCHECK_EXCLUDES}"
251+
fi
252+
"${shellcheck_cmd[@]}" "${shell_files[@]}"
247253
248254
- name: Check formatting
249255
run: make fmt-check

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Please do not delete the template sections. PRs with empty descriptions or unche
117117

118118
- **Formatting**: Always run `cargo fmt` before committing.
119119
- **Linting**: We use Clippy. Ensure `cargo clippy --all-targets --all-features -- -D warnings` passes.
120+
- **Shell scripts**: We lint scripts under `scripts/` with ShellCheck. Run `find scripts -type f -name "*.sh" -print0 | xargs -0 shellcheck -S error` locally.
120121
- **Security**: All dependencies must be audited. We resolve all `RUSTSEC` advisories immediately.
121122
- **Error Handling**: Prefer the `Result<T>` type defined in `src/error.rs` using `thiserror`.
122123

0 commit comments

Comments
 (0)