#!/bin/bash # Script to analyze warning status in Foxhunt codebase set -e echo "🔍 Foxhunt Warning Analysis" echo "================================" echo "" # Get total warning count echo "Running cargo check..." OUTPUT=$(cargo check --workspace 2>&1) WARNING_COUNT=$(echo "$OUTPUT" | grep "warning:" | wc -l) THRESHOLD=50 echo "📊 Warning Summary" echo " Total warnings: $WARNING_COUNT" echo " Threshold: $THRESHOLD" echo "" if [ "$WARNING_COUNT" -gt "$THRESHOLD" ]; then EXCESS=$((WARNING_COUNT - THRESHOLD)) echo " Status: ❌ $EXCESS warnings over threshold" else REMAINING=$((THRESHOLD - WARNING_COUNT)) echo " Status: ✅ $REMAINING warnings under threshold" fi echo "" # Breakdown by type echo "📋 Warning Breakdown by Type" echo "----------------------------" echo "$OUTPUT" | grep "warning:" | sed 's/^warning: //' | cut -d'`' -f1 | sort | uniq -c | sort -rn | head -10 echo "" # Breakdown by crate echo "📦 Warning Breakdown by Crate" echo "----------------------------" echo "$OUTPUT" | grep "warning:" -B 5 | grep "Checking" | sort | uniq -c | sort -rn echo "" # Show sample warnings echo "🔎 Sample Warnings (first 5)" echo "----------------------------" echo "$OUTPUT" | grep "warning:" | head -5 echo "" # Progress tracking echo "📈 Progress Tracking" echo "----------------------------" echo "Wave 17-7: 5,564 warnings → 43 warnings (99.2% reduction)" echo "Wave 18: 43 warnings → 302 warnings (regression detected)" echo "Wave 19: Setting up quality gates (current)" echo "Wave 20: Target <50 warnings" echo "" # Recommendations if [ "$WARNING_COUNT" -gt "$THRESHOLD" ]; then echo "💡 Recommendations" echo "----------------------------" echo "1. Fix unused imports first (easiest wins)" echo "2. Add #[derive(Debug)] for missing implementations" echo "3. Fix non_snake_case naming issues" echo "4. Add documentation for public items" echo "" echo "Quick fixes:" echo " cargo fix --workspace --allow-dirty" echo " cargo clippy --workspace --fix --allow-dirty" fi echo "✅ Analysis complete"