commitstats

package
v0.21.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitStats

type CommitStats struct {
	// Files add/modified/removed by this commit.
	Files int
	// Code stats of the code lines.
	Code KindStats
	// Comment stats of the comment lines.
	Comment KindStats
	// Blank stats of the blank lines.
	Blank KindStats
	// Other stats of files that are not from a recognized or format language.
	Other KindStats
	// Total the sum of the previous stats.
	Total KindStats
}

CommitStats represents the stats for a commit.

func Calculate

func Calculate(r *git.Repository, from, to *object.Commit) (*CommitStats, error)

Calculate calculates the CommitStats for from commit to another. if from is nil the first parent is used, if the commit is orphan the stats are compared against a empty commit.

func (*CommitStats) Add

func (s *CommitStats) Add(stats *CommitStats)

Add adds the given stats to this stats.

func (*CommitStats) String

func (s *CommitStats) String() string

type KindStats

type KindStats struct {
	// Additions number of lines added.
	Additions int
	// Deletions number of lines deleted.
	Deletions int
}

KindStats represents the stats for a kind of lines in a file.

func (*KindStats) Add

func (k *KindStats) Add(add KindStats)

Add adds the given stats to this stats.

type LineInfo

type LineInfo struct {
	Kind  LineKind
	Count int
}

LineInfo represents the information about a sigle line.

type LineKind

type LineKind int

LineKind defines the kind of a line in a file.

const (
	// Code represents a line of code.
	Code LineKind = iota + 1
	// Comment represents a line of comment.
	Comment
	// Blank represents an empty line.
	Blank
	// Other represents a line from any other kind.
	Other
)

Jump to

Keyboard shortcuts

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