Skip to content

Commit 020f9a7

Browse files
refactor: update DefaultConfToFile
1 parent 956a922 commit 020f9a7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

config/config.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,21 @@ func Validate(conf *lint.Config) error {
115115
// DefaultConfToFile writes default config to given file
116116
func DefaultConfToFile(isOnlyEnabled bool) error {
117117
outPath := filepath.Join(".", filepath.Clean(ConfFileName))
118-
if isOnlyEnabled {
119-
confClone := &lint.Config{
120-
Formatter: defConf.Formatter,
121-
Rules: map[string]lint.RuleConfig{},
122-
}
118+
if !isOnlyEnabled {
119+
return WriteConfToFile(outPath, defConf)
120+
}
123121

124-
for ruleName, r := range defConf.Rules {
125-
if r.Enabled {
126-
confClone.Rules[ruleName] = r
127-
}
128-
}
122+
confClone := &lint.Config{
123+
Formatter: defConf.Formatter,
124+
Rules: map[string]lint.RuleConfig{},
125+
}
129126

130-
return WriteConfToFile(outPath, confClone)
127+
for ruleName, r := range defConf.Rules {
128+
if r.Enabled {
129+
confClone.Rules[ruleName] = r
130+
}
131131
}
132-
return WriteConfToFile(outPath, defConf)
132+
return WriteConfToFile(outPath, confClone)
133133
}
134134

135135
// WriteConfToFile util func to write config object to given file

0 commit comments

Comments
 (0)