Module code_age
Expand description
Code age analysis — entity → time since last modification.
Reference date is opts.age_time_now if set, else today (UTC).
§What’s emitted (modern default)
For each file (or canonical-lineage entity under --use-canonical-lineage),
the analysis emits:
path— the entity identifierage_months— whole calendar months between the latest qualifying commit and the anchor date (interval-month semantics: Mar 15 → Apr 1 = 0 months, not 1 — see inline SQL comment below)age_days— whole days between the latest qualifying commit and the anchor — finer-grained precision than code-maat’s months-only output, useful for sort tie-breaking and recency triagelast_modified— calendar date of the latest qualifying commit (context column — helps the operator see WHEN rather than just HOW LONG AGO)
Code-maat emits only entity, age-months. We add the extra columns
because they cost nothing at query time and answer follow-up
questions (“how recently?”, “is this a stale stale or a fresh stale?”)
without re-running the analysis.
§Anchor-date filter
--age-time-now lets the operator anchor the “now” used by the age
calculation. To make the back-test pattern (--age-time-now <past>)
return historically-faithful results, the SQL filters out commits
whose date is AFTER the anchor — same semantics as code-maat’s
changes-within-time-span. Without this filter the back-test
returned NEGATIVE ages for files modified between the anchor and
today, which is meaningless output.
Research basis: see docs/research-foundations.md entry “code-age”
(inspired by Dan North’s “short software half-life” talk;
quantitative analysis in Tornhill, Your Code as a Crime Scene,
2015).