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

🐛 Adding ability to set the scope for the analysis command #69

Conversation

shawn-hurley
Copy link
Contributor

No description provided.

@shawn-hurley shawn-hurley force-pushed the bugfix/adding-correct-incident-selection branch from c24a948 to 5a3116e Compare December 14, 2023 18:14
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 {
Copy link
Contributor Author

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>
@shawn-hurley shawn-hurley force-pushed the bugfix/adding-correct-incident-selection branch from 5a3116e to 47b79b2 Compare December 14, 2023 18:23
@shawn-hurley
Copy link
Contributor Author

@fabianvf @jortel enables the testing of the package filters.

A follow up PR for go-konveyor-tests is incoming

@shawn-hurley
Copy link
Contributor Author

This is needed for this konveyor test: konveyor/go-konveyor-tests#76

Copy link
Contributor

@jortel jortel left a 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):

  1. Extra !package prefix?
  2. Missing closing ) when both included and excluded specified.
  3. Excluded in the selector as (!package=a||!package=b) should be !(package=a||package=b).
  4. 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.

@jortel
Copy link
Contributor

jortel commented Dec 20, 2023

Replaced by: #70

@jortel jortel closed this Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants