diff --git a/internal/parser/keyword/parser.go b/internal/parser/keyword/parser.go index d6467e5..78a4cc6 100644 --- a/internal/parser/keyword/parser.go +++ b/internal/parser/keyword/parser.go @@ -8,8 +8,9 @@ import ( ) type Match struct { - Keyword string - Score int + Keyword string + Score int + MaxMatchCount int } type Conf struct { @@ -33,6 +34,9 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) ( content := executorResult.Files[file] for _, match := range conf.Matches { count := strings.Count(content, match.Keyword) + if match.MaxMatchCount > 0 { + count = min(count, match.MaxMatchCount) + } if count > 0 { matched = true score -= count * match.Score