Skip to content

Commit

Permalink
fix: ensure we're given exceptions prior to compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Nov 12, 2020
1 parent 4d9a9ea commit 4accf30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion check/capitalization.go
Expand Up @@ -49,9 +49,12 @@ func NewCapitalization(cfg *config.Config, generic baseCheck) (Capitalization, e
for term := range cfg.AcceptedTokens {
rule.Exceptions = append(rule.Exceptions, term)
}

regex = fmt.Sprintf(regex, strings.Join(rule.Exceptions, "|"))
if len(rule.Exceptions) > 0 {
rule.exceptRe = regexp.MustCompile(regex)
}

rule.exceptRe = regexp.MustCompile(regex)
if rule.Match == "$title" {
var tc *transform.TitleConverter
if rule.Style == "Chicago" {
Expand Down

0 comments on commit 4accf30

Please sign in to comment.