blob: 850661e576c7464fb0f1b7b7f2a5cb06d257c8de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/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
# Will uncomment this once we reformat
#if command -v clang-format; then
# echo -n "checking clang-format... "
# git ls-files '**.c' '**.cxx' '**.h' '**.hpp' | xargs clang-format --Werror --dry-run
# 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
|