Skip to content

Commit d4b960a

Browse files
fix(config)!: remove Validate in GetConfig
1 parent 8038687 commit d4b960a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

config/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const (
1818
DefaultFile = "commitlint.yaml"
1919
)
2020

21-
// GetConfig returns parses config file, validate it and returns config instance
21+
// GetConfig gets the config according to precedence
22+
// if needed parses config file and returns config instance
2223
func GetConfig(confPath string) (*lint.Config, error) {
2324
confFilePath, useDefault, err := getConfigPath(confPath)
2425
if err != nil {
@@ -34,9 +35,8 @@ func GetConfig(confPath string) (*lint.Config, error) {
3435
return nil, err
3536
}
3637

37-
err = Validate(conf)
38-
if err != nil {
39-
return nil, fmt.Errorf("config: %w", err)
38+
if conf.Formatter == "" {
39+
return nil, errors.New("conf error: formatter is empty")
4040
}
4141
return conf, nil
4242
}
@@ -82,7 +82,7 @@ func Parse(confPath string) (*lint.Config, error) {
8282
return conf, nil
8383
}
8484

85-
// Validate parses Config from given data
85+
// Validate validates given config
8686
func Validate(conf *lint.Config) error {
8787
if conf.Formatter == "" {
8888
return errors.New("formatter is empty")

0 commit comments

Comments
 (0)