11#! /bin/bash
2- # Automated code review script
3- # Python: mypy, flake8, bandit, security scans, TODO checks
4- # Java: security scans, TODO checks only
2+ # Automated code review script for Java projects
3+ # Java: security scans, TODO checks
4+ # Shell scripts: security scans, TODO checks
5+ # Python: skipped (only automation scripts present)
56
67set -euo pipefail
78
@@ -20,46 +21,14 @@ cd "$PROJECT_ROOT"
2021# Clean previous review outputs
2122rm -f " $REVIEW_OUTPUT_DIR " /* .txt
2223
23- # Count Python and Java files
24- PYTHON_COUNT=$( find . -name " *.py" -type f | wc -l)
24+ # Count Java files (exclude Python - only automation scripts)
2525JAVA_COUNT=$( find . -name " *.java" -type f | wc -l)
2626
27- echo " Found $PYTHON_COUNT Python files, $ JAVA_COUNT Java files"
27+ echo " Found $JAVA_COUNT Java files"
2828echo " "
2929
30- # Python checks (if Python files exist)
31- if [ $PYTHON_COUNT -gt 0 ]; then
32- echo " === Python Code Checks ==="
33-
34- # 1. MyPy (type checking)
35- echo " [1/3] Running mypy..."
36- if find . -name " *.py" -type f -print0 | xargs -0 mypy --ignore-missing-imports --no-error-summary 2>&1 | tee " $REVIEW_OUTPUT_DIR /mypy.txt" ; then
37- echo " ✓ MyPy: PASSED"
38- else
39- echo " ✗ MyPy: FOUND ISSUES"
40- fi
41-
42- # 2. Flake8 (style and quality)
43- echo " [2/3] Running flake8..."
44- if find . -name " *.py" -type f -print0 | xargs -0 flake8 --extend-ignore=E501 2>&1 | tee " $REVIEW_OUTPUT_DIR /flake8.txt" ; then
45- echo " ✓ Flake8: PASSED"
46- else
47- echo " ✗ Flake8: FOUND ISSUES"
48- fi
49-
50- # 3. Bandit (security)
51- echo " [3/3] Running bandit..."
52- # Skip B404,B602,B603,B607 for .claude/scripts/* (automation scripts using subprocess)
53- if find . -name " *.py" -type f -print0 | xargs -0 bandit -q --skip B404,B602,B603,B607 --exclude ./.claude/scripts 2>&1 | tee " $REVIEW_OUTPUT_DIR /bandit.txt" ; then
54- echo " ✓ Bandit: PASSED"
55- else
56- echo " ✗ Bandit: FOUND SECURITY ISSUES"
57- fi
58- echo " "
59- else
60- echo " No Python files found, skipping Python checks"
61- echo " "
62- fi
30+ # Skip Python checks - this is a Java project
31+ # (Python files are only automation scripts in .claude/scripts/)
6332
6433# Java checks (security scans and TODO checks only)
6534if [ $JAVA_COUNT -gt 0 ]; then
8958 echo " "
9059fi
9160
92- # Security scans for Python (if exists)
93- if [ $PYTHON_COUNT -gt 0 ]; then
94- echo " === Python Security Pattern Scan ==="
95- {
96- echo " === Python Security Patterns ==="
97- # Exclude .claude/scripts from security pattern scan (automation code)
98- find . -type f -name " *.py" ! -path " ./.claude/scripts/*" -exec grep -Hn " eval\|exec\|__import__\|pickle.loads\|yaml.load[^s]\|subprocess.call\|os.system" {} \; 2> /dev/null || true
99- } > " $REVIEW_OUTPUT_DIR /python-security-scans.txt"
100-
101- PY_SECURITY_COUNT=$( grep -c " .py:" " $REVIEW_OUTPUT_DIR /python-security-scans.txt" 2> /dev/null || echo " 0" )
102- PY_SECURITY_COUNT=$( echo " $PY_SECURITY_COUNT " | tr -d ' \n' )
103- if [ " $PY_SECURITY_COUNT " -gt 0 ] 2> /dev/null; then
104- echo " ✗ Found $PY_SECURITY_COUNT security patterns in Python code"
105- else
106- echo " ✓ Python Security Patterns: PASSED"
107- fi
108- echo " "
109- fi
61+ # Skip Python security scans - only automation scripts present in .claude/scripts/
11062
11163# TODO/FIXME checks (all languages)
11264echo " === TODO/FIXME Checks ==="
0 commit comments