Skip to content

Commit a43dd02

Browse files
committed
feat(check): update commit message check message
update commit message check message Signed-off-by: mritd <[email protected]>
1 parent 35a0314 commit a43dd02

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

consts.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ const (
2424
hotfixDesc string = "HOTFIX (Bug fix urgently)"
2525
)
2626

27-
const commitMessagePattern = `^(feat|fix|docs|style|refactor|test|chore|perf|hotfix)\((\S.*)\):\s(\S.*)|^Merge.*`
27+
const commitMessageCheckPattern = `^(feat|fix|docs|style|refactor|test|chore|perf|hotfix)\((\S.*)\):\s(\S.*)|^Merge.*`
2828

29-
const commitMessageCheckFailedTpl = `
30-
######################################################
31-
## ##
32-
## 💔 The commit message is not standardized. ##
33-
## 💔 It must match the regular expression: ##
34-
## ##
35-
## ^(feat|fix|docs|style|refactor|test|chore| ##
36-
## perf|hotfix)\((\S.*)\):\s(\S.*)|^Merge.* ##
37-
## ##
38-
######################################################`
29+
const commitMessageCheckFailedMsg = `
30+
╭──────────────────────────────────────────────────╮
31+
32+
The commit message is not standardized.
33+
It must match the regular expression:
34+
35+
^(feat|fix|docs|style|refactor|test|chore|
36+
perf|hotfix)\((\S.*)\):\s(\S.*)|^Merge.*
37+
38+
╰──────────────────────────────────────────────────╯`

git_wapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ func push() error {
6262
}
6363

6464
func commitMessageCheck(f string) error {
65-
reg := regexp.MustCompile(commitMessagePattern)
65+
reg := regexp.MustCompile(commitMessageCheckPattern)
6666
bs, err := ioutil.ReadFile(f)
6767
if err != nil {
6868
return err
6969
}
7070

7171
msgs := reg.FindStringSubmatch(string(bs))
7272
if len(msgs) != 4 {
73-
return fmt.Errorf(commitMessageCheckFailedTpl)
73+
return fmt.Errorf(commitMessageCheckFailedMsg)
7474
}
7575

7676
return nil

0 commit comments

Comments
 (0)