Skip to content

Commit d0299de

Browse files
committed
static_tests/rust: Address shellcheck lints
The pure POSIX way to do `for x in $(find ...)` right involves a tempfile, thus limiting to bash.
1 parent 69a89b8 commit d0299de

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

dist/tools/cargo-checks/check.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -eu
44

55
FAILURES=""
66

7-
# This is a Make based environment, therefore we don't have funny names to take
8-
# care of, and anyone who can cause commands to be run by injecting files can
9-
# just as well modify the scripts being run. (Otherwise we'd need to go through
10-
# a less readable print0 / read).
11-
for CARGOTOML in `find -name Cargo.toml`
7+
while IFS= read -r -d '' CARGOTOML
128
do
139
if cargo fmt --quiet --check --manifest-path "${CARGOTOML}"; then
1410
continue
1511
else
1612
FAILURES="${FAILURES} ${CARGOTOML%Cargo.toml}"
1713
fi
18-
done
14+
done < <(find . -name Cargo.toml -print0)
1915

2016
if [ x"" != x"${FAILURES}" ]; then
2117
echo "Some Rust files are following rustfmt, in particular in:"
2218
echo "${FAILURES}"
2319
echo "You can format the code locally using:"
2420
echo
2521
echo "find -name Cargo.toml -exec cargo fmt --manifest-path '{}' ';'"
26-
if [ ! -z "${GITHUB_RUN_ID:-}" ]; then
22+
if [ -n "${GITHUB_RUN_ID:-}" ]; then
2723
echo
2824
echo "The author of this test regrets not knowing how to provide an easy way to just click a button here that provides the right fixup commits."
2925
fi

0 commit comments

Comments
 (0)