Skip to content

Commit d441800

Browse files
committed
feat(rule): add skip rules
1 parent 02612a6 commit d441800

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ var (
3636
ErrScope = errors.New("invalid scope error")
3737

3838
DefaultRules = Config{
39+
SkipPrefixes: []string{
40+
"Merge branch ",
41+
},
3942
TypeRules: TypeRules{
4043
{
4144
Type: "feat",
@@ -94,7 +97,8 @@ func (typeRules TypeRules) String() string {
9497
}
9598

9699
type Config struct {
97-
TypeRules TypeRules `yaml:"type_rules"`
100+
SkipPrefixes []string `yaml:"skip_prefixes"`
101+
TypeRules TypeRules `yaml:"type_rules"`
98102
}
99103

100104
type Format struct {
@@ -201,6 +205,11 @@ func run() (string, Config, error) {
201205
if err != nil {
202206
return "", conf, err
203207
}
208+
for _, skipPrefix := range conf.SkipPrefixes {
209+
if strings.HasPrefix(s, skipPrefix) {
210+
return "", conf, nil
211+
}
212+
}
204213

205214
format, err := NewFormat(s)
206215
if err != nil {

0 commit comments

Comments
 (0)