Skip to content

Commit

Permalink
🐛 excluded scope should not force a cache reset (#642)
Browse files Browse the repository at this point in the history
Signed-off-by: Shawn Hurley <[email protected]>
  • Loading branch information
shawn-hurley authored Feb 10, 2025
1 parent b4f7aa8 commit 5945e60
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions kai_analyzer_rpc/pkg/service/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ func (a *Analyzer) Analyze(args Args, response *Response) error {
a.Logger.V(2).Info("Using inclusion scope", "scope", currScope.Name())
}

if len(args.ExcludedPaths) > 0 {
currScope := engine.ExcludedPathsScope(args.ExcludedPaths, a.Logger)
scopes = append(scopes, currScope)
a.Logger.V(2).Info("Using exclusion scope", "scope", currScope.Name())
}

// If we don't have scopes to test a single thing, and we don't have a reset cache request
// Then we should return early, with results from the cache
if len(scopes) == 0 && !args.ResetCache {
Expand All @@ -245,6 +239,13 @@ func (a *Analyzer) Analyze(args Args, response *Response) error {
return nil
}

// Only exclude paths after we determine if we are going to run rules
if len(args.ExcludedPaths) > 0 {
currScope := engine.ExcludedPathsScope(args.ExcludedPaths, a.Logger)
scopes = append(scopes, currScope)
a.Logger.V(2).Info("Using exclusion scope", "scope", currScope.Name())
}

// Adding spans to the discovery rules run and for the violation rules run
// to determine if discovery rule segmentation saves us enough
if len(a.discoveryRulesets) != 0 && args.ResetCache {
Expand Down

0 comments on commit 5945e60

Please sign in to comment.