Skip to content

Commit

Permalink
Merge pull request #30 from butuzov/wasterd-regexp
Browse files Browse the repository at this point in the history
fix: wasted regexp
  • Loading branch information
tommy-muehle authored Jan 17, 2022
2 parents f391143 + bcb2113 commit c5e4f67
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 c5e4f67

Please # to comment.