fix: skip gitignored .worktrees/ dirs in repo scans
Directory walkers pruned .git/vendor/node_modules but not .worktrees/, so a repo scan descended into nested git worktrees (e.g. an orchestrator worktree under cms/.worktrees/). Their Go/TS files surfaced as false positives in the standalone-plugin import check and noise in the any-usage warnings. Add ".worktrees" to the skip set across the implicated and common walkers: proto RBAC proto-scan, standalone-plugin imports, frontend extras, go-lint, sqlc-uuid, presets.json, and plugin segmentation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7b96ceac4d
commit
f968cb31d9
@ -42,7 +42,7 @@ func checkTabState(webSrcDir string) []tabStateViolation {
|
||||
if !strings.HasSuffix(path, ".tsx") {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") {
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") || strings.Contains(path, "/.worktrees/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ func checkESLintDisableNextLine(root string) []eslintDirectiveViolation {
|
||||
if ext != ".ts" && ext != ".tsx" && ext != ".js" && ext != ".jsx" {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") {
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") || strings.Contains(path, "/.worktrees/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ func checkBareImports(webSrcDir string) []bareImportViolation {
|
||||
if ext != ".ts" && ext != ".tsx" {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") {
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/dist/") || strings.Contains(path, "/.worktrees/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ func checkLockfiles(repoRoot string) []lockfileViolation {
|
||||
if err != nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(path, "node_modules") {
|
||||
if strings.Contains(path, "node_modules") || strings.Contains(path, "/.worktrees/") {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
base := filepath.Base(path)
|
||||
|
||||
2
lint.go
2
lint.go
@ -235,7 +235,7 @@ func dirContainsTypeScript(root string) bool {
|
||||
}
|
||||
if info.IsDir() {
|
||||
switch info.Name() {
|
||||
case "node_modules", "dist", "build", ".git":
|
||||
case "node_modules", "dist", "build", ".git", ".worktrees":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -59,7 +59,7 @@ func checkStandalonePluginImports(root string) []pluginImportViolation {
|
||||
}
|
||||
if info.IsDir() {
|
||||
switch info.Name() {
|
||||
case ".git", "vendor", "node_modules":
|
||||
case ".git", ".worktrees", "vendor", "node_modules":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -96,7 +96,7 @@ func findPresetsFiles(root string) []string {
|
||||
if err != nil || info.IsDir() {
|
||||
if info != nil && info.IsDir() {
|
||||
switch info.Name() {
|
||||
case ".git", "vendor", "node_modules", "web", "dist":
|
||||
case ".git", ".worktrees", "vendor", "node_modules", "web", "dist":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ func checkEnvReads(root string) []envViolation {
|
||||
return nil
|
||||
}
|
||||
// Skip vendor
|
||||
if strings.Contains(path, "/vendor/") {
|
||||
if strings.Contains(path, "/vendor/") || strings.Contains(path, "/.worktrees/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ func extractBufProcedures(root string, allowedPackagePrefixes ...string) ([]stri
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
if info.Name() == "vendor" || info.Name() == ".git" {
|
||||
if info.Name() == "vendor" || info.Name() == ".git" || info.Name() == ".worktrees" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
@ -499,7 +499,7 @@ func extractPluginRoleMethods(root string) (map[string]string, error) {
|
||||
}
|
||||
if info.IsDir() {
|
||||
switch info.Name() {
|
||||
case ".git", "vendor", "node_modules":
|
||||
case ".git", ".worktrees", "vendor", "node_modules":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
@ -578,7 +578,7 @@ func extractConnectProceduresRecursive(root string, allowedPackagePrefixes ...st
|
||||
}
|
||||
if info.IsDir() {
|
||||
switch info.Name() {
|
||||
case ".git", "vendor", "node_modules":
|
||||
case ".git", ".worktrees", "vendor", "node_modules":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -101,7 +101,7 @@ func checkNoGoImports(pluginRoot, pluginName string, forbidden []string) []segme
|
||||
// Skip non-Go, test files, vendor, .git, web directory
|
||||
if info.IsDir() {
|
||||
base := filepath.Base(path)
|
||||
if base == ".git" || base == "vendor" || base == "web" || base == "node_modules" {
|
||||
if base == ".git" || base == ".worktrees" || base == "vendor" || base == "web" || base == "node_modules" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
@ -155,7 +155,7 @@ func checkNoFrontendImports(pluginRoot, pluginName string, forbidden []string) [
|
||||
}
|
||||
if info.IsDir() {
|
||||
base := filepath.Base(path)
|
||||
if base == "node_modules" || base == "dist" || base == ".git" {
|
||||
if base == "node_modules" || base == "dist" || base == ".git" || base == ".worktrees" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -82,7 +82,7 @@ func findSQLCConfigFiles(root string, includeRoot bool) []string {
|
||||
}
|
||||
if info.IsDir() {
|
||||
switch info.Name() {
|
||||
case ".git", "vendor", "node_modules", "dist":
|
||||
case ".git", ".worktrees", "vendor", "node_modules", "dist":
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user