Skip to content

Commit df61470

Browse files
committed
chore: merge validateEnabledDisabledLintersConfig with Validate
1 parent cf975a4 commit df61470

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pkg/lint/lintersdb/validator.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ func (v Validator) Validate(cfg *config.Config) error {
2424
return err
2525
}
2626

27-
return v.validateEnabledDisabledLintersConfig(&cfg.Linters)
28-
}
29-
30-
func (v Validator) validateEnabledDisabledLintersConfig(cfg *config.Linters) error {
3127
validators := []func(cfg *config.Linters) error{
3228
v.validateLintersNames,
3329
v.validatePresets,
3430
}
3531

3632
for _, v := range validators {
37-
if err := v(cfg); err != nil {
33+
if err := v(&cfg.Linters); err != nil {
3834
return err
3935
}
4036
}

pkg/lint/lintersdb/validator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var validatePresetsTestCases = []validatorTestCase{
106106
},
107107
}
108108

109-
func TestValidator_validateEnabledDisabledLintersConfig(t *testing.T) {
109+
func TestValidator_Validate(t *testing.T) {
110110
m, err := NewManager(nil, nil, NewLinterBuilder())
111111
require.NoError(t, err)
112112

@@ -121,13 +121,13 @@ func TestValidator_validateEnabledDisabledLintersConfig(t *testing.T) {
121121
t.Run(test.desc, func(t *testing.T) {
122122
t.Parallel()
123123

124-
err := v.validateEnabledDisabledLintersConfig(test.cfg)
124+
err := v.Validate(&config.Config{Linters: *test.cfg})
125125
require.NoError(t, err)
126126
})
127127
}
128128
}
129129

130-
func TestValidator_validateEnabledDisabledLintersConfig_error(t *testing.T) {
130+
func TestValidator_Validate_error(t *testing.T) {
131131
m, err := NewManager(nil, nil, NewLinterBuilder())
132132
require.NoError(t, err)
133133

@@ -142,7 +142,7 @@ func TestValidator_validateEnabledDisabledLintersConfig_error(t *testing.T) {
142142
t.Run(test.desc, func(t *testing.T) {
143143
t.Parallel()
144144

145-
err := v.validateEnabledDisabledLintersConfig(test.cfg)
145+
err := v.Validate(&config.Config{Linters: *test.cfg})
146146
require.Error(t, err)
147147

148148
require.EqualError(t, err, test.expected)

0 commit comments

Comments
 (0)