# Quality Assurance Module - Testing, Linting, and Code Quality # Commands for ensuring code quality, running tests, and maintaining standards # ๐Ÿงช TESTING COMMANDS # Run cargo check on all plugins [no-cd] check: @echo "๐Ÿ” Running cargo check on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Checking $$plugin..."; \ cd "$$plugin" && cargo check && cd ..; \ fi; \ done # Run cargo test on all plugins [no-cd] test: @echo "๐Ÿงช Running tests on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Testing $$plugin..."; \ cd "$$plugin" && cargo test && cd ..; \ fi; \ done # Run tests with verbose output [no-cd] test-verbose: @echo "๐Ÿงช Running tests (verbose)..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Testing $$plugin..."; \ cd "$$plugin" && cargo test -- --nocapture && cd ..; \ fi; \ done # Run tests in parallel [no-cd] test-parallel: @echo "โšก Running tests in parallel..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Testing $$plugin..."; \ cd "$$plugin" && cargo test --jobs 8 && cd ..; \ fi; \ done # Test specific plugin [no-cd] test-plugin PLUGIN: @echo "๐Ÿงช Testing {{PLUGIN}}..." @cd {{PLUGIN}} && cargo test # Run integration tests [no-cd] test-integration: @echo "๐Ÿ”— Running integration tests..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Integration testing $$plugin..."; \ cd "$$plugin" && cargo test --test integration 2>/dev/null || echo "No integration tests for $$plugin" && cd ..; \ fi; \ done # Run doc tests [no-cd] test-docs: @echo "๐Ÿ“– Running documentation tests..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Doc testing $$plugin..."; \ cd "$$plugin" && cargo test --doc && cd ..; \ fi; \ done # ๐Ÿ“ LINTING COMMANDS # Run cargo clippy on all plugins [no-cd] lint: @echo "๐Ÿ“ Running clippy on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Linting $$plugin..."; \ cd "$$plugin" && cargo clippy -- -D warnings && cd ..; \ fi; \ done # Run clippy with additional lints [no-cd] lint-pedantic: @echo "๐Ÿ“ Running pedantic clippy..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Pedantic linting $$plugin..."; \ cd "$$plugin" && cargo clippy -- -W clippy::pedantic -D warnings && cd ..; \ fi; \ done # Lint specific plugin [no-cd] lint-plugin PLUGIN: @echo "๐Ÿ“ Linting {{PLUGIN}}..." @cd {{PLUGIN}} && cargo clippy -- -D warnings # Fix lint issues automatically [no-cd] lint-fix: @echo "๐Ÿ”ง Fixing lint issues automatically..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Fixing $$plugin..."; \ cd "$$plugin" && cargo clippy --fix --allow-dirty --allow-staged && cd ..; \ fi; \ done # ๐ŸŽจ FORMATTING COMMANDS # Format all Rust code [no-cd] fmt: @echo "๐ŸŽจ Formatting Rust code..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Formatting $$plugin..."; \ cd "$$plugin" && cargo fmt && cd ..; \ fi; \ done # Check formatting without making changes [no-cd] fmt-check: @echo "๐ŸŽจ Checking code formatting..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Checking format of $$plugin..."; \ cd "$$plugin" && cargo fmt -- --check && cd ..; \ fi; \ done # Format specific plugin [no-cd] fmt-plugin PLUGIN: @echo "๐ŸŽจ Formatting {{PLUGIN}}..." @cd {{PLUGIN}} && cargo fmt # Format with custom configuration [no-cd] fmt-custom CONFIG: @echo "๐ŸŽจ Formatting with custom config: {{CONFIG}}..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Formatting $$plugin..."; \ cd "$$plugin" && cargo fmt --config {{CONFIG}} && cd ..; \ fi; \ done # ๐Ÿ”’ SECURITY COMMANDS # Run cargo audit on all plugins [no-cd] audit: @echo "๐Ÿ”’ Running security audit..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Auditing $$plugin..."; \ cd "$$plugin" && cargo audit && cd ..; \ fi; \ done # Audit specific plugin [no-cd] audit-plugin PLUGIN: @echo "๐Ÿ”’ Auditing {{PLUGIN}}..." @cd {{PLUGIN}} && cargo audit # Check for outdated dependencies [no-cd] audit-outdated: @echo "๐Ÿ“… Checking for outdated dependencies..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Checking $$plugin..."; \ cd "$$plugin" && cargo outdated || echo "cargo-outdated not available" && cd ..; \ fi; \ done # Generate dependency report [no-cd] audit-deps: @echo "๐Ÿ“‹ Generating dependency report..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "=== $$plugin ==="; \ cd "$$plugin" && cargo tree --depth 1 && cd ..; \ echo ""; \ fi; \ done # ๐Ÿ“Š BENCHMARKING COMMANDS # Run benchmarks on all plugins [no-cd] bench: @echo "๐Ÿ“Š Running benchmarks..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Benchmarking $$plugin..."; \ cd "$$plugin" && cargo bench 2>/dev/null || echo "No benchmarks for $$plugin" && cd ..; \ fi; \ done # Benchmark specific plugin [no-cd] bench-plugin PLUGIN: @echo "๐Ÿ“Š Benchmarking {{PLUGIN}}..." @cd {{PLUGIN}} && cargo bench # Run performance tests [no-cd] perf-test: @echo "โšก Running performance tests..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Performance testing $$plugin..."; \ cd "$$plugin" && cargo test --release perf 2>/dev/null || echo "No perf tests for $$plugin" && cd ..; \ fi; \ done # ๐Ÿ“š DOCUMENTATION COMMANDS # Generate documentation for all plugins [no-cd] docs: @echo "๐Ÿ“š Generating documentation..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Generating docs for $$plugin..."; \ cd "$$plugin" && cargo doc --no-deps && cd ..; \ fi; \ done # Open documentation in browser [no-cd] docs-open PLUGIN: @echo "๐Ÿ“– Opening documentation for {{PLUGIN}}..." @cd {{PLUGIN}} && cargo doc --open # Generate documentation with private items [no-cd] docs-private: @echo "๐Ÿ“š Generating documentation (including private)..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Generating docs for $$plugin..."; \ cd "$$plugin" && cargo doc --no-deps --document-private-items && cd ..; \ fi; \ done # Check documentation links [no-cd] docs-check: @echo "๐Ÿ”— Checking documentation links..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Checking docs for $$plugin..."; \ cd "$$plugin" && cargo doc --no-deps 2>&1 | grep -i "warning\|error" || echo "โœ… OK" && cd ..; \ fi; \ done # ๐Ÿ”„ WORKFLOW COMMANDS # Complete quality check workflow [no-cd] qa-flow: @echo "โœจ Running complete quality check workflow..." @just validate-nushell @just fmt-check @just lint @just test @just audit # Quick quality check [no-cd] qa-quick: @echo "โšก Running quick quality checks..." @just fmt-check @just check @just lint # Pre-commit checks [no-cd] qa-pre-commit: @echo "๐Ÿ” Running pre-commit checks..." @just fmt-check @just lint @just test # CI simulation [no-cd] qa-ci: @echo "๐Ÿค– Simulating CI workflow..." @just validate-nushell @just fmt-check @just lint @just test @just audit @echo "โœ… All CI checks passed!" # Full quality suite [no-cd] qa-full: @echo "๐ŸŽฏ Running full quality suite..." @just fmt-check @just lint-pedantic @just test-verbose @just test-docs @just audit @just docs-check @just bench # ๐Ÿ“Š QUALITY INFORMATION # Show quality metrics [no-cd] qa-metrics: @echo "๐Ÿ“Š Quality Metrics:" @echo "==================" @echo "" @echo "Code Coverage:" @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo -n " $$plugin: "; \ cd "$$plugin" && cargo tarpaulin --skip-clean --out Stdout 2>/dev/null | grep -o "[0-9]*\.[0-9]*%" | tail -1 || echo "Not available" && cd ..; \ fi; \ done @echo "" @echo "Lines of Code:" @find nu_plugin_*/src -name "*.rs" -exec wc -l {} + | tail -1 | awk '{print " Total: " $1 " lines"}' # Show test statistics [no-cd] qa-stats: @echo "๐Ÿ“Š Test Statistics:" @echo "==================" @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo -n "$$plugin: "; \ cd "$$plugin" && cargo test 2>&1 | grep -o "[0-9]* passed" || echo "No tests" && cd ..; \ fi; \ done # ๐Ÿ“Š QA INFORMATION # Show QA help [no-cd] qa-help: @echo "๐Ÿงช Quality Assurance Module Help" @echo "================================" @echo "" @echo "TESTING:" @echo " check - Run cargo check on all plugins" @echo " test - Run tests on all plugins" @echo " test-verbose - Run tests with verbose output" @echo " test-parallel - Run tests in parallel" @echo " test-plugin PLUGIN - Test specific plugin" @echo " test-integration - Run integration tests" @echo " test-docs - Run documentation tests" @echo "" @echo "LINTING:" @echo " lint - Run clippy on all plugins" @echo " lint-pedantic - Run pedantic clippy" @echo " lint-plugin PLUGIN - Lint specific plugin" @echo " lint-fix - Fix lint issues automatically" @echo "" @echo "FORMATTING:" @echo " fmt - Format all code" @echo " fmt-check - Check formatting" @echo " fmt-plugin PLUGIN - Format specific plugin" @echo " fmt-custom CONFIG - Format with custom config" @echo "" @echo "SECURITY:" @echo " audit - Run security audit" @echo " audit-plugin PLUGIN - Audit specific plugin" @echo " audit-outdated - Check outdated dependencies" @echo " audit-deps - Generate dependency report" @echo "" @echo "BENCHMARKING:" @echo " bench - Run benchmarks" @echo " bench-plugin PLUGIN - Benchmark specific plugin" @echo " perf-test - Run performance tests" @echo "" @echo "DOCUMENTATION:" @echo " docs - Generate documentation" @echo " docs-open PLUGIN - Open docs in browser" @echo " docs-private - Generate with private items" @echo " docs-check - Check documentation links" @echo "" @echo "WORKFLOWS:" @echo " qa-flow - Complete quality workflow" @echo " qa-quick - Quick quality checks" @echo " qa-pre-commit - Pre-commit checks" @echo " qa-ci - CI simulation" @echo " qa-full - Full quality suite" @echo "" @echo "METRICS:" @echo " qa-metrics - Show quality metrics" @echo " qa-stats - Show test statistics" @echo "" @echo "EXAMPLES:" @echo " just qa-flow" @echo " just test-plugin nu_plugin_clipboard" @echo " just lint-fix" @echo " just docs-open nu_plugin_image"