Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 During source only analsis, we should not also set the scope. #101

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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
Loading