Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): detect line checking first term when multiple terms exists #3834

Merged
merged 1 commit into from
Jul 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/detector/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ func DetectCurrentLine(lines []string, str1, str2 string,
if strings.Contains(lines[i], str1) {
restLine := lines[i][strings.Index(lines[i], str1)+len(str1):]
if strings.Contains(restLine, str2) {
distances[i] = levenshtein.ComputeDistance(ExtractLineFragment(restLine, str2, false), str2)
distances[i] = levenshtein.ComputeDistance(ExtractLineFragment(lines[i], str1, false), str1)
distances[i] += levenshtein.ComputeDistance(ExtractLineFragment(restLine, str2, false), str2)
}
}
} else if str1 != "" {
Expand Down