Long file
What a long-file finding of fallow health means, why it matters and how to fix it.
What it reports
File has more lines than the file-length threshold.
Health explains how fallow finds it.
Why it matters
A long file is slow to review and to search. More changes touch the same file, so merge conflicts happen more often.
Example
A module grew to 900 physical lines while health.maxFileLines is 500. Blank lines and comment lines count; a final newline does not add a line.
Fix
Move cohesive groups of exports into their own modules, and remove unused code. In fallow audit, a long file that did not grow stays inherited, so you can enable the threshold on an existing project and stop further growth. To report these findings without a failed run, set the complexity-file-lines rule to warn. To raise the ceiling for generated files, use thresholdOverrides[].maxFileLines.
Facts
| Fact | Value |
|---|---|
| Issue type | long-file |
| Rule id in SARIF output | fallow/long-file |
| Command | fallow health |
| Default severity | error |
Config key in rules | complexity-file-lines |
| Filter option | --complexity |
| Suppression comment | // fallow-ignore-file complexity |
Fixable with fallow fix | No |
| Opt-in | No |
When to keep the code
- Generated files: set
maxFileLinesto0for them in ahealth.thresholdOverridesentry withfiles. - To hide one file, put
// fallow-ignore-file complexityat the top. This comment also hides the function findings of the file.