Skip to content

Commit 138a8ed

Browse files
authored
chore: deduplicate shellcheck lint command (pyinfra-dev#1891)
1 parent ea22e5c commit 138a8ed

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

.github/workflows/shellcheck.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ jobs:
2121
- name: Install shellcheck
2222
run: sudo apt-get update && sudo apt-get install -y shellcheck
2323
- name: Run shellcheck
24-
run: |
25-
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' -- ':!*.py' \
26-
| xargs shellcheck
24+
run: scripts/dev-shellcheck.sh

scripts/dev-lint.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ echo "Execute arguments type check..."
1313
uv run python scripts/lint_arguments_sync.py
1414

1515
echo "Execute shellcheck..."
16-
if ! command -v shellcheck >/dev/null 2>&1; then
17-
echo "shellcheck is not installed, see docs/contributing.md for instructions." >&2
18-
exit 1
19-
fi
20-
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' -- ':!*.py' \
21-
| xargs shellcheck
16+
scripts/dev-shellcheck.sh
2217

2318
echo "Linting complete!"

scripts/dev-shellcheck.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if ! command -v shellcheck >/dev/null 2>&1; then
6+
echo "shellcheck is not installed, see docs/contributing.md for instructions." >&2
7+
exit 1
8+
fi
9+
10+
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' -- ':!*.py' \
11+
| xargs shellcheck

0 commit comments

Comments
 (0)