Documentation
¶
Index ¶
- func FormatAbsChurn(results []ChurnResult, _ model.Options) [][]string
- func FormatAge(results []AgeResult, _ model.Options) [][]string
- func FormatAuthorChurn(results []ChurnResult, _ model.Options) [][]string
- func FormatAuthors(results []AuthorsResult, _ model.Options) [][]string
- func FormatBusFactor(results []BusFactorResult, _ model.Options) [][]string
- func FormatCommunication(results []CommunicationResult, _ model.Options) [][]string
- func FormatCoupling(results []CouplingResult, opts model.Options) [][]string
- func FormatEntityChurn(results []ChurnResult, _ model.Options) [][]string
- func FormatEntityEffort(results []EntityEffortResult, _ model.Options) [][]string
- func FormatEntityOwnership(results []EntityOwnershipResult, _ model.Options) [][]string
- func FormatFragmentation(results []FragmentationResult, _ model.Options) [][]string
- func FormatIdentity(results []model.Commit, _ model.Options) [][]string
- func FormatKnowledgeLoss(results []KnowledgeLossResult, _ model.Options) [][]string
- func FormatMainDev(results []ContributorResult, _ model.Options) [][]string
- func FormatMainDevByRevs(results []ContributorResult, _ model.Options) [][]string
- func FormatRefactoringMainDev(results []ContributorResult, _ model.Options) [][]string
- func FormatRevisions(results []RevisionsResult, _ model.Options) [][]string
- func FormatRework(results []ReworkResult, _ model.Options) [][]string
- func FormatStatistics(results []StatisticsResult, _ model.Options) [][]string
- func FormatSumOfCoupling(results []SumOfCouplingResult, _ model.Options) [][]string
- func FormatSummary(result SummaryResult, _ model.Options) [][]string
- func Identity(commits []model.Commit, _ model.Options) []model.Commit
- type AgeResult
- type AuthorsResult
- type BusFactorResult
- type ChurnResult
- type CommunicationResult
- type ContributorResult
- type CouplingResult
- type EntityEffortResult
- type EntityOwnershipResult
- type FragmentationResult
- type KnowledgeLossResult
- type RevisionsResult
- type ReworkResult
- type StatisticsResult
- type SumOfCouplingResult
- type SummaryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAbsChurn ¶
func FormatAbsChurn(results []ChurnResult, _ model.Options) [][]string
func FormatAuthorChurn ¶
func FormatAuthorChurn(results []ChurnResult, _ model.Options) [][]string
func FormatAuthors ¶
func FormatAuthors(results []AuthorsResult, _ model.Options) [][]string
func FormatBusFactor ¶ added in v1.1.0
func FormatBusFactor(results []BusFactorResult, _ model.Options) [][]string
func FormatCommunication ¶
func FormatCommunication(results []CommunicationResult, _ model.Options) [][]string
func FormatCoupling ¶
func FormatCoupling(results []CouplingResult, opts model.Options) [][]string
func FormatEntityChurn ¶
func FormatEntityChurn(results []ChurnResult, _ model.Options) [][]string
func FormatEntityEffort ¶
func FormatEntityEffort(results []EntityEffortResult, _ model.Options) [][]string
func FormatEntityOwnership ¶
func FormatEntityOwnership(results []EntityOwnershipResult, _ model.Options) [][]string
func FormatFragmentation ¶
func FormatFragmentation(results []FragmentationResult, _ model.Options) [][]string
func FormatKnowledgeLoss ¶ added in v1.1.0
func FormatKnowledgeLoss(results []KnowledgeLossResult, _ model.Options) [][]string
func FormatMainDev ¶
func FormatMainDev(results []ContributorResult, _ model.Options) [][]string
func FormatMainDevByRevs ¶
func FormatMainDevByRevs(results []ContributorResult, _ model.Options) [][]string
func FormatRefactoringMainDev ¶
func FormatRefactoringMainDev(results []ContributorResult, _ model.Options) [][]string
func FormatRevisions ¶
func FormatRevisions(results []RevisionsResult, _ model.Options) [][]string
func FormatRework ¶ added in v1.1.0
func FormatRework(results []ReworkResult, _ model.Options) [][]string
func FormatStatistics ¶
func FormatStatistics(results []StatisticsResult, _ model.Options) [][]string
func FormatSumOfCoupling ¶
func FormatSumOfCoupling(results []SumOfCouplingResult, _ model.Options) [][]string
func FormatSummary ¶
func FormatSummary(result SummaryResult, _ model.Options) [][]string
Types ¶
type AuthorsResult ¶
type BusFactorResult ¶ added in v1.1.0
type ChurnResult ¶
ChurnResult holds added/deleted line totals and distinct commit count for one key. Used by AbsChurn (key=date), AuthorChurn (key=author), and EntityChurn (key=entity).
func AbsChurn ¶
func AbsChurn(commits []model.Commit, _ model.Options) []ChurnResult
AbsChurn returns lines added/deleted aggregated by date.
func AuthorChurn ¶
func AuthorChurn(commits []model.Commit, _ model.Options) []ChurnResult
AuthorChurn returns lines added/deleted aggregated by author.
func EntityChurn ¶
func EntityChurn(commits []model.Commit, _ model.Options) []ChurnResult
EntityChurn returns lines added/deleted aggregated by entity, sorted by added desc.
type CommunicationResult ¶
func Communication ¶
func Communication(commits []model.Commit, _ model.Options) []CommunicationResult
Communication maps team collaboration needs based on shared entities.
Algorithm (mirrors the original Clojure implementation):
- Find distinct authors per entity.
- For each entity, generate all 2-selections (with replacement) of its authors: [A,A], [A,B], [B,A], [B,B] etc.
- Count frequencies across all entities.
- Self-pairs [A,A] give A's total entity count ("total commits").
- Non-self pairs [A,B] give the count of entities both A and B touched ("shared").
- average = ceil((self_A + self_B) / 2)
- strength = int((shared / average) * 100)
type ContributorResult ¶
type ContributorResult struct {
Entity string
Contributor string
Count int
Total int
Ownership float64
}
ContributorResult holds the top contributor per entity and their ownership percentage. Used by MainDev, RefactoringMainDev, and MainDevByRevs.
func MainDev ¶
func MainDev(commits []model.Commit, _ model.Options) []ContributorResult
MainDev returns the author with the most lines added per entity.
func MainDevByRevs ¶
func MainDevByRevs(commits []model.Commit, _ model.Options) []ContributorResult
MainDevByRevs returns the author with the most revisions per entity.
func RefactoringMainDev ¶
func RefactoringMainDev(commits []model.Commit, _ model.Options) []ContributorResult
RefactoringMainDev returns the author with the most lines deleted per entity.
type CouplingResult ¶
type EntityEffortResult ¶
func EntityEffort ¶
func EntityEffort(commits []model.Commit, _ model.Options) []EntityEffortResult
EntityEffort returns revision count per (entity, author) pair.
type EntityOwnershipResult ¶
func EntityOwnership ¶
func EntityOwnership(commits []model.Commit, _ model.Options) []EntityOwnershipResult
EntityOwnership returns churn per (entity, author) pair.
type FragmentationResult ¶
func Fragmentation ¶
func Fragmentation(commits []model.Commit, _ model.Options) []FragmentationResult
Fragmentation calculates the fractal value (author distribution) per entity. fractal = 1 - Σ(author_revs/total_revs)² 0 = single author, approaching 1 = many equal contributors.
type KnowledgeLossResult ¶ added in v1.1.0
type KnowledgeLossResult struct {
Entity string
FormerAdded int
TotalAdded int
Loss float64 // FormerAdded / TotalAdded, as a percentage
}
func KnowledgeLoss ¶ added in v1.1.0
func KnowledgeLoss(commits []model.Commit, opts model.Options) []KnowledgeLossResult
KnowledgeLoss returns, per entity, the share of added lines written by authors in opts.FormerAuthors. Entities with no added lines are skipped.
type RevisionsResult ¶
type ReworkResult ¶ added in v1.1.0
type ReworkResult struct {
Entity string
Added int // judged lines added to the entity
Reworked int // of those, lines removed or rewritten within the window
Ratio float64 // Reworked / Added, as a percentage
}
func Rework ¶ added in v1.1.0
Rework reports, per entity, the share of added lines that were removed or substantially rewritten within opts.ReworkWindow of landing.
commits must be in chronological (oldest-first) order along a single line of history, as produced by
git log --reverse --first-parent --diff-merges=first-parent -p -U0 --no-renames
so that applying each commit's hunks in turn reproduces every file's contents. Rework tracks, for every line, the commit (entity and time) that introduced it. A line counts as:
- added, if it is non-blank and its window has fully elapsed by opts.ReworkTimeNow (younger lines cannot be judged yet, so they are left out of both counts). A merge's first-parent diff counts as landing the merged branch's lines at the merge's time, so merge-commit, squash and rebase workflows are measured alike;
- reworked, if a later commit within the window removes it without that commit re-adding the same text elsewhere (a move, compared ignoring whitespace, even across files) and without replacing it in place with a line at least minEditSimilarity token-similar (a small edit).
A moved or lightly edited line keeps its original provenance, so it is still judged against its original landing time. Lines that predate the analyzed history are untracked and never counted.
type StatisticsResult ¶
type StatisticsResult struct {
Metric string
Count int
Min float64
Q1 float64
Median float64
Q3 float64
Max float64
Mean float64
Stddev float64
}
func Statistics ¶
func Statistics(commits []model.Commit, _ model.Options) []StatisticsResult
Statistics computes descriptive statistics (count/min/q1/median/q3/max/ mean/sample-stddev) for a curated set of core metrics. It intentionally ignores opts: this is a whole-codebase health report, not a filtered query, so none of model.Options' threshold fields (MinRevs, MaxChangesetSize, etc.) apply. Entity/author remapping via -g/-p still applies normally, since runAnalysis rewrites commits before Statistics ever sees them.
type SumOfCouplingResult ¶
func SumOfCoupling ¶
func SumOfCoupling(commits []model.Commit, opts model.Options) []SumOfCouplingResult
SumOfCoupling aggregates coupling counts per entity (how many co-changes it participates in).