(fileContent, oldString string)
| 1347 | return filepath.Clean(filepath.Join(parts...)) |
| 1348 | } |
| 1349 | parent := filepath.Dir(current) |
| 1350 | if parent == current { |
| 1351 | return cleaned |
| 1352 | } |
| 1353 | suffix = append([]string{filepath.Base(current)}, suffix...) |
| 1354 | current = parent |
| 1355 | } |
| 1356 | } |
| 1357 | |
| 1358 | func isBroadSearchRoot(path string) bool { |
| 1359 | resolved := resolvePathBestEffort(path) |
| 1360 | home, _ := os.UserHomeDir() |
| 1361 | volume := filepath.VolumeName(resolved) |
| 1362 | root := string(filepath.Separator) |
| 1363 | if volume != "" { |
| 1364 | root = volume + string(filepath.Separator) |
| 1365 | } |
| 1366 | parent := filepath.Dir(resolved) |
| 1367 | return filepath.Clean(resolved) == filepath.Clean(home) || filepath.Clean(resolved) == filepath.Clean(root) || parent == resolved |
| 1368 | } |
| 1369 | |
| 1370 | var ignoredGlobDirs = map[string]struct{}{ |
| 1371 | ".git": {}, "node_modules": {}, "__pycache__": {}, ".venv": {}, "venv": {}, ".tox": {}, ".mypy_cache": {}, ".pytest_cache": {}, |
| 1372 | } |
| 1373 | |
| 1374 | func hasIgnoredDir(path string) bool { |
| 1375 | for _, part := range strings.Split(filepath.ToSlash(path), "/") { |
| 1376 | if _, ok := ignoredGlobDirs[part]; ok { |
| 1377 | return true |
| 1378 | } |
| 1379 | } |
| 1380 | return false |
no test coverage detected