Options
Base ref
| Flag | Description |
|---|---|
--base <REF> | Git ref to compare against (e.g., main, HEAD~5, a commit SHA). Alias for --changed-since. Auto-detects the default branch if omitted. |
Output
| Flag | Description |
|---|---|
-f, --format <FORMAT> | Output format: human (default), json, sarif, compact, markdown, codeclimate |
-q, --quiet | Suppress progress and status output on stderr |
--explain | Add metric explanations in JSON output (_meta objects with docs links) |
Scoping
| Flag | Description |
|---|---|
-w, --workspace <NAME> | Scope to a single workspace package |
--production | Exclude test/story/dev files |
Verdict
| Verdict | Exit code | When | What to do |
|---|---|---|---|
| pass | 0 | No issues in changed files | Ship it. |
| warn | 0 | Issues found, all warn-severity | CI passes, but consider fixing before they become errors. |
| fail | 1 | Error-severity issues found | Fix the reported issues before merging. |
| error | 2 | Runtime error (invalid ref, not a git repo, config error) | Check the error message. In JSON format, emits {"error": true, "message": "...", "exit_code": 2}. |
fallow health config (defaults: cyclomatic 20, cognitive 15). Duplication is a warning unless a --threshold is configured.
Inline suppression comments (
// fallow-ignore-next-line) work in audit — findings in changed files are suppressed the same way as in fallow dead-code.Examples
Example output
$ fallow audit (pass)
$ fallow audit (warn)
■ summary line appears only on warn verdicts, before any detail sections. It is suppressed with --quiet.
$ fallow audit (fail)
How it works
- Resolve base ref: uses
--baseif provided, otherwise auto-detects the default branch (git symbolic-ref refs/remotes/origin/HEAD→main→master). Hard-errors if no base can be determined. - Find changed files: runs
git diff --name-only <base>...HEAD(three-dot diff — changes since the merge base). - Run three analyses scoped to changed files: dead code, complexity, duplication.
- Compute verdict: aggregates severity across all three analyses into pass/warn/fail.
JSON output
$ fallow audit --format json
Key fields
| Field | Type | Description |
|---|---|---|
verdict | "pass" | "warn" | "fail" | The audit result. Use this for CI gates. |
changed_files_count | integer | Number of files changed between base and HEAD |
base_ref | string | The git ref used for comparison |
summary.dead_code_issues | integer | Total dead code issues in changed files |
summary.dead_code_has_errors | boolean | Whether any dead code issues have error severity |
summary.complexity_findings | integer | Functions exceeding complexity thresholds |
summary.max_cyclomatic | integer | null | Highest cyclomatic complexity found (null if none) |
summary.duplication_clone_groups | integer | Clone groups involving changed files |
dead_code, complexity, and duplication sub-objects contain full results in the same format as fallow dead-code, fallow health, and fallow dupes respectively. These are omitted when no files changed.
On exit code 2 (runtime error), JSON format emits
{"error": true, "message": "...", "exit_code": 2} to stdout instead of the audit envelope.MCP tool
Theaudit MCP tool wraps fallow audit --format json --quiet --explain:
Example request
base is not specified. The response always includes _meta explanatory metadata (the MCP wrapper enables --explain by default). Returns the same JSON envelope as the CLI.
See MCP integration for setup instructions.
See also
Dead code analysis
Full dead code analysis with issue-type filters.
Health analysis
Complexity metrics, file scores, hotspots, and targets.
MCP integration
Use fallow tools from AI coding agents.