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
#!/bin/sh
# Quick code quality scan using ctags
# Detects: duplicate functions, unused static functions, code metrics
echo "=== Signet Code Quality Scan ===\n"
# 1. Duplicate functions
echo "1. Checking for duplicate function definitions..."
DUPS=$(ctags --format=2 --fields=kKn --c-kinds=f -o - \
$(find src pim -name "*.c" 2>/dev/null) 2>/dev/null | \
awk -F'\t' '{print $1}' | sort | uniq -d | wc -l)
if [ "$DUPS" -eq 0 ]; then
echo " ✓ No duplicate function definitions found\n"
else
echo " ✗ Found $DUPS duplicate functions (use find-duplicate-functions.sh)\n"
fi
# 2. Function count by file
echo "2. Function count by file:"
ctags --format=2 --fields=kKn --c-kinds=f -o - \
$(find src pim -name "*.c" 2>/dev/null) 2>/dev/null | \
awk -F'\t' '{print $2}' | sort | uniq -c | sort -rn | \
awk '{printf " %s: %d functions\n", $2, $1}' | head -10
echo ""
# 3. Lines of code
echo "3. Code metrics:"
wc -l $(find src pim -name "*.c" -o -name "*.h" 2>/dev/null) | tail -1 | \
awk '{printf " Total lines: %d\n", $1}'
FUNCS=$(ctags --format=2 --fields=kKn --c-kinds=f -o - \
$(find src pim -name "*.c" 2>/dev/null) 2>/dev/null | wc -l)
echo " Total functions: $FUNCS"
echo ""
echo "For detailed analysis, run:"
echo " ./.claude/scripts/find-duplicate-functions.sh"