BREAKING CHANGES: - Removed orphaned dqn.rs monolithic trainer (4,975 lines) - Removed orphaned dqn_ensemble.rs module (816 lines) - Removed orphaned tft.rs and tft_complete_int8_integration_test.rs - TFT trainer split into modular directory structure DQN Module Refactoring: - Split trainers/dqn.rs into modular structure (config.rs, statistics.rs, trainer.rs) - Fixed hyperopt 39D search space (continuous params only) - Boolean flags (use_dueling, use_double_dqn, use_per, use_noisy_nets) are now FIXED architectural decisions - use_distributional defaults to false (Candle BUG #36 - scatter_add gradient issues) Clean Module Structure: - ml/src/trainers/dqn/ directory with proper mod.rs exports - ml/src/trainers/tft/ directory with config.rs, types.rs, model.rs, trainer.rs, tests.rs - All P0 features validated: TD-error clamping, batch diversity, LR scheduler, priority staleness Documentation: - Added comprehensive docs in docs/codebase-cleanup/ - ADR-001 for DQN refactoring decisions - Rainbow DQN component matrix and quick reference guides Build Status: Compiles with zero errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.9 KiB
Bash
Executable File
51 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Dead Code Analysis Script for Foxhunt Workspace
|
|
|
|
echo "=== FOXHUNT DEAD CODE ANALYSIS ==="
|
|
echo ""
|
|
|
|
# 1. Find public items that might be unused
|
|
echo "1. PUBLIC API SURFACE ANALYSIS"
|
|
echo "-------------------------------"
|
|
find . -name "*.rs" -type f -not -path "./target/*" -exec grep -l "^pub fn\|^pub struct\|^pub enum\|^pub trait" {} \; | wc -l
|
|
echo " files with public items found"
|
|
echo ""
|
|
|
|
# 2. Find large commented code blocks
|
|
echo "2. LARGE COMMENTED CODE BLOCKS (>10 lines)"
|
|
echo "-------------------------------------------"
|
|
find . -name "*.rs" -type f -not -path "./target/*" -print0 | while IFS= read -r -d '' file; do
|
|
awk '/^[[:space:]]*\/\// {count++} !/^[[:space:]]*\/\// {if (count >= 10) print FILENAME":"NR-count"-"NR-1":"count" lines"; count=0} END {if (count >= 10) print FILENAME":"NR-count"-"NR":"count" lines"}' "$file"
|
|
done | head -20
|
|
echo ""
|
|
|
|
# 3. Find empty or nearly empty modules
|
|
echo "3. EMPTY OR MINIMAL MODULES"
|
|
echo "----------------------------"
|
|
find . -name "*.rs" -type f -not -path "./target/*" -exec sh -c 'lines=$(wc -l < "$1"); if [ "$lines" -lt 10 ]; then echo "$1: $lines lines"; fi' _ {} \; | head -20
|
|
echo ""
|
|
|
|
# 4. Find test modules with no tests
|
|
echo "4. TEST MODULES WITHOUT TESTS"
|
|
echo "------------------------------"
|
|
find . -name "*.rs" -type f -not -path "./target/*" -exec grep -l "#\[cfg(test)\]" {} \; | while read file; do
|
|
if ! grep -q "#\[test\]" "$file"; then
|
|
echo "$file - has #[cfg(test)] but no #[test] functions"
|
|
fi
|
|
done | head -10
|
|
echo ""
|
|
|
|
# 5. Find feature-gated code
|
|
echo "5. FEATURE-GATED CODE"
|
|
echo "----------------------"
|
|
find . -name "*.rs" -type f -not -path "./target/*" -exec grep -l "#\[cfg(feature" {} \; | head -10
|
|
echo ""
|
|
|
|
# 6. Analyze Cargo.toml dependencies
|
|
echo "6. DEPENDENCY ANALYSIS PER CRATE"
|
|
echo "---------------------------------"
|
|
find . -name "Cargo.toml" -not -path "./target/*" | head -5
|
|
echo ""
|
|
|
|
echo "=== ANALYSIS COMPLETE ==="
|