Skip to content

Commit b77df50

Browse files
feat: add shellcheck validation
- Add ShellCheck as npm dependency (v4.1.0) - Create shellcheck_validate.sh script with paths-filter integration - Add .shellcheckrc configuration file with Terraform-specific disables - Integrate ShellCheck step into CI workflow - Use selective validation based on changed files
1 parent e34320c commit b77df50

File tree

5 files changed

+370
-1
lines changed

5 files changed

+370
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ jobs:
2929
- 'scripts/ts_test_auto.sh'
3030
- 'scripts/terraform_test_all.sh'
3131
- 'scripts/terraform_validate.sh'
32+
- 'scripts/shellcheck_validate.sh'
3233
modules:
3334
- 'registry/**/modules/**'
35+
shell:
36+
- '**/*.sh'
3437
all:
3538
- '**'
3639
- name: Set up Terraform
@@ -64,6 +67,12 @@ jobs:
6467
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
6568
MODULE_CHANGED_FILES: ${{ steps.filter.outputs.modules_files }}
6669
run: bun terraform-validate
70+
- name: Run ShellCheck
71+
env:
72+
ALL_CHANGED_FILES: ${{ steps.filter.outputs.all_files }}
73+
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
74+
SHELL_CHANGED_FILES: ${{ steps.filter.outputs.shell_files }}
75+
run: bun shellcheck
6776
validate-style:
6877
name: Check for typos and unformatted code
6978
runs-on: ubuntu-latest

.shellcheckrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ShellCheck configuration for Coder Registry
2+
# https://www.shellcheck.net/wiki/
3+
4+
# Set default shell dialect to bash (most scripts use bash)
5+
shell=bash
6+
7+
# Disable checks that conflict with Terraform templating syntax
8+
# Many scripts use Terraform's templatefile() function with $${VAR} escape syntax
9+
disable=SC2154 # Variable is referenced but not assigned (injected by Terraform)
10+
disable=SC2034 # Variable appears unused (used via $${VAR} syntax)
11+
disable=SC1083 # Literal braces (Terraform's $${VAR} escape syntax)
12+
disable=SC2193 # Comparison arguments never equal (Terraform interpolation)
13+
disable=SC2125 # Brace expansion/globs in assignments (Terraform syntax)
14+
15+
# Disable checks that conflict with common bash idioms
16+
disable=SC2076 # Quoted regex in =~ (intentional for literal string matching with space padding)
17+
18+
# Enable all optional checks for thorough analysis
19+
enable=all
20+

0 commit comments

Comments
 (0)