forked from nanocurrency/nano-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat-check.sh
More file actions
executable file
·50 lines (42 loc) · 1.18 KB
/
format-check.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.18 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Check code formatting for C++ and CMake files
# Usage: ./format-check.sh
#
# This script checks if your code is properly formatted.
# If it fails, run ./format-do.sh to fix the formatting.
#
# Required tools:
# - clang-format version 17
# - cmake-format version 0.6.13
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
echo "Usage: ./format-check.sh"
echo ""
echo "Check code formatting for C++ and CMake files."
echo "If this fails, run ./format-do.sh to fix the formatting."
echo ""
echo "Required tools:"
echo " - clang-format version 17"
echo " - cmake-format version 0.6.13"
exit 0
fi
FAILED=0
echo "Checking C++ formatting..."
if ! "$SCRIPT_DIR/ci/clang-format-check.sh"; then
echo "FAILED: C++ formatting (clang-format)"
FAILED=1
fi
echo ""
echo "Checking CMake formatting..."
if ! "$SCRIPT_DIR/ci/cmake-format-check.sh"; then
echo "FAILED: CMake formatting (cmake-format)"
FAILED=1
fi
echo ""
if [[ $FAILED -eq 1 ]]; then
echo "Formatting check failed. Run ./format-do.sh to fix."
exit 1
else
echo "All formatting checks passed."
fi