Skip to content

Commit 03f968b

Browse files
🐛 ignore shell script files within .venv for shellcheck command (#177)
Allowing the `shellcheck` command to run against all shell script files within `.venv` gives the error: ``` xargs: command line cannot be assembled, too long ``` This PR only checks the shell scripts that are git committed. After ignoring: ``` ❯ git ls-files -z | grep -z '\.sh$' | xargs -0 -n 1 printf "%s\n" format.sh tools/actionlint.sh tools/check_repo.sh tools/doc-lint.sh tools/mypy.sh tools/shellcheck.sh ``` Before: ``` ❯ find . -name "*.sh" ./tools/shellcheck.sh ./tools/doc-lint.sh ./tools/check_repo.sh ./tools/actionlint.sh ./tools/mypy.sh ./.venv/lib/python3.12/site-packages/bleach/_vendor/vendor_install.sh ./.venv/lib/python3.12/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_mac.sh ./.venv/lib/python3.12/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/compile_linux.sh ./.venv/lib/python3.12/site-packages/pexpect/bashrc.sh ./.venv/lib/python3.12/site-packages/tqdm/completion.sh ./.venv/lib/python3.12/site-packages/ray/autoscaler/aws/cloudwatch/ray_prometheus_waiter.sh ./format.sh ``` --------- Signed-off-by: Prashant Gupta <[email protected]>
1 parent 2bdf56f commit 03f968b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/shellcheck.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ if ! [ -x "$(command -v shellcheck)" ]; then
1818
export PATH="$PATH:$(pwd)/shellcheck-${scversion}"
1919
fi
2020

21-
# TODO - fix warnings in .buildkite/run-amd-test.sh
22-
find . -name "*.sh" -not -path "./.buildkite/run-amd-test.sh" -print0 | xargs -0 -I {} sh -c 'git check-ignore -q "{}" || shellcheck "{}"'
21+
# Lists all files currently tracked by Git
22+
# outputs results separated by a null character
23+
# matches any filename ending with .sh
24+
# run shellcheck on every .sh file tracked by Git.
25+
git ls-files -z | grep -z '\.sh$' | xargs -0 -n 1 shellcheck

0 commit comments

Comments
 (0)