audit

Run comprehensive Rust project audit — clippy, tests, dependency check, unsafe audit

Rust Project Audit

Run a full-spectrum audit of the current Rust project. Execute each step in sequence, collecting results, then present a structured summary.

Steps

1. Format check

cargo fmt --check 2>&1

Record whether formatting passes or list the files that need formatting.

2. Clippy lint check

cargo clippy -- -D warnings 2>&1

Record the number of warnings/errors and capture the diagnostic output.

3. Test suite

cargo test 2>&1

Record total tests, passed, failed, and ignored. Capture any failure output.

4. Dependency audit (if available)

Check if cargo-deny is installed:

command -v cargo-deny >/dev/null 2>&1

If installed, run:

cargo deny check 2>&1

This checks for:

  • Known vulnerabilities (advisories)
  • Banned licenses
  • Duplicate dependencies
  • Banned crates

If cargo-deny is not installed, note it as skipped and suggest installing it: cargo install cargo-deny

5. Report

Present results as a structured summary using this format:

== Rust Project Audit Report ==

Formatting .... [PASS | FAIL (N files)]
Clippy ........ [PASS | FAIL (N diagnostics)]
Tests ......... [PASS (N passed) | FAIL (N passed, M failed, K ignored)]
Cargo Deny .... [PASS | FAIL (details) | SKIPPED (not installed)]

--- Details ---

[Only include sections with failures or warnings. For each, show the
relevant diagnostic output so the user can act on it immediately.]

If everything passes, end with: All checks passed. Ship it.

If there are failures, prioritize them: test failures first, then clippy errors, then formatting, then dependency issues. For each failure, include the exact compiler/tool output so the user can fix it without re-running.