Skip to content

Commit

Permalink
🐛 During source only analsis, we should not also set the scope. (#116)
Browse files Browse the repository at this point in the history
Cherry-pick #101

Signed-off-by: Shawn Hurley <[email protected]>
  • Loading branch information
shawn-hurley authored Jul 25, 2024
1 parent 19873f4 commit e56cb6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (r *Analyzer) options(output string) (options command.Options, err error) {
if err != nil {
return
}
err = r.Scope.AddOptions(&options)
err = r.Scope.AddOptions(&options, r.Mode)
if err != nil {
return
}
Expand Down
17 changes: 12 additions & 5 deletions cmd/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ type Scope struct {
}

// AddOptions adds analyzer options.
func (r *Scope) AddOptions(options *command.Options) (err error) {
if !r.WithKnownLibs {
options.Add(
"--dep-label-selector",
"!konveyor.io/dep-source=open-source")
func (r *Scope) AddOptions(options *command.Options, mode Mode) (err error) {
// If withDeps is false, we are only every doing source analysis
// adding a dep label selector is strictly wrong in this situation
if mode.WithDeps {
// We want to filter out open source violations when we are not running
// with known libraries.
if !r.WithKnownLibs {
options.Add(
"--dep-label-selector",
"!konveyor.io/dep-source=open-source")
}

}
selector := r.incidentSelector()
if selector != "" {
Expand Down

0 comments on commit e56cb6f

Please sign in to comment.