-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquality-report.sh
More file actions
executable file
·88 lines (80 loc) · 2.92 KB
/
Copy pathquality-report.sh
File metadata and controls
executable file
·88 lines (80 loc) · 2.92 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Generate code quality summary report
echo "========================================"
echo "JNexus Code Quality Report"
echo "========================================"
echo ""
# Run quality checks
echo "Running code quality analysis..."
mvn checkstyle:checkstyle pmd:pmd pmd:cpd spotbugs:spotbugs -q
echo ""
echo "========================================"
echo "CHECKSTYLE SUMMARY"
echo "========================================"
if [ -f target/checkstyle-result.xml ]; then
violations=$(grep -c '<error' target/checkstyle-result.xml 2>/dev/null || echo "0")
echo "Total violations: $violations"
echo ""
echo "Top violations by type:"
grep '<error' target/checkstyle-result.xml | sed 's/.*source="\([^"]*\)".*/\1/' | sort | uniq -c | sort -rn | head -10
else
echo "No checkstyle report found"
fi
echo ""
echo "========================================"
echo "PMD SUMMARY"
echo "========================================"
if [ -f target/pmd.xml ]; then
violations=$(grep -c '<violation' target/pmd.xml 2>/dev/null || echo "0")
echo "Total violations: $violations"
echo ""
echo "Top violations by rule:"
grep 'rule=' target/pmd.xml | sed 's/.*rule="\([^"]*\)".*/\1/' | sort | uniq -c | sort -rn | head -10
else
echo "No PMD report found"
fi
echo ""
echo "========================================"
echo "CPD (Copy-Paste Detection) SUMMARY"
echo "========================================"
if [ -f target/cpd.xml ]; then
duplications=$(grep -c '<duplication' target/cpd.xml 2>/dev/null || echo "0")
echo "Duplicated code blocks: $duplications"
if [ "$duplications" -gt 0 ]; then
echo ""
grep '<duplication' target/cpd.xml | head -5
fi
else
echo "No CPD report found"
fi
echo ""
echo "========================================"
echo "SPOTBUGS SUMMARY"
echo "========================================"
if [ -f target/spotbugsXml.xml ]; then
bugs=$(grep -c '<BugInstance' target/spotbugsXml.xml 2>/dev/null || echo "0")
echo "Total bugs found: $bugs"
if [ "$bugs" -gt 0 ]; then
echo ""
echo "Bugs by category:"
grep 'category=' target/spotbugsXml.xml | sed 's/.*category="\([^"]*\)".*/\1/' | sort | uniq -c | sort -rn
fi
else
echo "No SpotBugs report found"
fi
echo ""
echo "========================================"
echo "REFACTORING TARGETS"
echo "========================================"
echo "Classes with highest complexity (from Checkstyle):"
grep 'CyclomaticComplexity\|NPathComplexity\|JavaNCSS' target/checkstyle-result.xml 2>/dev/null | \
sed 's/.*source="\([^"]*\)".*/\1/' | sort | uniq -c | sort -rn | head -10 || echo "No data"
echo ""
echo "========================================"
echo "Full reports available at:"
echo " - target/checkstyle-result.xml"
echo " - target/pmd.xml"
echo " - target/cpd.xml"
echo " - target/spotbugsXml.xml"
echo " - target/site/ (HTML reports)"
echo "========================================"