fix: remove redundant HasPrefix check in isConfigFilePath

The first operand strings.HasPrefix(lowerRelativePath, sep+pattern+sep)
was dead code because the strings.Contains check above already covers
this case - if a string starts with X, it necessarily contains X.

Simplified to only check HasPrefix(lowerRelativePath, pattern+sep) which
adds meaningful coverage for paths starting with the pattern directly
after the config root.
This commit is contained in:
Cursor Agent
2026-02-07 12:17:35 +00:00
parent fc27e51cb5
commit e1c6fcea4d
+3 -1
View File
@@ -373,7 +373,9 @@ func isConfigFilePath(filePath string) bool {
return true
}
// Check if path starts with this directory name (after config root)
if strings.HasPrefix(lowerRelativePath, sep+pattern+sep) || strings.HasPrefix(lowerRelativePath, pattern+sep) {
// Note: We only check pattern+sep here because sep+pattern+sep is already covered
// by the Contains check above (if a string starts with X, it contains X)
if strings.HasPrefix(lowerRelativePath, pattern+sep) {
return true
}
}