Skip to content

Commit

Permalink
fix: wasted regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
butuzov committed Jan 11, 2022
1 parent f391143 commit bcb2113
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,32 @@ func WithOptions(options ...Option) *Config {

func WithIgnoredFunctions(excludes string) Option {
return func(config *Config) {
if excludes == "" {
return
}

for _, exclude := range strings.Split(excludes, ",") {
if exclude == "" {
continue
}
config.IgnoredFunctions = append(config.IgnoredFunctions, regexp.MustCompile(exclude))
}
}
}

func WithIgnoredFiles(excludes string) Option {
return func(config *Config) {
if excludes == "" {
return
}

for _, exclude := range strings.Split(excludes, ",") {
if exclude == "" {
continue
}
config.IgnoredFiles = append(config.IgnoredFiles, regexp.MustCompile(exclude))
}
}
}

func WithIgnoredNumbers(numbers string) Option {
return func(config *Config) {
if numbers == "" {
return
}

for _, number := range strings.Split(numbers, ",") {
if number == "" {
continue
}
config.IgnoredNumbers[config.removeDigitSeparator(number)] = struct{}{}
}
}
Expand All @@ -89,6 +86,9 @@ func WithCustomChecks(checks string) Option {
}

for _, name := range strings.Split(checks, ",") {
if name == "" {
continue
}
config.Checks[name] = true
}
}
Expand Down

0 comments on commit bcb2113

Please # to comment.