Skip to content

Commit

Permalink
Include default detectors when using a config that contains detectors (
Browse files Browse the repository at this point in the history
…#3115)

* include default detectors when config file is used

* fix test
  • Loading branch information
harmonherring-pro authored Jul 29, 2024
1 parent ed8bc50 commit f664472
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 1 addition & 3 deletions pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ func (e *Engine) setDefaults(ctx context.Context) {
e.decoders = decoders.DefaultDecoders()
}

if len(e.detectors) == 0 {
e.detectors = DefaultDetectors()
}
e.detectors = append(e.detectors, DefaultDetectors()...)

if e.dispatcher == nil {
e.dispatcher = NewPrinterDispatcher(new(output.PlainPrinter))
Expand Down
13 changes: 7 additions & 6 deletions pkg/engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,13 @@ func TestVerificationOverlapChunk(t *testing.T) {
sourceManager := sources.NewManager(opts...)

c := Config{
Concurrency: 1,
Decoders: decoders.DefaultDecoders(),
Detectors: conf.Detectors,
Verify: false,
SourceManager: sourceManager,
Dispatcher: NewPrinterDispatcher(new(discardPrinter)),
Concurrency: 1,
Decoders: decoders.DefaultDecoders(),
Detectors: conf.Detectors,
IncludeDetectors: "904", // isolate this test to only the custom detectors provided
Verify: false,
SourceManager: sourceManager,
Dispatcher: NewPrinterDispatcher(new(discardPrinter)),
}

e, err := NewEngine(ctx, &c)
Expand Down

0 comments on commit f664472

Please sign in to comment.