2024-10-03 11:45:56 +02:00
|
|
|
#!/bin/bash
|
2024-10-02 10:18:52 +02:00
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
FAILURES=""
|
|
|
|
|
2024-10-03 11:45:56 +02:00
|
|
|
while IFS= read -r -d '' CARGOTOML
|
2024-10-02 10:18:52 +02:00
|
|
|
do
|
|
|
|
if cargo fmt --quiet --check --manifest-path "${CARGOTOML}"; then
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
FAILURES="${FAILURES} ${CARGOTOML%Cargo.toml}"
|
|
|
|
fi
|
2024-10-03 11:45:56 +02:00
|
|
|
done < <(find . -name Cargo.toml -print0)
|
2024-10-02 10:18:52 +02:00
|
|
|
|
|
|
|
if [ x"" != x"${FAILURES}" ]; then
|
|
|
|
echo "Some Rust files are following rustfmt, in particular in:"
|
|
|
|
echo "${FAILURES}"
|
|
|
|
echo "You can format the code locally using:"
|
|
|
|
echo
|
|
|
|
echo "find -name Cargo.toml -exec cargo fmt --manifest-path '{}' ';'"
|
2024-10-03 11:45:56 +02:00
|
|
|
if [ -n "${GITHUB_RUN_ID:-}" ]; then
|
2024-10-02 10:18:52 +02:00
|
|
|
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
|
|
|
|
exit 1
|
|
|
|
fi
|