ci: Add a codestyle.sh

This matches what we do in rpm-ostree.  Move the `glnx_fd_close`
bits out of `make syntax-check` in preparation for dropping that.
This commit is contained in:
Colin Walters committed 2022-05-31 11:42:42 -04:00
1 parent aea20704b5
commit 199ef821c8
4 files changed
+32 -4

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Tests that validate structure of the source code;
# can be run without building it.
set -euo pipefail
# Don't hard require Rust
if command -v cargo >/dev/null; then
echo -n "checking rustfmt... "
for crate in $(find -iname Cargo.toml); do
if ! cargo fmt --manifest-path ${crate} -- --check; then
echo "cargo fmt failed; run: cd $(dirname ${crate}) && cargo fmt" 1>&2
exit 1
fi
done
echo "ok"
fi
echo -n 'grep-based static analysis... '
patterns=(glnx_fd_close)
for pat in "${patterns[@]}"; do
if git grep "${pat}" | grep -v codestyle\.sh; then
echo "Files matched prohibited pattern: ${pat}" 1>&2
exit 1
fi
done
echo ok
+3
View File
@@ -26,6 +26,9 @@
set -euo pipefail
set -x
# First, basic static analysis
./ci/codestyle.sh
NOCONFIGURE=1 ./autogen.sh
srcdir="$(pwd)"