aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/match.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/engine/match.go')
-rw-r--r--internal/engine/match.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/internal/engine/match.go b/internal/engine/match.go
index 6b98d73..c252596 100644
--- a/internal/engine/match.go
+++ b/internal/engine/match.go
@@ -280,10 +280,11 @@ func (e *Engine) Explain(ctx context.Context, path string) (*Explanation, error)
excl := e.excludeDirs(d)
skip := explainSkip(d, sf, excl, now)
- // The directory is walked only for a duplicate test, the one thing that
- // needs its other files (triage 21).
+ // The directory is walked only for a duplicate test - in a rule or in an
+ // exclude - the one thing that needs its other files (triage 21, plan 11
+ // review M3).
files := []scan.File{sf}
- if len(d.DupScopes) > 0 {
+ if len(d.DupScopes) > 0 || excludesUseDuplicate(d) {
files = e.filesForExplain(d, sf, excl, now)
}
run := newMatchRun(e, d, ctx, now, files)
@@ -332,6 +333,17 @@ func (e *Engine) Explain(ctx context.Context, path string) (*Explanation, error)
return &Explanation{Dir: d, File: sf, Skip: skip, Excludes: excludes, Excluded: excluded, Rules: rules, NoDelete: noDel}, nil
}
+// excludesUseDuplicate reports whether any of d's excludes has a
+// (duplicate) test.
+func excludesUseDuplicate(d *Dir) bool {
+ for _, x := range d.Excludes {
+ if len(x.Cond.DupDirs) > 0 {
+ return true
+ }
+ }
+ return false
+}
+
// cacheFingerprint identifies what a cached keyword answer of d depends on
// besides the file: the extractor (its version and tools), normalisation
// and its Unicode tables, the Go release, and d's max-read, which caps what