mirror of
https://github.com/vbatts/git-validation.git
synced 2024-11-25 09:35:40 +00:00
shortsubject: merge commits may be long
due to automated "merge of <hash> in to <hash>" Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
90191a015b
commit
cb8f88ffbf
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package shortsubject
|
package shortsubject
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/vbatts/git-validation/git"
|
"github.com/vbatts/git-validation/git"
|
||||||
"github.com/vbatts/git-validation/validate"
|
"github.com/vbatts/git-validation/validate"
|
||||||
)
|
)
|
||||||
|
@ -22,6 +24,11 @@ func init() {
|
||||||
// ValidateShortSubject checks that the commit's subject is strictly less than
|
// ValidateShortSubject checks that the commit's subject is strictly less than
|
||||||
// 90 characters (preferably not more than 72 chars).
|
// 90 characters (preferably not more than 72 chars).
|
||||||
func ValidateShortSubject(r validate.Rule, c git.CommitEntry) (vr validate.Result) {
|
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 {
|
if len(c["subject"]) >= 90 {
|
||||||
vr.Pass = false
|
vr.Pass = false
|
||||||
vr.Msg = "commit subject exceeds 90 characters"
|
vr.Msg = "commit subject exceeds 90 characters"
|
||||||
|
|
Loading…
Reference in a new issue