-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20887 from chrysn-pull-requests/fmt
static_tests: Add test for Rust code formatting rules
- Loading branch information
Showing
8 changed files
with
135 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
FAILURES="" | ||
|
||
while IFS= read -r -d '' CARGOTOML | ||
do | ||
if cargo fmt --quiet --check --manifest-path "${CARGOTOML}"; then | ||
continue | ||
else | ||
FAILURES="${FAILURES} ${CARGOTOML%Cargo.toml}" | ||
fi | ||
done < <(find . -name Cargo.toml -print0) | ||
|
||
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 '{}' ';'" | ||
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 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters