Skip to content

Commit d77d46e

Browse files
committed
Merge branch 'master' into victor/publish-deb-rpm-packages
2 parents 41a22b8 + cba9503 commit d77d46e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ All notable changes to the ld-find-code-refs program will be documented in this
88

99
### Changed
1010
- Automate Homebrew releases
11+
- Added word boundaries to flag key regexes.
12+
- This should reduce false positives. E.g. for flag key `cool-feature` we will no longer match `verycool-features`.
1113

1214
## [0.4.0] - 2019-01-30
1315

internal/command/command.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ func (c Client) SearchForFlags(flags []string, ctxLines int) ([][]string, error)
9595
sb.WriteString(fmt.Sprintf(" -C%d", ctxLines))
9696
}
9797

98-
escapedFlags := []string{}
98+
flagRegexes := []string{}
9999
for _, v := range flags {
100-
escapedFlags = append(escapedFlags, regexp.QuoteMeta(v))
100+
escapedFlag := regexp.QuoteMeta(v)
101+
flagRegexes = append(flagRegexes, "\\b"+escapedFlag+"\\b")
101102
}
102-
sb.WriteString(" '" + strings.Join(escapedFlags, "|") + "' " + c.Workspace)
103+
sb.WriteString(" '" + strings.Join(flagRegexes, "|") + "' " + c.Workspace)
103104

104105
cmd := sb.String()
105106
sh := exec.Command("sh", "-c", cmd)

0 commit comments

Comments
 (0)