# =============================================================================
# QUALITY ASSURANCE COMMANDS - Rustelo Framework
# =============================================================================
# Code quality, security, and auditing commands

# Run all code quality checks
check-all:
    @echo "🔍 Running all quality checks..."
    @just check-strict
    @just audit
    @just unused-deps

# Run strict code quality checks
check-strict:
    @echo "🔍 Running strict quality checks..."
    cargo clippy --all-targets --all-features -- -D warnings
    cargo fmt --check
    cargo check --all-features

# Run security audit
audit:
    @echo "🔒 Running security audit..."
    cargo audit
    ./scripts/tools/security.sh

# Check for unused dependencies
unused-deps:
    @echo "📦 Checking for unused dependencies..."
    cargo +nightly udeps

# Security audit with detailed report
security-audit:
    @echo "🔒 Running detailed security audit..."
    ./scripts/tools/security.sh --verbose
    cargo audit --json > security_reports/audit-$(date +%Y%m%d).json

# Performance audit
performance-audit:
    @echo "⚡ Running performance audit..."
    ./scripts/tools/performance.sh

# Run quality checks and generate report
quality:
    @echo "📊 Generating quality report..."
    @just check-strict
    @just audit 
    @just unused-deps
    @echo "✅ Quality checks completed"

# Fix common code issues
fix:
    @echo "🔧 Fixing common code issues..."
    cargo clippy --fix --allow-dirty
    cargo fmt

# Check code formatting
fmt-check:
    @echo "📝 Checking code formatting..."
    cargo fmt --check