Skip to content

Commit 3557a70

Browse files
authored
fix: pass flag to shfmt to ignore passed files (#146)
Fixes #80
1 parent e9b90bd commit 3557a70

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

format/private/format.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ case "$mode" in
123123
# as command-line arguments; see
124124
# https://github.com/astral-sh/ruff/discussions/5857#discussioncomment-6583943
125125
ruffmode="format --force-exclude"
126-
shfmtmode="-w"
126+
# NB: apply-ignore added in https://github.com/mvdan/sh/issues/1037
127+
shfmtmode="-w --apply-ignore"
127128
javamode="--replace"
128129
ktmode=""
129130
gofmtmode="-w"

format/repositories.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,37 +58,37 @@ def fetch_jsonnet():
5858

5959
# buildifier: disable=function-docstring
6060
def fetch_shfmt():
61-
shfmt_version = "3.7.0"
61+
shfmt_version = "3.8.0"
6262

6363
http_file(
6464
name = "shfmt_darwin_x86_64",
6565
downloaded_file_path = "shfmt",
6666
executable = True,
67-
sha256 = "ae1d1ab961c113fb3dc2ff1150f33c3548983550d91da889b3171a5bcfaab14f",
67+
sha256 = "c0218b47a0301bb006f49fad85d2c08de23df303472834faf5639d04121320f8",
6868
urls = ["https://github.com/mvdan/sh/releases/download/v{0}/shfmt_v{0}_darwin_amd64".format(shfmt_version)],
6969
)
7070

7171
http_file(
7272
name = "shfmt_darwin_aarch64",
7373
downloaded_file_path = "shfmt",
7474
executable = True,
75-
sha256 = "ad7ff6f666adba3d801eb17365a15539f07296718d39fb62cc2fde6b527178aa",
75+
sha256 = "1481240d2a90d4f0b530688d76d4f9117d17a756b6027cfa42b96f0707317f83",
7676
urls = ["https://github.com/mvdan/sh/releases/download/v{0}/shfmt_v{0}_darwin_arm64".format(shfmt_version)],
7777
)
7878

7979
http_file(
8080
name = "shfmt_linux_x86_64",
8181
downloaded_file_path = "shfmt",
8282
executable = True,
83-
sha256 = "0264c424278b18e22453fe523ec01a19805ce3b8ebf18eaf3aadc1edc23f42e3",
83+
sha256 = "27b3c6f9d9592fc5b4856c341d1ff2c88856709b9e76469313642a1d7b558fe0",
8484
urls = ["https://github.com/mvdan/sh/releases/download/v{0}/shfmt_v{0}_linux_amd64".format(shfmt_version)],
8585
)
8686

8787
http_file(
8888
name = "shfmt_linux_aarch64",
8989
downloaded_file_path = "shfmt",
9090
executable = True,
91-
sha256 = "111612560d15bd53d8e8f8f85731176ce12f3b418ec473d39a40ed6bbec772de",
91+
sha256 = "27e1f69b0d57c584bcbf5c882b4c4f78ffcf945d0efef45c1fbfc6692213c7c3",
9292
urls = ["https://github.com/mvdan/sh/releases/download/v{0}/shfmt_v{0}_linux_arm64".format(shfmt_version)],
9393
)
9494

format/test/format_test.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bats_load_library "bats-assert"
126126
assert_success
127127

128128
assert_output --partial "Formatting Shell with shfmt..."
129-
assert_output --partial "+ shfmt -w .github/workflows/release_prep.sh"
129+
assert_output --partial "+ shfmt -w --apply-ignore .github/workflows/release_prep.sh"
130130
}
131131

132132
@test "should run swiftformat on Swift" {

0 commit comments

Comments
 (0)