Skip to content

Commit c5e4f67

Browse files
authored
Merge pull request #30 from butuzov/wasterd-regexp
fix: wasted regexp
2 parents f391143 + bcb2113 commit c5e4f67

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

config/config.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,32 @@ func WithOptions(options ...Option) *Config {
4444

4545
func WithIgnoredFunctions(excludes string) Option {
4646
return func(config *Config) {
47-
if excludes == "" {
48-
return
49-
}
50-
5147
for _, exclude := range strings.Split(excludes, ",") {
48+
if exclude == "" {
49+
continue
50+
}
5251
config.IgnoredFunctions = append(config.IgnoredFunctions, regexp.MustCompile(exclude))
5352
}
5453
}
5554
}
5655

5756
func WithIgnoredFiles(excludes string) Option {
5857
return func(config *Config) {
59-
if excludes == "" {
60-
return
61-
}
62-
6358
for _, exclude := range strings.Split(excludes, ",") {
59+
if exclude == "" {
60+
continue
61+
}
6462
config.IgnoredFiles = append(config.IgnoredFiles, regexp.MustCompile(exclude))
6563
}
6664
}
6765
}
6866

6967
func WithIgnoredNumbers(numbers string) Option {
7068
return func(config *Config) {
71-
if numbers == "" {
72-
return
73-
}
74-
7569
for _, number := range strings.Split(numbers, ",") {
70+
if number == "" {
71+
continue
72+
}
7673
config.IgnoredNumbers[config.removeDigitSeparator(number)] = struct{}{}
7774
}
7875
}
@@ -89,6 +86,9 @@ func WithCustomChecks(checks string) Option {
8986
}
9087

9188
for _, name := range strings.Split(checks, ",") {
89+
if name == "" {
90+
continue
91+
}
9292
config.Checks[name] = true
9393
}
9494
}

0 commit comments

Comments
 (0)