CI catches unused code, duplication, and complexity issues that get past agent workflows and editor review.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.
- GitHub Action
- GitLab CI
- Manual Setup
- Other CI
Add the action
Add fallow to your workflow file:This runs all analyses (dead code + duplication + complexity) by default. Use the
command input to run a specific analysis.Configure inputs
Customize the action with these inputs:
| Input | Default | Description | ||
|---|---|---|---|---|
command | — (all) | Command to run (dead-code, dupes, health, audit, fix, or empty for all). Legacy alias: check = dead-code. | ||
root | . | Project root directory | ||
config | — | Path to config file (.fallowrc.json, .fallowrc.jsonc, fallow.toml, or .fallow.toml) | ||
format | sarif | Output format | ||
production | false | Enable production mode for every analysis | ||
production-dead-code | false | Combined mode only: per-analysis production mode for dead-code | ||
production-health | false | Combined mode only: per-analysis production mode for health | ||
production-dupes | false | Combined mode only: per-analysis production mode for duplication | ||
fail-on-issues | true | Exit with code 1 if issues are found | ||
changed-since | — | Only check files changed since this ref | ||
auto-changed-since | true | Automatically scope to changed files in PR context using base SHA. Ignored when changed-since is set. | ||
baseline | — | Path to baseline file for comparison. Rejected with exit 2 when command: audit; use dead-code-baseline / health-baseline / dupes-baseline instead. | ||
save-baseline | — | Save current results as a baseline file. Rejected with exit 2 when command: audit (audit runs three analyses with incompatible baseline formats). | ||
version | — | Fallow version override. When omitted, the action uses the project package.json fallow dependency spec if present, otherwise latest. | ||
workspace | — | Scope output to one or more workspaces (exact names, globs, ! negation; comma-separated) | ||
changed-workspaces | — | Git-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. | ||
comment | false | Post results as a PR comment | ||
review-comments | false | Post inline PR review comments with typed review-github output and reconcile resolved threads on later runs | ||
annotations | true | Emit findings as inline PR annotations via workflow commands (no Advanced Security required) | ||
max-annotations | 50 | Maximum number of inline annotations to emit | ||
github-token | ${{ github.token }} | GitHub token for PR comments and SARIF upload | ||
dupes-mode | mild | Detection mode for dupes command | ||
min-tokens | — | Minimum token count for a clone (dupes command) | ||
min-lines | — | Minimum line count for a clone (dupes command) | ||
threshold | — | Fail if duplication exceeds this % (dupes command) | ||
skip-local | false | Only report cross-directory duplicates (dupes command) | ||
score | false | Compute health score (0-100 with letter grade). Enables the health delta header in PR comments (health and bare command) | ||
trend | false | Compare current metrics against the most recent saved snapshot. Implies score (health and bare command) | ||
save-snapshot | — | Save vital signs snapshot for trend tracking. Set to true for default path or provide a custom path (health and bare command) | ||
dry-run | true | Preview changes without modifying files (fix command) | ||
coverage | — | Path to Istanbul coverage-final.json for accurate per-function CRAP scores (health and audit commands) | ||
coverage-root | — | Absolute 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-crap | 30.0 | CRAP score threshold (health and audit commands). Functions meeting or exceeding this score contribute to the verdict. | ||
gate | new-only | Audit 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-baseline | — | Per-analysis baseline file paths for the audit command (saved by `fallow dead-code | health | dupes —save-baseline`). Used so pre-existing issues on touched files do not dominate the verdict. |
args | — | Additional arguments to pass to fallow |
GitHub Actions job summary
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.
PR/MR-only analysis
Only analyze files changed in the current pull request or merge request:- GitHub Action
- GitLab CI
- Manual
The action does this automatically via To use a custom ref instead of the PR base SHA:
auto-changed-since (enabled by default). To disable and run a full analysis on PRs:Incremental adoption with baselines
Incremental adoption with baselines
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:2. In your CI workflow, compare against the baseline:Only new issues (not in the baseline) get reported. As your team cleans up existing dead code, periodically regenerate the baseline on
- GitHub Action
- GitLab CI
- Manual
main.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 withunused-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 fileswarn: only warn-tier issues; CI does not failfail: error-tier issues found; CI fails
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.
- GitHub Action
- GitLab CI
- Manual
outputs.verdict (pass/warn/fail) and outputs.gate so downstream steps can branch on the verdict:Migrating from combined to audit
If your project is on the default combined run today and you want severity-aware gating, addcommand: 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:
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.
The three tracks together
CI works best when combined with agent and editor integration:- Agent generates code and runs
fallow --changed-since HEAD~1to self-check - Human reviews in VS Code, sees Code Lens annotations on new exports
- CI runs the full analysis and catches anything that slipped through
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.