Skip to content

Commit f4aaf60

Browse files
nsheapsclaude
andauthored
ci: add ShellCheck, shfmt, and editorconfig-checker CI workflow (#11)
Add P1 consistency items matching org standard: - .shellcheckrc with SC1091 and SC2034 disabled - .editorconfig with shell script settings for shfmt - .github/workflows/check.yaml (ShellCheck + shfmt + editorconfig-checker) - Updated mise.toml with fmt, fmt-check, and improved lint/check tasks - Applied shfmt formatting to all bash scripts - Fixed SC2155 warnings (separate local declarations from assignments) - Added inline SC2016/SC2001 disables for intentional patterns Co-authored-by: Claude Code (User Settings, in: ${CLAUDE_PROJECT_DIR}) <noreply@anthropic.com>
1 parent bd2a960 commit f4aaf60

6 files changed

Lines changed: 247 additions & 118 deletions

File tree

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.json]
13+
insert_final_newline = ignore
14+
15+
[Makefile]
16+
indent_style = tab
17+
18+
# Shell scripts — shfmt reads these properties
19+
[*.sh]
20+
switch_case_indent = true
21+
22+
[*.md]
23+
trim_trailing_whitespace = false

.github/workflows/check.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: check
2+
3+
on:
4+
push:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }}
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
9+
10+
jobs:
11+
check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Find bash scripts
18+
id: find-bash
19+
run: |
20+
bash_files=""
21+
# .sh files with bash shebangs
22+
for f in $(find . -name '*.sh' -not -path './.git/*' -not -path './node_modules/*'); do
23+
shebang=$(head -1 "$f")
24+
if echo "$shebang" | grep -qE '(bash|^#!/bin/sh)'; then
25+
bash_files="$bash_files $f"
26+
fi
27+
done
28+
# bin/ scripts without .sh extension
29+
for f in $(find ./bin -maxdepth 1 -type f -not -name '*.sh' -not -path './.git/*'); do
30+
shebang=$(head -1 "$f")
31+
if echo "$shebang" | grep -qE '(bash|^#!/bin/sh)'; then
32+
bash_files="$bash_files $f"
33+
fi
34+
done
35+
echo "files=$bash_files" >> "$GITHUB_OUTPUT"
36+
echo "Found bash files:$bash_files"
37+
38+
- name: ShellCheck
39+
if: steps.find-bash.outputs.files != ''
40+
run: |
41+
bash_files="${{ steps.find-bash.outputs.files }}"
42+
echo "Running ShellCheck on:$bash_files"
43+
shellcheck $bash_files
44+
45+
- name: shfmt check
46+
if: steps.find-bash.outputs.files != ''
47+
run: |
48+
bash_files="${{ steps.find-bash.outputs.files }}"
49+
echo "Running shfmt on:$bash_files"
50+
# -d shows diff; indent settings sourced from .editorconfig
51+
shfmt -d $bash_files
52+
53+
- name: EditorConfig check
54+
uses: editorconfig-checker/action-editorconfig-checker@main
55+
56+
- name: Run editorconfig-checker
57+
run: editorconfig-checker

.shellcheckrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ShellCheck configuration for nsheaps/git-wt
2+
# https://www.shellcheck.net/wiki/
3+
4+
# Default shell dialect — all scripts in this repo are bash.
5+
shell=bash
6+
7+
# SC1091: Not following sourced files — sourced paths are dynamic
8+
disable=SC1091
9+
10+
# SC2034: Variable appears unused — some variables are used in tests or exported
11+
disable=SC2034

0 commit comments

Comments
 (0)