This repository was archived by the owner on Jul 8, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_analysis.sh
More file actions
49 lines (42 loc) · 1.32 KB
/
Copy pathstatic_analysis.sh
File metadata and controls
49 lines (42 loc) · 1.32 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
#!/bin/bash
# Static analysis script for PolyCall project
# Requires: cppcheck, clang-tidy (optional)
set -e
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
SRC_DIR="$PROJECT_DIR/src"
INCLUDE_DIR="$PROJECT_DIR/include"
echo "=== PolyCall Static Analysis ==="
echo ""
# Run cppcheck if available
if command -v cppcheck &> /dev/null; then
echo "[1/2] Running cppcheck..."
cppcheck \
--enable=all \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
--error-exitcode=1 \
-I "$INCLUDE_DIR" \
"$SRC_DIR" \
&& echo "✓ cppcheck passed" || echo "✗ cppcheck found issues"
else
echo "[1/2] cppcheck not found. Install with: apt-get install cppcheck"
fi
echo ""
# Run clang-tidy if available
if command -v clang-tidy &> /dev/null; then
echo "[2/2] Running clang-tidy..."
find "$SRC_DIR" -name "*.c" | while read file; do
echo " Checking $file..."
clang-tidy \
-checks=readability-*,bugprone-*,clang-analyzer-* \
-header-filter=.* \
-p "$PROJECT_DIR" \
"$file" \
-- -I "$INCLUDE_DIR" 2>/dev/null || true
done
echo "✓ clang-tidy analysis complete"
else
echo "[2/2] clang-tidy not found. Install with: apt-get install clang-tools"
fi
echo ""
echo "=== Analysis Complete ==="