From cb8f88ffbfc09d0114db491dd68eba250ae941ec Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 15 Nov 2017 11:59:18 -0500 Subject: [PATCH] shortsubject: merge commits may be long due to automated "merge of in to " Signed-off-by: Vincent Batts --- rules/shortsubject/shortsubject.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rules/shortsubject/shortsubject.go b/rules/shortsubject/shortsubject.go index 2aff131..8fd0336 100644 --- a/rules/shortsubject/shortsubject.go +++ b/rules/shortsubject/shortsubject.go @@ -1,6 +1,8 @@ package shortsubject import ( + "strings" + "github.com/vbatts/git-validation/git" "github.com/vbatts/git-validation/validate" ) @@ -22,6 +24,11 @@ func init() { // ValidateShortSubject checks that the commit's subject is strictly less than // 90 characters (preferably not more than 72 chars). func ValidateShortSubject(r validate.Rule, c git.CommitEntry) (vr validate.Result) { + if len(strings.Split(c["parent"], " ")) > 1 { + vr.Pass = true + vr.Msg = "merge commits do not require length check" + return vr + } if len(c["subject"]) >= 90 { vr.Pass = false vr.Msg = "commit subject exceeds 90 characters"