Patterns applied: - Pattern 2: Float comparison (2x: utils.rs, var_edge_cases_tests.rs) - Pattern 7: Date/time construction (2x: production_streaming.rs, streaming.rs) - Pattern 1: Duration/time ops (2x: rate limiter, semaphore) - Pattern 4: Optional field access (1x: position_tracker.rs) Changes: - data/src/utils.rs: Float sort with NaN handling - data/src/providers/benzinga/production_streaming.rs: Rate limiter + semaphore + date/time - data/src/providers/benzinga/streaming.rs: Date/time construction - risk/src/position_tracker.rs: Emergency fallback counter - risk/tests/var_edge_cases_tests.rs: Test helper float sort Test impact: 0 failures (182/182 passing) Compilation: Clean (0 errors, 0 warnings) Time: 25 min (44% under budget)
57 lines
1.8 KiB
Bash
Executable File
57 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Quick Fix Commands - Foxhunt Codebase Cleanup
|
|
# Total Estimated Time: 3.5 minutes
|
|
# Impact: Cosmetic improvements only, zero functional changes
|
|
|
|
set -e
|
|
|
|
echo "=========================================="
|
|
echo "Foxhunt Codebase Quick Fixes"
|
|
echo "Total Time: ~3.5 minutes"
|
|
echo "=========================================="
|
|
|
|
echo ""
|
|
echo "[1/3] Fixing 4 Clippy Deny-Level Errors (35 seconds)..."
|
|
echo "Files affected:"
|
|
echo " - services/stress_tests/src/metrics.rs"
|
|
echo " - trading-data/src/models.rs"
|
|
echo " - trading_engine/src/types/events.rs"
|
|
|
|
# Manual fixes required (clippy --fix may not handle all):
|
|
echo ""
|
|
echo "Manual fixes needed:"
|
|
echo "1. stress_tests/src/metrics.rs:144"
|
|
echo " BEFORE: let mean_u64 = (mean_micros as u64).min(u64::MAX);"
|
|
echo " AFTER: let mean_u64 = (mean_micros as u64);"
|
|
echo ""
|
|
echo "2. trading-data/src/models.rs:98"
|
|
echo " BEFORE: assert_eq!(order.quantity.to_f64(), 100000.0);"
|
|
echo " AFTER: assert_relative_eq!(order.quantity.to_f64(), 100_000.0, epsilon = 1e-6);"
|
|
echo ""
|
|
echo "3. trading_engine/src/types/events.rs (4 locations)"
|
|
echo " BEFORE: 150000.0, 100000.0, 500000.0, 400000.0"
|
|
echo " AFTER: 150_000.0, 100_000.0, 500_000.0, 400_000.0"
|
|
|
|
read -p "Press Enter after making manual fixes..."
|
|
|
|
echo ""
|
|
echo "[2/3] Formatting entire codebase (2 minutes)..."
|
|
cargo fmt --all
|
|
echo "✅ Formatting complete"
|
|
|
|
echo ""
|
|
echo "[3/3] Verifying compilation (1 minute)..."
|
|
cargo build --workspace --release --quiet
|
|
echo "✅ Compilation successful"
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "✅ Quick fixes complete!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Review changes: git diff"
|
|
echo "2. Run tests: cargo test --workspace --lib"
|
|
echo "3. Commit: git commit -m 'chore: Apply clippy fixes and rustfmt'"
|
|
echo "4. Deploy to production"
|