Skip to content

Commit c52d505

Browse files
committed
Platforms must use raw string
1 parent fa3eb4f commit c52d505

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

taskfiles/lint-sh.yaml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,37 @@ tasks:
1414
deps:
1515
- "venv"
1616
cmds:
17-
- task: "shellcheck"
18-
platforms:
19-
- "linux"
17+
- task: "linux-shellcheck"
18+
vars:
19+
FLAGS: "--enable=all --severity=style --external-sources --norc"
20+
SRC_PATHS:
21+
ref: ".G_LINT_SH_DIRS"
22+
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
23+
- task: "macos-shellcheck"
2024
vars:
2125
FLAGS: "--enable=all --severity=style --external-sources --norc"
2226
SRC_PATHS:
2327
ref: ".G_LINT_SH_DIRS"
24-
OS: "linux"
2528
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
2629

27-
shellcheck:
30+
linux-shellcheck:
2831
internal: true
2932
requires:
30-
vars: ["FLAGS", "SRC_PATHS", "OS", "VENV_DIR"]
31-
deps:
32-
- "venv"
33+
vars: ["FLAGS", "SRC_PATHS", "VENV_DIR"]
34+
platforms: ["linux"]
35+
cmd: |-
36+
find {{- range .SRC_PATHS}} "{{.}}" {{- end}} \
37+
-path '**/macos' -prune -o -type f -iname "*.sh" \
38+
-print0 | \
39+
xargs -0 shellcheck {{.FLAGS}}
40+
41+
macos-shellcheck:
42+
internal: true
43+
requires:
44+
vars: ["FLAGS", "SRC_PATHS", "VENV_DIR"]
45+
platforms: ["darwin"]
3346
cmd: |-
34-
. "{{.VENV_DIR}}/bin/activate"
35-
{ \
36-
# All shell scripts excluding the OS-specific ones
37-
find {{- range .SRC_PATHS}} "{{.}}" {{- end}} \
38-
\( -path '**/linux' -o -path '**/macos' \) -prune -o \
39-
-type f -iname "*.sh" -print0; \
40-
# All shell scripts exclusive to the specified OS
41-
find {{- range .SRC_PATHS}} "{{.}}" {{- end}} \
42-
-type d -name "{{.OS}}" \
43-
-exec find {} -type f -iname "*.sh" -print0 \; ; \
44-
} | \
45-
xargs -0 echo #shellcheck {{.FLAGS}}
47+
find {{- range .SRC_PATHS}} "{{.}}" {{- end}} \
48+
-path '**/linux' -prune -o -type f -iname "*.sh" \
49+
-print0 | \
50+
xargs -0 shellcheck {{.FLAGS}}

0 commit comments

Comments
 (0)