fallow health files
Find the format of the snapshot file that fallow health writes for trends, and of the churn file that it reads for history from another VCS.
These are the files that fallow health writes and reads besides its report.
Snapshot file
--save-snapshot writes .fallow/snapshots/<timestamp>.json, or the path that you give. --trend reads the newest file in that directory, and --trend-from reads one file. A snapshot has these fields:
| Field | Content |
|---|---|
snapshot_schema_version | The version of this file format. |
version, timestamp, git_sha, git_branch, shallow_clone | The fallow version, the time and the git state of the run. |
vital_signs, counts | The vital signs and the numbers behind them. |
score, grade, score_formula_version | The health score. A trend compares scores only when the formula versions match. |
coverage_model | The source of the CRAP coverage. |
groups | The metrics of each group, when the run used --group-by. |
analysis_identity | The mode of the analysis, for example syntactic, and its completeness. |
--save-snapshot computes the file scores and the hotspots, so the saved metrics are complete. A trend without a formula version, or with a different version, has no score delta. The other metrics still compare.
With --trend, the output has health_trend:
compared_to: thetimestamp,git_sha,score,gradeandscore_formula_versionof the snapshot.metrics[]: one entry for each metric, withname,label,previous,current,delta,unitanddirection(improving,decliningorstable). A percentage hasprevious_countandcurrent_countwithvalueandtotal.snapshots_loaded, andoverall_direction:improvingwhen more metrics improve than decline,decliningfor the reverse, elsestable.
Without a saved snapshot, the output has no health_trend.
Group trends
With --group-by, --trend and --trend-from also compare each group with the same group key in the snapshot. Save the snapshot with the same --group-by mode. Each group gets trend_status:
compared: the group has atrendobject with the shape ofhealth_trend.new_group: the snapshot has group data, but not for this key.no_group_baseline: the snapshot did not measure this group. When it has no group data for the mode, the run adds atrend-group-baseline-unavailablediagnostic. The project trend still works.
Churn file
--churn-file <PATH> reads the change history from a JSON file, for a project without git. The file feeds --hotspots, --ownership and --targets. When the project also has git, the file wins.
// churn.json
{
"schema": "fallow-churn/v1",
"events": [
{ "path": "src/foo.ts", "timestamp": 1717459200, "author": "dev@corp", "added": 10, "deleted": 5 }
]
}
| Field | Required | Content |
|---|---|---|
path | yes | The path from the repository root, with forward slashes. |
timestamp | yes | The commit time in Unix seconds, UTC. A time more than one year in the future exits with code 2. |
author | no | One stable identity for each person, for example the email. Fallow does not apply a mailmap. |
added, deleted | yes | The changed lines. The hotspot score counts events, so the line counts are only for display. |
commit | no | A commit id. The events with the same id form one commit. Change coupling and change dispersion need it. |
For git, fallow runs git log --numstat --no-merges --no-renames --use-mailmap. A file from another version control system must follow the same rules, else the hotspots and the ownership signals are wrong:
- Leave out merge commits. Else the author of the merge looks like a contributor to each merged file.
- Leave out binary files. Do not write them with
0lines. - Give a renamed file under its new path only, with the real line counts. Do not write a delete of the old path.
- Give one event for each commit and file, with
timestampin seconds.
Fallow ignores other fields. When your version control system records commits under a merge or CI identity, add that identity to health.ownership.botPatterns. Else the bus factor is 1 for each file. An empty events array is valid and gives no hotspots. A file that is not valid stops the run with exit code 2. The file is resolved from --root, and it sets the window, so fallow ignores --since.
The file feeds only the churn sections. --changed-since needs git: use --diff-file or --diff-stdin with a unified diff. fallow audit and fallow impact analyze the base revision again, so they need git.