Skip to content

Commit 2d88bf9

Browse files
aRustyDevclaude
andcommitted
fix: Fix shell script syntax errors and commands
- Fix spacing after '\!' in conditionals (if \! [ -f) - Quote all variable references to prevent word splitting - Fix command existence checks using proper syntax - Correct wrong commands (jshint.sh was running fixmyjs, gitlint.sh was running commitlint) - Update TruffleHog configuration for push events - Add shellcheck directives for nix-shell scripts - Fix here-doc redirection in commitizen.sh All ShellCheck errors are now resolved. CI/CD workflows should pass. Fixes #26 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 14b1aa8 commit 2d88bf9

15 files changed

Lines changed: 45 additions & 43 deletions

File tree

.github/workflows/security.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
uses: trufflesecurity/trufflehog@main
5252
with:
5353
path: ./
54-
base: ${{ github.event.repository.default_branch }}
55-
head: HEAD
54+
base: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
55+
head: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.event.after }}
5656
extra_args: --debug --only-verified
5757

5858
- name: Gitleaks

hooks/ci/github.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# TODO: check for action lint
44
# TODO: setup GOPATH locally
5-
if ![ -f "package.json" ]; then
5+
if ! [ -f "package.json" ]; then
66
go install github.com/rhysd/actionlint/cmd/actionlint@latest
77
fi
88

hooks/ci/gitlint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
22

33
# Package.json needs to be here or npm needs to run install
4-
if ![ -f "package.json" ]; then
4+
if ! [ -f "package.json" ]; then
55
pip install gitlint
66
fi
77

8-
# Run eslint
9-
commitlint --edit $1
8+
# Run gitlint
9+
gitlint --staged --msg-filename "$1"

hooks/commits/commitizen.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# TODO: Pull version from tags
44
# TODO: Handle commitizen-branch hook
55
# Package.json needs to be here or npm needs to run install
6-
if ![ -f ".cz.toml" || -f "cz.toml" ]; then
6+
if ! [ -f ".cz.toml" ] && ! [ -f "cz.toml" ]; then
77
pip install -U commitizen
8-
cat .cz.toml << EOF
8+
cat > .cz.toml << EOF
99
[tool.commitizen]
1010
version = "0.1.0"
1111
update_changelog_on_bump = true
1212
EOF
1313
cz init
1414
fi
1515

16-
# Run eslint
17-
cz check $1
16+
# Run commitizen
17+
cz check "$1"

hooks/commits/commitlint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22

33
# Package.json needs to be here or npm needs to run install
4-
if ![ -f "package.json" ]; then
4+
if ! [ -f "package.json" ]; then
55
npm install --save-dev @commitlint/{cli,config-conventional}
66
# echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
77
fi
88

9-
# Run eslint
10-
commitlint --edit $1
9+
# Run commitlint
10+
commitlint --edit "$1"

hooks/commits/gitlint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
22

33
# Package.json needs to be here or npm needs to run install
4-
if ![ -f "package.json" ]; then
4+
if ! [ -f "package.json" ]; then
55
pip install gitlint
66
fi
77

8-
# Run eslint
9-
commitlint --edit $1
8+
# Run gitlint
9+
gitlint --staged --msg-filename "$1"

hooks/configs/yamlfmt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ ORIG_GOPATH=$GOPATH
55
export GOPATH=$PWD
66

77
# Install the binary
8-
if ![ command -v yamlfmt ] 2> /dev/null; then
8+
if ! command -v yamlfmt > /dev/null 2>&1; then
99
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
1010
fi
1111

1212
# Run yamlfmt
13-
yamlfmt $1
13+
yamlfmt "$1"
1414

1515
# Cleanup
1616
export GOPATH=$ORIG_GOPATH

hooks/nix/nix-build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env nix-shell
22
#!nix-shell default.nix -A expEnv -i bash
3+
# shellcheck shell=bash
34

45
nix-build "$@"

hooks/nix/publish-to-nixpkgs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env nix-shell
22
#!nix-shell default.nix -A expEnv -i bash
3+
# shellcheck shell=bash
34

45
# TODO: pull the commit-msg from upstream
56
# TODO: commitlint the commit-msg

hooks/web/css/csslint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ -f ".csslintrc" ]; then
66
fi
77

88
npm install -g csslint
9-
csslint $1
9+
csslint "$1"

0 commit comments

Comments
 (0)