From 1568789860258f9fbb41160c77e17ea6d5b711f8 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 17 Nov 2024 04:02:02 -0500 Subject: [PATCH] Add a check that semver files don't contain duplicate entries Also make shellcheck failures actually cause an exit, `find ... -exec` apparently does not propagate errors. --- ci/style.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/style.sh b/ci/style.sh index 131632ff21dd4..0684caafaad7d 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -11,7 +11,7 @@ rustfmt -V cargo fmt --all -- --check if shellcheck --version ; then - find . -name '*.sh' -exec shellcheck {} ';' + find . -name '*.sh' -print0 | xargs -0 shellcheck else echo "shellcheck not found" exit 1 @@ -29,4 +29,12 @@ for file in libc-test/semver/*.txt; do echo "Unsorted semver file $file" exit 1 fi + + duplicates=$(uniq -d "$file") + if [ -n "$duplicates" ]; then + echo "Semver file $file contains duplicates:" + echo "$duplicates" + + exit 1 + fi done