Global options
Find the options that the bare fallow run and the analysis commands share, with the rules for paths, gates and request outcomes.
These options set the project root, the config file, the output format, the scope and the gates of a run. Most commands exit with code 2 when they get an option that they do not use.
Options
Project
| Option | Description |
|---|---|
-r, --root <ROOT> | Project root directory |
-c, --config <CONFIG> | Path to config file (.fallowrc.json, .fallowrc.jsonc, fallow.toml, or .fallow.toml) |
--allow-remote-extends | Allow trusted config files to extend HTTPS URLs |
--churn-file <PATH> | Import change history from a fallow-churn/v1 JSON file instead of git log, powering hotspots, ownership, and bus-factor on projects with no git repository (Yandex Arc, Mercurial, Perforce). A small wrapper translates your VCS log into the contract. |
Output
| Option | Default | Description |
|---|---|---|
-f, --format <FORMAT> (alias --output <FORMAT>) | human | Output format (alias: --output). Values: human, json, sarif, compact, markdown (alias md), codeclimate (alias gitlab-codequality, gitlab-code-quality), pr-comment-github, pr-comment-gitlab, review-github, review-gitlab, badge, github-annotations, github-summary. |
--pretty | Indent JSON output for manual inspection. Requires the final output format to be JSON | |
--lean | Trim the JSON of dead-code, health and the combined report for agent context: leave out empty arrays and zero dead-code summary counts, group workspace diagnostics, cap health tables, and move repeated action text to _meta.actions. Other commands and other output formats exit with code 2. | |
--full-tables | With --lean, keep every row of the health tables (hotspots, file_scores, large_functions) | |
-q, --quiet | Suppress progress output; audit also prints only actionable findings | |
--group-by <GROUP_BY> | Group output by owner or by directory. Values: owner (alias team, codeowner), directory, package (alias workspace, pkg), section (alias gl-section). | |
--group <KEY> | Keep only the matching groups of a --group-by health run. Accepts exact group keys, glob patterns, and !-prefixed negations. | |
--explain | Include metric definitions and rule descriptions in output | |
--explain-skipped | Show per-pattern counts for skipped files: default duplicate ignores on dupes and audit, built-in discovery ignores on check, dead-code, audit and the default run | |
--summary | Show only category counts without individual items | |
--sarif-file <PATH> | Write SARIF output to a file (in addition to the primary --format output). Used by bare fallow, dead-code, architecture and security. | |
-o, --output-file <PATH> | Write the report to a file instead of stdout, for any --format (no ANSI codes). Useful on large projects where the terminal scrollback truncates the top. | |
--report-path-prefix <PREFIX> (alias --annotations-path-prefix <PREFIX>) | Prefix prepended to every path in the CI-facing formats (github-annotations, github-summary, codeclimate, pr-comment-github, pr-comment-gitlab, review-github, review-gitlab). CI platforms address files by repository-root-relative path, so when the analyzed project lives in a subdirectory (e.g. packages/app/), paths need that offset. fallow detects the offset via the git toplevel automatically; this flag overrides the detection. | |
--show-cascade | Also report the unused exports, types, class members and enum members of unused files. By default the report hides them, because deleting the file removes them, and counts them in cascade_hidden |
Scope
| Option | Description |
|---|---|
--changed-since <CHANGED_SINCE> (alias --base <CHANGED_SINCE>) | Only report issues in files changed since this git ref (e.g., main, HEAD~5). For this run, the ref replaces the per-package refs of workspaces.changedSince in the config. |
--no-package-baselines | Ignore the per-package refs of workspaces.changedSince for this run. Every workspace package is then analyzed in full scope, for example to save or gate a whole-project baseline. |
--diff-file <PATH> | Unified diff for line-level scoping. Use - to read from stdin. |
--diff-stdin | Read the unified diff from stdin. Equivalent to --diff-file - |
--max-file-size <MB> | Skip source files larger than this many megabytes (default 5) instead of parsing them, guarding against the out-of-memory blowup a single multi-MB generated/vendored/bundled file causes on large repos. Use 0 for no limit. |
--production, --no-production | Production mode: exclude test/story/dev files, only start/build scripts, report type-only dependencies |
-w, --workspace <WORKSPACE> | Scope output to selected workspaces. Accepts exact names, glob patterns, and !-prefixed negations. |
--changed-workspaces <REF> | Scope output to workspaces touched since the given git ref. Git is required. |
--include-entry-exports | Report unused exports in entry files instead of auto-marking them as used |
Baselines
| Option | Description |
|---|---|
--baseline <BASELINE> | Compare against a previously saved baseline file. Used by bare fallow, dead-code, architecture, dupes and health; other subcommands reject it. |
--baseline-mode <BASELINE_MODE> | How --baseline matches health findings: per file and category (count, the default) or per function identity (identity, strict, and only against a baseline that was saved with --baseline-mode identity; such a baseline still reads in count mode). A finding's identity is its file path plus its function name, so renaming or moving a function that is still in the baseline reports it as new. Defaults to count when omitted. |
--save-baseline <SAVE_BASELINE> | Save the current results as a baseline file. Used by bare fallow, dead-code, architecture, dupes and health; other subcommands reject it. |
--no-baseline | Ignore the baseline files that the baselines config section names (and audit.*Baseline on fallow audit) for this run, so the report shows every finding. A baseline file flag cannot be given together with it. |
--regression-baseline <PATH> | Path to the regression baseline file |
--save-regression-baseline <PATH> | Save the current issue counts as a regression baseline. Omit PATH to update regression.baseline in the discovered fallow config, or create .fallowrc.json when none exists. |
Gates
| Option | Default | Description |
|---|---|---|
--ci | CI mode: equivalent to --format sarif --fail-on-issues --quiet | |
--fail-on-issues | Exit 1 on issues, also where the default is 0: dupes, and bare fallow in the json, sarif, codeclimate, GitHub, comment and review formats | |
--fail-on-regression | Fail if issue count increased beyond tolerance compared to a regression baseline. With list --entry-weight, fail when the eager source bytes of an entry grew beyond the tolerance. | |
--fail-on-stale-baseline | Exit with code 1 if a loaded --baseline has entries that match nothing in this run. Stricter than the default advisory warning: any stale entry fails, not just a quarter of the baseline. | |
--fail-on-baseline-growth | Exit with code 1 if a loaded baseline has a key that the same file at the base ref does not have. Makes a committed baseline shrink-only. | |
--baseline-base <REF> | The git ref that --fail-on-baseline-growth compares the baseline with. Defaults to the fallow audit base resolution. | |
--fail-on-parse-error | Exit with code 1 if fallow could not parse a source file cleanly. Arms the parse-error gate: a file with a source-parse-degraded or source-nesting-too-deep entry in workspace_diagnostics[] fails the run, and the gate entry in gate_outcomes["parse-error"] names each such file. Off by default, because the parser also rejects valid syntax that is newer than the parser. | |
--tolerance <TOLERANCE> | 0 | Allowed issue count increase before a regression is flagged. With list --entry-weight, the value is the allowed growth of eager source bytes per entry: a byte count such as 1024, or a percentage such as 5%. |
Duplication
| Option | Description |
|---|---|
--dupes-mode <DUPES_MODE> | Override duplication detection mode in combined mode. Values: strict, mild, weak, semantic. |
--dupes-near | Enable function-scoped near-miss clone detection in combined mode |
--dupes-threshold <DUPES_THRESHOLD> | Override duplication threshold in combined mode |
--dupes-min-tokens <DUPES_MIN_TOKENS> | Override the minimum token count for clones in combined mode |
--dupes-min-lines <DUPES_MIN_LINES> | Override the minimum line count for clones in combined mode |
--dupes-min-occurrences <DUPES_MIN_OCCURRENCES> | Override the minimum clone occurrences in combined mode (must be >= 2) |
--dupes-skip-local | Only report cross-directory duplicates in combined mode |
--dupes-cross-language | Enable cross-language duplicate detection in combined mode |
--dupes-ignore-imports | Exclude module wiring from duplicate detection in combined mode (default). Pass --dupes-no-ignore-imports to count it again |
--dupes-no-ignore-imports | Count module wiring as clone candidates in combined mode (opt out of the default exclusion) |
--dupes-ignore-symlinks | Omit clone instances whose path is a symlink, or lies under a symlinked directory, in combined mode |
--dupes-no-ignore-symlinks | Report symlinked clone instances in combined mode (opt out of a config duplicates.ignoreSymlinks: true) |
Type-aware
| Option | Description |
|---|---|
--type-aware, --no-type-aware | Opt in to TypeScript semantic analysis for project-wide symbol evidence. This does not emit compiler diagnostics or typed lint findings |
--type-aware-project <PATH> | TypeScript project config to use for type-aware analysis (repeatable) |
--type-aware-require <TYPE_AWARE_REQUIRE> | Decide whether incomplete type-aware analysis is advisory or gating. Values: best-effort, complete. |
Performance
| Option | Description |
|---|---|
--no-cache | Disable incremental caching |
--threads <THREADS> | Number of parser threads |
--performance | Show pipeline performance timing breakdown |
The environment variables set the defaults of some options, for example FALLOW_FORMAT and FALLOW_QUIET.
Option details
Lean JSON
Only fallow dead-code, fallow health and the bare fallow run accept --lean, and only with JSON output. Another command, for example fallow dupes or fallow audit, exits with code 2. A run without --format json exits with code 2 too.
Scope rules
--changed-sincereports only the findings in the files that changed since the git ref. Each command applies it in its own way: Changed code explains the scope of a run.--diff-fileand--diff-stdinkeep only the findings on added lines. A finding that covers more than one file, for example a cycle, stays when the diff touches one of its files. Findings inpackage.jsonand other project files stay in the report.- A path argument (
fallow health src/api) and--workspacenarrow only the report. Fallow still builds the graph of the whole project. A path outside the project root exits with code 2. --workspaceand--changed-workspacestogether exit with code 2.--changed-workspaceswith a ref that git cannot resolve exits with code 2.
Gate rules
A gate makes the run exit with code 1. The gate options are --fail-on-issues, --ci, --fail-on-regression, --fail-on-stale-baseline, --fail-on-baseline-growth and --fail-on-parse-error. The JSON output names the result of each gate in gate_outcomes.
Parse error gate
--fail-on-parse-error, or failOnParseError: true in the config file, exits with code 1 when fallow cannot parse a source file. The gate counts each file with a source-parse-degraded or source-nesting-too-deep entry in workspace_diagnostics. gate_outcomes["parse-error"].files names each file. The gate works with dead-code, architecture, health, audit and the bare run. fallow audit checks each file that it parsed, also the files that the change did not touch.
Baseline growth gate
--fail-on-baseline-growth exits with code 1 when a loaded baseline has a key that the same file at the base ref does not have. A committed baseline can then only shrink.
--baseline-base <REF>sets the base ref. The default is the base offallow audit.- A baseline that the base ref does not have passes, with a note.
- A base ref that git cannot resolve exits with code 2, for example in a shallow clone. A default base that resolves to
HEADalso exits with code 2. - The result is
gate_outcomes["baseline-growth"], with the number of new keys inobserved.
Output files
--save-baseline, --save-regression-baseline, --save-snapshot, --output-file and --sarif-file write only inside these directories:
- the project root, and its git work tree when the working directory is inside it
GITHUB_WORKSPACEandCI_PROJECT_DIR, when they are setRUNNER_TEMPand the system temp directory
Another path exits with code 2 before the analysis runs. A device such as /dev/null or /dev/stdout is always allowed. --sarif-file works with dead-code, architecture, security and a bare run that includes dead code. With another command, use --format sarif --output-file.
Quiet runs
--quiet, --ci and FALLOW_QUIET hide the progress output and the stderr warnings that repeat a workspace_diagnostics entry. The JSON output does not change. The gate lines and the config warnings still print. fallow audit also prints a shorter report.
Production mode for one analysis
--production-dead-code, --production-health and --production-dupes turn on production mode for one analysis. Only the bare run and fallow audit accept them. Fallow takes the first value that it finds in this order:
- the options
--productionand--production-<analysis> - the environment variables
FALLOW_PRODUCTION_DEAD_CODE,FALLOW_PRODUCTION_HEALTHandFALLOW_PRODUCTION_DUPES - the environment variable
FALLOW_PRODUCTION - the
productionkey of the config file
--productionand the options--production-<analysis>can only turn production mode on.--no-productionturns production mode off for each analysis. It wins over the environment variables and the config file. You cannot use it together with--production.- The environment variables and the config file can turn production mode on or off.
- A command such as
fallow dead-coderejects--production-dead-code, but it readsFALLOW_PRODUCTION_DEAD_CODE. For one command, pass--productionor set the variable of the analysis.
# Health on production code, dead code and duplication on all code
fallow --production-health
# The same in a CI template that can set only environment variables
FALLOW_PRODUCTION=false FALLOW_PRODUCTION_HEALTH=true fallow
# Production mode for each analysis, whatever the variables say
fallow --production
# No production mode, also when the config file sets "production": true
fallow --no-production
production.ignore adds paths that only production mode leaves out. The globs apply to each analysis that runs in production mode, also when an option or a variable turns the mode on.
Production code that a pattern leaves out
The built-in test patterns, such as **/test/**, can match production source, for example src/runner/test/case.ts. Production mode then does not analyze the file, so an export or a parameter that only this file uses can show as a finding. When an analyzed file imports such a file, fallow writes a warning on stderr. This includes an import of a workspace package whose entry file a pattern leaves out. The JSON output has one production-excluded-file-imported entry in workspace_diagnostics for each pattern:
{
"path": "src/runner/test/case.ts",
"kind": "production-excluded-file-imported",
"pattern": "**/test/**",
"file_count": 1,
"files": ["src/runner/test/case.ts"],
"message": "The production pattern '**/test/**' excluded 1 file that production code imports: src/runner/test/case.ts. Fallow does not analyze these files in production mode, so an export or a parameter that only they use can be reported. Move the files out of the matched path, or turn production mode off for dead code with --no-production or `production: { deadCode: false }` in the config.",
"degrades_analysis": true
}
| Field | Value |
|---|---|
pattern | The built-in glob that left out the files. |
file_count | The number of left-out files that analyzed code imports. |
files | At most five of these files, relative to the project root. |
degrades_analysis | true: the findings can be less complete. |
A ! exception in ignorePatterns cannot bring back such a file. Move the file out of the matched path, or turn production mode off for that analysis.
Grouped output
--group-by splits the findings into groups. These are the values:
| Value | Group key |
|---|---|
owner | The first owner of the file in CODEOWNERS, .github/CODEOWNERS, .gitlab/CODEOWNERS or docs/CODEOWNERS. The codeowners config key sets another path. |
directory | The first path segment, for example src. |
package | The workspace package. |
section | The [Section] header of a GitLab CODEOWNERS file. Headers with the same name, compared without case, form one group with the name of the first header. Each group also has an owners array: the default owners of all its headers, in file order. |
The json, human, sarif and codeclimate formats show the groups. The JSON output has a grouped_by field and a groups array. For dead-code and architecture, the kind changes to dead-code-grouped and architecture-grouped. The other formats print one report and a note on stderr. fallow flags ignores the option.
Cache
Fallow keeps the parse results of each file in .fallow/ and parses only the files that changed. --no-cache parses each file again. cache.dir in the config file or FALLOW_CACHE_DIR moves the cache. --performance shows the time of each step and the cache hits.
Output
Each command page describes the output of that command. The options on this page add the parts below.
Loaded config file
In the human format, fallow prints the config file that it loaded on stderr, for example loaded config: /repo/.fallowrc.json. --quiet and the other formats hide the line. fallow config shows the merged config.
Request outcomes
When a run cannot apply --changed-since, a diff or --sarif-file, it continues and keeps its exit code. The JSON output then names the result in a request_outcomes object, keyed by request:
{
"request_outcomes": {
"changed-since": {
"status": "not-applied",
"affects": "scope",
"requested": "main",
"reason": "not-a-repository",
"message": "--changed-since 'main' was ignored because not a git repository, so this report covers the whole project instead of the changed files. Run fallow from inside the repository, or drop --changed-since."
}
}
}
| Member | Content |
|---|---|
status | applied, or not-applied when the run could not do the request. |
affects | scope: the report is wider than you asked. artifact: the run wrote no file. |
requested | The value as you wrote it. |
scope_size | How much the request left in scope, when the run measured it. changed-since counts the changed files that the run analyzed, diff-filter counts the added lines, plus one for each touched file that adds no line (a pure rename). 0 means that nothing was in scope. |
reason | A kebab-case token. Present only when status is not applied. |
message | The fix, the same text as on stderr. Present only when status is not applied. |
| Request | Asked by | affects | reason values |
|---|---|---|---|
changed-since | --changed-since, --base | scope | git-missing, not-a-repository, git-failed |
diff-filter | --diff-file, --diff-stdin, FALLOW_DIFF_FILE | scope | oversize, unreadable, not-utf8, foreign-namespace, ambiguous-base |
sarif-file | --sarif-file | artifact | directory-create-failed, write-failed, serialize-failed |
An absent object means that the run received no request. The set of names and values is open: read an unknown value as "not applied". fallow audit has no request_outcomes, because it exits with code 2 when its base ref does not resolve.
Exit codes
| Code | Meaning |
|---|---|
0 | No enforced gate failed. |
1 | An enforced gate failed. |
2 | Invalid input, for example an option that the command does not use, a path outside the project root, or --workspace together with --changed-workspaces. |
Exit codes has the codes of each command.
Examples
# Report only the findings in the files that changed since main, as JSON
fallow dead-code --changed-since main --format json --quiet
# Group the health findings by the first directory of each path
fallow health --group-by directory
# Write an indented JSON report to a file
fallow dead-code --format json --pretty --output-file fallow-results.json
Related
- The CLI: the commands, the output formats and the bare run.
- Exit codes: the meaning of each exit code.
- Environment variables: the defaults that the environment sets.