Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRepositoryRequired = errors.New("repository is required") ErrNoLinter = errors.New("no linter") )
Functions ¶
func NoReporting ¶
NoReporting will cause the linter to not report any of the lint errors, but the linter will still return an error if any commit doesn't adhere to the linter's expectations.
Types ¶
type CommitLinter ¶
type Linter ¶
type Linter struct {
// Repo is the repository whose commits should be traversed.
Repo *git.Repository
// Rev is the revision of where to start the traversal at. Defaults to HEAD.
Rev plumbing.Revision
// OtherRev is the revision of a commit whose common ancestor the traversal should stop at.
OtherRev plumbing.Revision
// ReportFunc is called after each call to CommitLinter if it returned an error.
ReportFunc ReportFunc
// CommitLinter is called for each commit.
CommitLinter CommitLinter
// StopFunc is called before CommitLinter is called. Determines if the traversal should stop.
StopFunc StopFunc
Logger *slog.Logger
}
type ReportFunc ¶
func SlogReporter ¶
func SlogReporter(logger *slog.Logger) ReportFunc
SlogReporter will log linter errors using log/slog.
type StopFunc ¶
func NoStop ¶
func NoStop() StopFunc
NoStop will cause the linter to never stop. Allows the linter to run until the last commit.
func StopAfterN ¶
StopAfterN will cause the linter to stop after N commits.
func StopAtMergeBases ¶
StopAtMergeBases will cause the linter to stop at any of the merge bases.
Click to show internal directories.
Click to hide internal directories.