mirror of
https://github.com/vbatts/git-validation.git
synced 2025-06-02 18:12:28 +00:00
message_regexp: regular expression rule for messages
Fixes: #30 now you can add a regular expression to the rules to be run i.e. `git-validation -run "dco,message_regexp='^JIRA-[0-9]+ [A-Z].*$'"` Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
d9bf419b44
commit
00823a324b
8 changed files with 89 additions and 10 deletions
|
@ -11,6 +11,7 @@ var (
|
|||
Name: "short-subject",
|
||||
Description: "commit subjects are strictly less than 90 (github ellipsis length)",
|
||||
Run: ValidateShortSubject,
|
||||
Default: true,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -20,7 +21,7 @@ func init() {
|
|||
|
||||
// ValidateShortSubject checks that the commit's subject is strictly less than
|
||||
// 90 characters (preferably not more than 72 chars).
|
||||
func ValidateShortSubject(c git.CommitEntry) (vr validate.Result) {
|
||||
func ValidateShortSubject(r validate.Rule, c git.CommitEntry) (vr validate.Result) {
|
||||
if len(c["subject"]) >= 90 {
|
||||
vr.Pass = false
|
||||
vr.Msg = "commit subject exceeds 90 characters"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue