.PHONY: all build test check fmt clippy clean release help
all: check test
build:
cargo build
test:
cargo test
check: fmt clippy build test
@echo "✅ All checks passed!"
fmt:
cargo fmt --all -- --check
clippy:
cargo clippy --all-targets --all-features -- -D warnings
clean:
cargo clean
release:
cargo build --release
run:
cargo run --
install:
cargo install --path .
uninstall:
cargo uninstall lineguard
setup-hooks:
@echo "Installing git hooks..."
@mkdir -p .git/hooks
@cp examples/pre-commit.sh .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Git hooks installed!"
bench:
cargo build --release
@echo "Running benchmarks..."
@command -v hyperfine >/dev/null 2>&1 || { echo "hyperfine not installed. Install with: cargo install hyperfine"; exit 1; }
hyperfine --warmup 3 './target/release/lineguard src' './target/release/lineguard "src/**/*.rs"'
coverage:
@command -v cargo-tarpaulin >/dev/null 2>&1 || cargo install cargo-tarpaulin
cargo tarpaulin --out html --avoid-cfg-tarpaulin
@echo "Coverage report generated at: target/tarpaulin/tarpaulin-report.html"
audit:
@command -v cargo-audit >/dev/null 2>&1 || cargo install cargo-audit
cargo audit
update-deps:
@command -v cargo-edit >/dev/null 2>&1 || cargo install cargo-edit
cargo upgrade --workspace --incompatible
dev:
cargo fmt --all
cargo test
@echo "Ready for commit!"
help:
@echo "Available targets:"
@echo " make all - Run checks and tests (default)"
@echo " make build - Build the project"
@echo " make test - Run all tests"
@echo " make check - Run all checks (fmt, clippy, build, test)"
@echo " make fmt - Check code formatting"
@echo " make clippy - Run clippy linter"
@echo " make clean - Clean build artifacts"
@echo " make release - Build release version"
@echo " make run - Run the tool"
@echo " make install - Install locally"
@echo " make setup-hooks - Install git hooks"
@echo " make bench - Run benchmarks"
@echo " make coverage - Generate coverage report"
@echo " make audit - Run security audit"
@echo " make update-deps - Update dependencies"
@echo " make dev - Development workflow (format + test)"
@echo " make help - Show this help message"