commentage

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "commentage",
	Doc:      "collect details on age(eg, time, commits) of comments and associated code",
	Run:      run,
	Requires: []*analysis.Analyzer{inspect.Analyzer},
}

Functions

This section is empty.

Types

type CommitStats

type CommitStats struct {
	LastCommit       string
	DocLastCommit    string
	DocBehindCommits int
}

CommitStats is commits related statistics of function and associated doc comment.

func (CommitStats) String

func (s CommitStats) String() string

func (CommitStats) StringVerbose

func (s CommitStats) StringVerbose() string

type FunctionStats

type FunctionStats struct {
	Name string

	*TimeStats
	*CommitStats
}

FunctionStats is container for function and associated doc comment statistics.

func (FunctionStats) String

func (s FunctionStats) String() string

func (FunctionStats) StringVerbose

func (s FunctionStats) StringVerbose() string

type GitProider

type GitProider interface {
	CommitForLine(filename string, line int) (string, error)
	LastUpdateForLine(filename string, line int) (time.Time, error)
	NumCommitsFromRoot(commit string) (int, error)
}

type SimpleStatsComputer

type SimpleStatsComputer struct {
	GitProider GitProider
}

func (SimpleStatsComputer) CommitDifference

func (s SimpleStatsComputer) CommitDifference(filename string, fromLineStart, fromLineEnd, toLineStart, toLineEnd int) (int, error)

func (SimpleStatsComputer) CommmentLastUpdatedAt

func (s SimpleStatsComputer) CommmentLastUpdatedAt(filename string, lineStart int, lineEnd int) (time.Time, error)

func (SimpleStatsComputer) FunctionLastUpdatedAt

func (s SimpleStatsComputer) FunctionLastUpdatedAt(filename string, lineStart int, lineEnd int) (time.Time, error)

func (SimpleStatsComputer) LastCommitForRange

func (s SimpleStatsComputer) LastCommitForRange(filename string, lineStart int, lineEnd int) (string, error)

LastCommitForRange selects commit for last updated line. Not using true ordering of commits, since it is computationally prohibitive.

type TimeStats

type TimeStats struct {
	LastUpdatedAt    time.Time
	DocLastUpdatedAt time.Time
}

TimeStats is time related statistics of function and associated doc comment.

func (TimeStats) DocLastUpdatedBehind added in v1.1.0

func (s TimeStats) DocLastUpdatedBehind() time.Duration

func (TimeStats) String

func (s TimeStats) String() string

func (TimeStats) StringVerbose

func (s TimeStats) StringVerbose() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL