vcs-git only.Expand description
Change-history (VCS) metrics derived from version-control history:
churn, commit frequency, author count / ownership dilution, bug- and
security-fix history, and an ordinal composite risk score. See
vcs::build_history_index.
Enable with the vcs Cargo feature (the umbrella over the current
vcs-git backend, which is what the availability badge names).
Change-history (VCS) metrics: per-file signals derived from version
control history rather than the AST.
This is the project’s first metric family that is language-agnostic
and not AST-derived (issue #328). It surfaces files most likely to
harbour bugs or vulnerabilities using the signals the empirical
literature most consistently backs — recent churn, commit frequency,
author count and ownership dilution, bug- and security-fix history —
combined into an ordinal risk_score.
§Layout
The generic surface (error, options, stats, identity,
classify, score, hotspot, jit, and build_history_index)
carries no backend reference, so a future backend (Mercurial,
Jujutsu, …; issue #335) reuses it unchanged. Backend-specific code
lives under the git module behind the vcs-git Cargo feature.
Two scoring granularities are offered: build_history_index ranks
files at a ref (issue #328), while score_commit scores a single
commit for just-in-time defect-induction risk (issue #331).
v1 deliberately omits a Backend trait: with a single backend it
would be premature abstraction. build_history_index delegates to
the one available backend; the trait is extracted when a second
backend lands.
Re-exports§
pub use bus_factor::BUS_FACTOR_SCHEMA_VERSION;pub use bus_factor::BusFactor;pub use bus_factor::DirectoryBusFactor;pub use bus_factor::GroupBusFactor;pub use bus_factor::VcsAggregate;pub use cache::CACHE_SCHEMA_VERSION;pub use cache::CacheConfig;pub use error::Error;pub use identity::AuthorHashKey;pub use jit::JIT_SCHEMA_VERSION;pub use jit::JIT_SCORE_VERSION;pub use jit::JitCommit;pub use jit::JitContributions;pub use jit::JitDiffContributions;pub use jit::JitDiffReport;pub use jit::JitDiffusion;pub use jit::JitExperience;pub use jit::JitFeatures;pub use jit::JitHistory;pub use jit::JitPurpose;pub use jit::JitReport;pub use jit::JitSize;pub use jit::JitSource;pub use options::FileTypeScope;pub use options::Options;pub use options::RiskFormula;pub use options::parse_window;pub use stats::Stats;pub use trend::TREND_SCHEMA_VERSION;pub use trend::Trend;pub use trend::TrendDelta;pub use trend::TrendDeltas;pub use git::BlameSession;pub use git::LineSpan;pub use git::PerFunctionBlame;
Modules§
- bus_
factor - Directory- and repo-level bus factor (a.k.a. truck factor) over a change-history walk, via the Avelino Degree-of-Authorship (DoA) heuristic (issue #332).
- cache
- Persistent change-history cache, keyed by
HEADSHA and repo identity (issue #334). - classify
- Commit-message classification: bug-fix, security-fix, and revert detection via curated keyword regexes.
- entropy
- Shannon-entropy machinery shared by the two process-entropy signals added in issue #330.
- error
- Error type for the change-history (VCS) metrics pipeline.
- git
- The
vcs-gitbackend: agix-powered history walk. - hotspot
- Complexity × churn “hotspot” score (Tornhill; Nagappan & Ball).
- identity
- Canonical author identity and bot-author detection.
- jit
- Just-in-time (commit-level) defect-induction risk scoring (issue #331).
- options
- Configuration for a change-history walk.
- score
- Composite risk-score formulas.
- stats
- Per-file change-history statistics: the public
Statsoutput and the internalAccumulatorthat the backend feeds during a walk. - trend
- Historical metric trend: the change-history (VCS) metrics computed at several points in time, so a consumer can see whether a file’s risk is improving or degrading rather than only its risk now (issue #333).
Structs§
- History
Index - The result of one history walk: per-file
Statskeyed by repository-relative path, plus walk-level metadata.
Functions§
- build_
history_ index - Walk the change history rooted at
rootand build a per-fileHistoryIndex. - build_
history_ index_ cached - Like
build_history_index, but reuse and update the persistent change-history cache perconfig(issue #334). - build_
trend - Sample the change-history metrics at
pointsevenly-spaced moments acrossspan_secs, ending atoptions.as_of(or wall-clock now), building atrend::Trendtime series (issue #333). - parse_
timestamp - Parse an
--as-oftimestamp into Unix seconds. - rank_
by_ risk - Rank
entriesby descending risk score, breaking ties on the file path (ascending), then truncate to the toptop(0= keep all). - score_
commit - Score a single commit for just-in-time defect-induction risk (issue #331).
- score_
diff - Score an arbitrary unified
difffor just-in-time defect-induction risk (issue #580). - workdir_
root - Discover the working-tree root of the repository containing
path.