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

ExperimentalScanner: Support skip options #4860

Merged
merged 2 commits into from
Dec 16, 2021

Conversation

mnonnenmacher
Copy link
Member

Support the optional skipping of excluded packages and packages with concluded license.

@mnonnenmacher mnonnenmacher requested a review from a team as a code owner December 15, 2021 16:18
Do not scan packages with a concluded license and non-empty authors if
the `skipConcluded` scanner configuration option is set.

Signed-off-by: Martin Nonnenmacher <[email protected]>
Support the `ScannerCommand` option to not scan excluded projects and
packages.

Signed-off-by: Martin Nonnenmacher <[email protected]>
@@ -326,6 +326,16 @@ class ExperimentalScanner(
return nestedProvenanceScanResults
}

private fun Collection<Package>.filterNotConcluded(): Collection<Package> =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I overlooked this: Input types should be as generic as possible (Collection) but output types as specific as possible, so the return type should stay a List.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was deliberate, because if I change the input type to Collection but keep the return type as List I would have to call toList() on the input if skipConcluded == false which would copy the list to a new ArrayList for no reason. And it's a private function after all, I think for those it's totally fine to be tailored to the use case of the class, that's why I didn't use Collection in the first place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in this case I'll leave it to you whether to use Collection or List in both places. Approving in any case.

@mnonnenmacher mnonnenmacher merged commit b1a1e2f into master Dec 16, 2021
@mnonnenmacher mnonnenmacher deleted the experimental-scanner-skip-concluded branch December 16, 2021 10:11
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.

None yet

3 participants