Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fallow.tools/llms.txt

Use this file to discover all available pages before exploring further.

CI catches unused code, duplication, and complexity issues that get past agent workflows and editor review.
1

Add the action

Add fallow to your workflow file:
name: Fallow analysis
on: [push, pull_request]

jobs:
  fallow:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: fallow-rs/fallow@v2
        with:
          format: sarif
This runs all analyses (dead code + duplication + complexity) by default. Use the command input to run a specific analysis.
2

Configure inputs

Customize the action with these inputs:
InputDefaultDescription
command— (all)Command to run (dead-code, dupes, health, audit, fix, or empty for all). Legacy alias: check = dead-code.
root.Project root directory
configPath to config file (.fallowrc.json, .fallowrc.jsonc, fallow.toml, or .fallow.toml)
formatsarifOutput format
productionfalseEnable production mode for every analysis
production-dead-codefalseCombined mode only: per-analysis production mode for dead-code
production-healthfalseCombined mode only: per-analysis production mode for health
production-dupesfalseCombined mode only: per-analysis production mode for duplication
fail-on-issuestrueExit with code 1 if issues are found
changed-sinceOnly check files changed since this ref
auto-changed-sincetrueAutomatically scope to changed files in PR context using base SHA. Ignored when changed-since is set.
baselinePath to baseline file for comparison. Rejected with exit 2 when command: audit; use dead-code-baseline / health-baseline / dupes-baseline instead.
save-baselineSave current results as a baseline file. Rejected with exit 2 when command: audit (audit runs three analyses with incompatible baseline formats).
versionFallow version override. When omitted, the action uses the project package.json fallow dependency spec if present, otherwise latest.
workspaceScope output to one or more workspaces (exact names, globs, ! negation; comma-separated)
changed-workspacesGit-derived monorepo scoping: scope to workspaces containing any file changed since REF (e.g. origin/main). Requires fetch-depth: 0. Mutually exclusive with workspace. A missing ref is a hard error (exit 2) rather than silent full-scope fallback.
commentfalsePost results as a PR comment
review-commentsfalsePost inline PR review comments with typed review-github output and reconcile resolved threads on later runs
annotationstrueEmit findings as inline PR annotations via workflow commands (no Advanced Security required)
max-annotations50Maximum number of inline annotations to emit
github-token${{ github.token }}GitHub token for PR comments and SARIF upload
dupes-modemildDetection mode for dupes command
min-tokensMinimum token count for a clone (dupes command)
min-linesMinimum line count for a clone (dupes command)
thresholdFail if duplication exceeds this % (dupes command)
skip-localfalseOnly report cross-directory duplicates (dupes command)
scorefalseCompute health score (0-100 with letter grade). Enables the health delta header in PR comments (health and bare command)
trendfalseCompare current metrics against the most recent saved snapshot. Implies score (health and bare command)
save-snapshotSave vital signs snapshot for trend tracking. Set to true for default path or provide a custom path (health and bare command)
dry-runtruePreview changes without modifying files (fix command)
coveragePath to Istanbul coverage-final.json for accurate per-function CRAP scores (health and audit commands)
coverage-rootAbsolute prefix to strip from Istanbul file paths before matching (health and audit commands). Use when coverage was generated under a different checkout root in CI / Docker (e.g., /home/runner/work/myapp).
max-crap30.0CRAP score threshold (health and audit commands). Functions meeting or exceeding this score contribute to the verdict.
gatenew-onlyAudit verdict gate. new-only fails only on findings introduced by the changeset; all fails on every finding in changed files.
dead-code-baseline / health-baseline / dupes-baselinePer-analysis baseline file paths for the audit command (saved by `fallow dead-codehealthdupes —save-baseline`). Used so pre-existing issues on touched files do not dominate the verdict.
argsAdditional arguments to pass to fallow
3

Upload SARIF (optional)

Upload results to GitHub Code Scanning to get inline annotations on the PR diff:
- uses: fallow-rs/fallow@v2
  with:
    format: sarif

- uses: github/codeql-action/upload-sarif@v4
  with:
    sarif_file: fallow-results.sarif
GitHub Actions job summary
fallow 8 issues found

Dead Code (3 issues)
| Type | File | Symbol | Line |
|------|------|--------|------|
| unused-export | src/utils/format.ts | formatCurrency | 12 |
| unused-export | src/utils/format.ts | formatPercentage | 28 |
| unused-file | src/legacy/oldApi.ts | | |

Duplication (3 clone groups, 1.8%)
| Files | Lines | Tokens |
|-------|-------|--------|
| src/tax/utils.ts src/savings/utils.ts | 25 | 92 |

Complexity (2 hotspots)
| File | Function | Cyclomatic | Cognitive |
|------|----------|------------|-----------|
| src/server/router.ts:42 | handleRequest | 28 | 34 |

Completed in 48ms
SARIF upload to GitHub Code Scanning shows dead code issues as inline annotations directly on the PR diff.
GitHub Code Scanning is available on public repositories and on private repositories with GitHub Advanced Security enabled. If Code Scanning is unavailable, the action warns, skips SARIF upload, and keeps the job summary plus primary fallow output available.
PR summary comments use fallow’s native pr-comment-github format. Inline review comments use review-github, then fallow ci reconcile-review --provider github marks stale fallow review threads resolved when findings disappear.
GitHub inline review comments target the current PR file state (side: RIGHT). Findings on deleted lines are not modeled yet; fallow’s diagnostics are current-state oriented in normal use.
The action automatically detects your package manager (npm, pnpm, or yarn) from lock files. Review comments and annotations show the correct install/uninstall commands for your project.
Both the GitHub Action and GitLab CI template automatically scope analysis to changed files in PR/MR context. No extra configuration needed.

PR/MR-only analysis

Only analyze files changed in the current pull request or merge request:
The action does this automatically via auto-changed-since (enabled by default). To disable and run a full analysis on PRs:
- uses: fallow-rs/fallow@v2
  with:
    auto-changed-since: false
To use a custom ref instead of the PR base SHA:
- uses: fallow-rs/fallow@v2
  with:
    changed-since: origin/main
Adopting fallow on a large codebase? Use baselines to ignore pre-existing issues while catching new ones.1. Save a baseline on your main branch:
npx fallow --save-baseline fallow-baselines/dead-code.json
git add fallow-baselines/dead-code.json && git commit -m "chore: add fallow baseline"
2. In your CI workflow, compare against the baseline:
- uses: fallow-rs/fallow@v2
  with:
    baseline: fallow-baselines/dead-code.json
Only new issues (not in the baseline) get reported. As your team cleans up existing dead code, periodically regenerate the baseline on main.
Baselines must be committed to your repo. If you regenerate on every CI run, new issues are never reported.

Severity-aware PR gate (audit)

The default combined run gates on raw issue count: any finding in the changed files fails CI. That’s the right contract for a tight feedback loop, but it doesn’t honor rule severity. A project with unused-exports: warn (or any warn-tier rule) still fails CI when a PR touches a file with pre-existing warn-tier findings. fallow audit is the severity-aware alternative. It combines dead-code, complexity, and duplication analysis scoped to changed files and returns a verdict (pass / warn / fail):
  • pass: no issues in changed files
  • warn: only warn-tier issues; CI does not fail
  • fail: error-tier issues found; CI fails
By default audit runs in gate: new-only mode, so only findings introduced by the current changeset affect the verdict. Pre-existing findings show up in the PR comment as inherited (with a count), but they do not gate the merge.
- uses: fallow-rs/fallow@v2
  with:
    command: audit
    gate: new-only        # default; fails only on findings introduced by this PR
    fail-on-issues: true
The action exposes outputs.verdict (pass/warn/fail) and outputs.gate so downstream steps can branch on the verdict:
- uses: fallow-rs/fallow@v2
  id: fallow
  with:
    command: audit

- name: Block release on regression
  if: steps.fallow.outputs.verdict == 'fail'
  run: exit 1

Migrating from combined to audit

If your project is on the default combined run today and you want severity-aware gating, add command: audit (FALLOW_COMMAND: audit) and the existing PR comment, annotations, and review comments continue to work. The audit run produces an extra verdict banner at the top of the PR comment:
> :x: Audit failed · gate: `new-only` · 2 new findings introduced by this PR · 5 inherited (not gated)
Use gate: all (FALLOW_AUDIT_GATE: "all") if you want every finding in changed files to gate, ignoring the inherited-vs-introduced split. This is the strict posture: nothing slips in, but pre-existing findings on touched files block the merge until cleaned up.
Audit needs a base ref. The action and GitLab CI template auto-detect the PR/MR base, so no extra configuration is needed for that workflow. On non-PR pipelines (release branches, scheduled jobs), set changed-since (FALLOW_CHANGED_SINCE) explicitly; the runners hard-error rather than silently analyze nothing.

The three tracks together

CI works best when combined with agent and editor integration:
  1. Agent generates code and runs fallow --changed-since HEAD~1 to self-check
  2. Human reviews in VS Code, sees Code Lens annotations on new exports
  3. CI runs the full analysis and catches anything that slipped through
Fallow analyzes a 20,000-file project in under 2 seconds. It adds negligible time to any pipeline.

See also

Agent integration

How AI agents use fallow via CLI and MCP.

Rule configuration

Configure severity levels and issue types.

Production mode

Exclude test and dev files from analysis.

Health badges

Add a health score badge to your README.