/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / devel / check_format.sh
36 lines · 1.2 KBCodeBlameHistory
3# Get the directory where the script is located
4SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
7# Check Python code formatting
8echo "Checking Python code formatting..."
9if ! black --check "$PROJECT_ROOT/benchcompress/src/benchcompress"; then
10 echo "Python code is not properly formatted!"
11 echo "Please run './devel/format_code.sh' to format the code"
12 exit 1
13fi
15# Check TypeScript/JavaScript code formatting
16echo "Checking TypeScript/JavaScript code formatting..."
17cd "$PROJECT_ROOT/web-ui"
18if ! npm run format:check; then
19 echo "TypeScript/JavaScript code is not properly formatted!"
20 echo "Please run './devel/format_code.sh' to format the code"
21 exit 1
22fi
24# Check C++ code formatting
25echo "Checking C++ code formatting..."
26cpp_files=$(find "$PROJECT_ROOT" -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \))
27for file in $cpp_files; do
28 if ! clang-format --dry-run -Werror "$file" > /dev/null 2>&1; then
29 echo "C++ code is not properly formatted!"
30 echo "Please run './devel/format_code.sh' to format the code"
31 exit 1
32 fi
33done
35echo "All code is properly formatted!"
36exit 0
moveopenescclose