Skip to content

Commit 5c26aae

Browse files
refactor(config): move registry methods to registry.go
1 parent 957a75c commit 5c26aae

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

config/lint.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ import (
66
"github.com/conventionalcommit/commitlint/lint"
77
)
88

9-
// RegisterRule registers a custom rule
10-
// if rule already exists, returns error
11-
func RegisterRule(rule lint.Rule) error {
12-
return globalRegistry.RegisterRule(rule)
13-
}
14-
15-
// RegisterFormatter registers a custom formatter
16-
// if formatter already exists, returns error
17-
func RegisterFormatter(format lint.Formatter) error {
18-
return globalRegistry.RegisterFormatter(format)
19-
}
20-
219
// GetLinter returns Linter for given confFilePath
2210
func GetLinter(conf *lint.Config) (*lint.Linter, error) {
2311
rules, err := GetEnabledRules(conf)

config/registry.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ import (
99

1010
var globalRegistry = newRegistry()
1111

12+
// RegisterRule registers a custom rule
13+
// if rule already exists, returns error
14+
func RegisterRule(rule lint.Rule) error {
15+
return globalRegistry.RegisterRule(rule)
16+
}
17+
18+
// RegisterFormatter registers a custom formatter
19+
// if formatter already exists, returns error
20+
func RegisterFormatter(format lint.Formatter) error {
21+
return globalRegistry.RegisterFormatter(format)
22+
}
23+
1224
type registry struct {
1325
mut *sync.Mutex
1426

0 commit comments

Comments
 (0)