From 5e74abd1b2560d91647280da8374978763cb3b0f Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 5 Oct 2015 18:55:05 -0400 Subject: [PATCH] *: comments and golint Signed-off-by: Vincent Batts --- main.go | 4 ++++ rules/dco/dco.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index ec022f2..09ac685 100644 --- a/main.go +++ b/main.go @@ -32,11 +32,13 @@ func main() { return } + // reduce the set being run rules := validate.RegisteredRules if *flRun != "" { rules = validate.FilterRules(rules, validate.SanitizeFilters(*flRun)) } + // Guess the commits we're working with var commitrange string if *flCommitRange != "" { commitrange = *flCommitRange @@ -51,11 +53,13 @@ func main() { } } + // collect the entries c, err := git.Commits(commitrange) if err != nil { log.Fatal(err) } + // run them and show results results := validate.Results{} for _, commit := range c { fmt.Printf(" * %s %s ... ", commit["abbreviated_commit"], commit["subject"]) diff --git a/rules/dco/dco.go b/rules/dco/dco.go index b0867ba..75184ed 100644 --- a/rules/dco/dco.go +++ b/rules/dco/dco.go @@ -13,14 +13,17 @@ func init() { } var ( + // ValidDCO is the regexp for signed off DCO ValidDCO = regexp.MustCompile(`^Signed-off-by: ([^<]+) <([^<>@]+@[^<>]+)>$`) - DcoRule = validate.Rule{ + // DcoRule is the rule being registered + DcoRule = validate.Rule{ Name: "DCO", Description: "makes sure the commits are signed", Run: ValidateDCO, } ) +// ValidateDCO is the ValidateRule for a git commit func ValidateDCO(c git.CommitEntry) (vr validate.Result) { vr.CommitEntry = c if len(strings.Split(c["parent"], " ")) > 1 {