SHELL := /bin/bash
.PHONY: all build test lint fmt clean coverage coverage-html coverage-summary bench doc generate verify train help
.PHONY: test-one test-fast quality tdg mutants certeza ci nightly
all: lint test
build:
cargo build --release
test:
cargo test
test-fast:
cargo test --lib
test-one:
@echo "Usage: make test-one TEST=test_name"
cargo test $(TEST) -- --nocapture
lint:
cargo fmt --check
cargo clippy -- -D warnings
fmt:
cargo fmt
clean:
cargo clean
rm -rf target/llvm-cov-target
rm -rf target/coverage
coverage:
@echo "๐ Running comprehensive test coverage analysis..."
@echo "๐ Checking for cargo-llvm-cov..."
@which cargo-llvm-cov > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-llvm-cov..." && cargo install cargo-llvm-cov --locked)
@echo "๐งน Cleaning old coverage data..."
@cargo llvm-cov clean --workspace
@mkdir -p target/coverage
@echo "โ๏ธ Temporarily disabling global cargo config (mold breaks coverage)..."
@test -f ~/.cargo/config.toml && mv ~/.cargo/config.toml ~/.cargo/config.toml.cov-backup || true
@echo "๐งช Running tests with instrumentation (lib only)..."
@cargo llvm-cov --lib --summary-only || (test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml; exit 1)
@echo "โ๏ธ Restoring global cargo config..."
@test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml || true
@echo ""
@echo "๐ก COVERAGE INSIGHTS:"
@echo "- Target: 95% line coverage"
@echo "- HTML report: make coverage-html"
@echo ""
coverage-html:
@echo "๐ Generating HTML coverage report..."
@which cargo-llvm-cov > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-llvm-cov..." && cargo install cargo-llvm-cov --locked)
@cargo llvm-cov clean --workspace
@mkdir -p target/coverage
@test -f ~/.cargo/config.toml && mv ~/.cargo/config.toml ~/.cargo/config.toml.cov-backup || true
@cargo llvm-cov --lib --html --output-dir target/coverage/html || (test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml; exit 1)
@test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml || true
@echo "๐ Coverage report at target/coverage/html/index.html"
coverage-summary:
@test -f ~/.cargo/config.toml && mv ~/.cargo/config.toml ~/.cargo/config.toml.cov-backup || true
@cargo llvm-cov report --summary-only 2>/dev/null || echo "Run 'make coverage' first"
@test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml || true
bench:
cargo bench
doc:
cargo doc --no-deps
@echo "Documentation at target/doc/verificar/index.html"
quality: lint test coverage
@echo "All quality gates passed!"
tdg:
pmat tdg --min-grade A-
mutants:
cargo mutants --min-score 85
certeza:
cd ../certeza && cargo run -- check ../verificar
generate:
cargo run --release -- generate \
--strategy coverage-guided \
--count 1000 \
--output data/generated/
verify:
cargo run --release -- verify \
--input data/generated/ \
--transpilers depyler,bashrs,ruchy
train:
cargo run --release -- train \
--input data/verified/ \
--output models/
ci: lint test coverage tdg
nightly: ci mutants bench
help:
@echo "Verificar Makefile targets:"
@echo " build - Build release binary"
@echo " test - Run all tests"
@echo " test-fast - Run lib tests only"
@echo " test-one - Run single test (TEST=name)"
@echo " lint - Check formatting and clippy"
@echo " fmt - Format code"
@echo " coverage - Generate coverage report (95% min)"
@echo " coverage-html - Generate HTML coverage report"
@echo " coverage-summary- Show coverage summary"
@echo " bench - Run benchmarks"
@echo " doc - Generate documentation"
@echo " quality - Run all quality gates"
@echo " tdg - Check TDG grade (A- min)"
@echo " mutants - Run mutation testing (85% min)"
@echo " certeza - Run certeza validation"
@echo " generate - Generate test cases"
@echo " verify - Verify transpilation"
@echo " train - Train ML models"
@echo " ci - Full CI pipeline"
@echo " nightly - Nightly quality run"
@echo " clean - Clean build artifacts"