Skip to content

Commit 0a7e513

Browse files
committed
fix: respecting .editorconfig
Passing -s to shfmt 3.12.0 causes .editorconfig not to be loaded. Refs mvdan/sh#1173 Closes #39
1 parent 15894e6 commit 0a7e513

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.pre-commit-hooks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
description: Shell source code formatter (prebuilt upstream executable)
44
language: python
55
entry: shfmt
6-
args: [-w, -s]
6+
args: [--write]
77
types: [shell]
88
exclude_types: [csh, tcsh, zsh]
99
stages: [pre-commit, pre-merge-commit, pre-push, manual]
@@ -16,7 +16,7 @@
1616
# Note: keep Go version in `go.mod` in sync with shfmt's required Go version
1717
additional_dependencies: [mvdan.cc/sh/v3/cmd/[email protected]]
1818
entry: shfmt
19-
args: [-w, -s]
19+
args: [--write]
2020
types: [shell]
2121
exclude_types: [csh, tcsh, zsh]
2222
stages: [pre-commit, pre-merge-commit, pre-push, manual]
@@ -28,7 +28,7 @@
2828
language: docker_image
2929
# Note: use the top level multiplatform image digest here
3030
entry: --net none mvdan/shfmt:v3.12.0@sha256:307d265ffd25ce832899ae17c93ed5062fc3375c514bba8f52cbf52792735c4d
31-
args: [-w, -s]
31+
args: [--write]
3232
types: [shell]
3333
exclude_types: [csh, tcsh, zsh]
3434
stages: [pre-commit, pre-merge-commit, pre-push, manual]

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Usage in `.pre-commit-config.yaml`:
1919
- id: shfmt-docker # Docker image (requires Docker to run)
2020
```
2121
22-
> #### Note
22+
> #### Notes
23+
>
24+
> From v3.12.0-2 on, the default args passed to `shfmt`
25+
> [no longer contain `-s`](https://github.com/mvdan/sh/issues/1173).
2326
>
2427
> From v3.7.0-2 on, the `shfmt` id points to the variant that uses a prebuilt
2528
> upstream executable. The one that builds from source is available as

0 commit comments

Comments
 (0)