Skip to content

Commit

Permalink
static_tests/rust: Address shellcheck lints
Browse files Browse the repository at this point in the history
The pure POSIX way to do `for x in $(find ...)` right involves a
tempfile, thus limiting to bash.
  • Loading branch information
chrysn committed Oct 3, 2024
1 parent 69a89b8 commit a7679ae
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions dist/tools/cargo-checks/check.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/bin/sh
#!/bin/bash

set -eu

FAILURES=""

# This is a Make based environment, therefore we don't have funny names to take
# care of, and anyone who can cause commands to be run by injecting files can
# just as well modify the scripts being run. (Otherwise we'd need to go through
# a less readable print0 / read).
for CARGOTOML in `find -name Cargo.toml`
find . -name Cargo.toml -print0 | while IFS= read -r -d '' CARGOTOML
do
if cargo fmt --quiet --check --manifest-path "${CARGOTOML}"; then
continue
Expand All @@ -23,7 +19,7 @@ if [ x"" != x"${FAILURES}" ]; then
echo "You can format the code locally using:"
echo
echo "find -name Cargo.toml -exec cargo fmt --manifest-path '{}' ';'"
if [ ! -z "${GITHUB_RUN_ID:-}" ]; then
if [ -n "${GITHUB_RUN_ID:-}" ]; then
echo
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."
fi
Expand Down

0 comments on commit a7679ae

Please sign in to comment.