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 {