Skip to content

Commit 81735c2

Browse files
authored
Merge pull request #160 from cisagov/improvement/switch_pre-commit_hook_for_shfmt
Switch the pre-commit hook used to run `shfmt`
2 parents 95a61f5 + 8ecd957 commit 81735c2

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

.github/workflows/build.yml

-5
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ jobs:
126126
PACKAGE_URL: github.com/securego/gosec/v2/cmd/gosec
127127
PACKAGE_VERSION: ${{ steps.setup-env.outputs.gosec-version }}
128128
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
129-
- name: Install shfmt
130-
env:
131-
PACKAGE_URL: mvdan.cc/sh/v3/cmd/shfmt
132-
PACKAGE_VERSION: ${{ steps.setup-env.outputs.shfmt-version }}
133-
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
134129
- name: Install staticcheck
135130
env:
136131
PACKAGE_URL: honnef.co/go/tools/cmd/staticcheck

.pre-commit-config.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,24 @@ repos:
9393
- id: nixpkgs-fmt
9494

9595
# Shell script hooks
96-
- repo: https://github.com/cisagov/pre-commit-shfmt
97-
rev: v0.0.2
96+
- repo: https://github.com/scop/pre-commit-shfmt
97+
rev: v3.7.0-4
9898
hooks:
9999
- id: shfmt
100100
args:
101+
# List files that will be formatted
102+
- --list
103+
# Write result to file instead of stdout
104+
- --write
101105
# Indent by two spaces
102-
- -i
103-
- '2'
106+
- --indent
107+
- "2"
104108
# Binary operators may start a line
105-
- -bn
109+
- --binary-next-line
106110
# Switch cases are indented
107-
- -ci
111+
- --case-indent
108112
# Redirect operators are followed by a space
109-
- -sr
113+
- --space-redirects
110114
- repo: https://github.com/detailyang/pre-commit-shell
111115
rev: 1.0.5
112116
hooks:

0 commit comments

Comments
 (0)