-
Notifications
You must be signed in to change notification settings - Fork 12
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
🐛 Adding ability to set the scope for the analysis command #69
🐛 Adding ability to set the scope for the analysis command #69
Conversation
c24a948
to
5a3116e
Compare
cmd/analyzer.go
Outdated
@@ -23,6 +25,10 @@ func (r *Analyzer) Run() (b *builder.Issues, err error) { | |||
} | |||
b = &builder.Issues{Path: output} | |||
err = cmd.Run() | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would argue that something along this line would be useful, sounds like you have something in the works so will remove
Signed-off-by: Shawn Hurley <shawn@hurley.page>
5a3116e
to
47b79b2
Compare
This is needed for this konveyor test: konveyor/go-konveyor-tests#76 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @shawn!
Few things:
- Please add (at lease a short) description to PR.
- Rather than adding a code block into AddOptions(), please add a method that builds the selector for better functional decomposition and testability.
- Please add a unit test.
- The logic seems to prefix
(!package ||
. Is this intentional or side effect of logic? - I tested in Go Playground and found some issues with the generated selector. Also demonstrates a simpler (IMHO) approach that solves them. Please: See/Consider: Scope.incidentSelector().
Issues (I think):
- Extra
!package
prefix? - Missing closing
)
when both included and excluded specified. - Excluded in the selector as
(!package=a||!package=b)
should be!(package=a||package=b)
. - Exclude only creates selector of
(!package)
should be!(package||package=C||package=D)
.
Test output:
pr69()
Empty => ''
Included only. => '(!package || package=a || package=b)'
included and exluded => '(!package || package=a || package=b) && (!package || !package=C || !package=D'
Excluded only. => '(!package)'
incidentSelector()
Empty => ''
Included only. => '(package=a||package=b)'
included and excluded => '(package=a||package=b)&&!(package=C||package=D)'
Excluded only. => '!(package=C||package=D)'
Long term:
The packages list of included/excluded in the addon API needs to be re-modeled to be more generic and the caller (UI) should pass arrays of package=<name>
(like we do for labels). For now this is a left over from Windup which was 100% java specific.
Replaced by: #70 |
No description provided.