-
Notifications
You must be signed in to change notification settings - Fork 310
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
model: Improve and align OrtResult.getIssues()
#8507
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fviernau
force-pushed
the
model-align-test-issues
branch
from
April 10, 2024 14:40
0d6af69
to
a519d28
Compare
sschuberth
reviewed
Apr 10, 2024
fviernau
force-pushed
the
model-align-test-issues
branch
from
April 10, 2024 15:59
a519d28
to
34f0d95
Compare
fviernau
force-pushed
the
model-align-test-issues
branch
2 times, most recently
from
April 11, 2024 06:18
1b88b8b
to
6dd0c4e
Compare
sschuberth
reviewed
Apr 11, 2024
issues.filterTo(mutableSetOf()) { !omitResolved || !isResolved(it) } | ||
issues.filterTo(mutableSetOf()) { | ||
(!omitResolved || !isResolved(it)) && it.severity >= minSeverity | ||
} |
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.
All in all, this could now look something like this:
return allIssues.mapNotNull { (id, issues) ->
if (omitExcluded && isExcluded(id)) return@mapNotNull null
val filteredIssues = issues.filterTo(mutableSetOf()) {
(!omitResolved || !isResolved(it)) && it.severity >= minSeverity
}
filteredIssues.takeUnless { it.isEmpty() }?.let { id to it }
}.toMap()
fviernau
force-pushed
the
model-align-test-issues
branch
from
April 11, 2024 06:59
6dd0c4e
to
f4e7102
Compare
fviernau
force-pushed
the
model-align-test-issues
branch
2 times, most recently
from
April 11, 2024 15:05
3f4084a
to
4c547b1
Compare
sschuberth
reviewed
Apr 12, 2024
@@ -260,13 +260,15 @@ data class OrtResult( | |||
|
|||
val allIssues = analyzerIssues.zipWithCollections(scannerIssues).zipWithCollections(advisorIssues) | |||
|
|||
return allIssues.mapValues { (_, issues) -> | |||
issues.filterTo(mutableSetOf()) { | |||
return allIssues.mapNotNull { (id, issues) -> |
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.
This hunk seems to have gone to the wrong commit.
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
The same issue can occur for different identifiers, for example when a scan of a specific provenance corresponds to multiple identifiers. So, return only distinct issues. Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Avoid dealing with a nullable `minSeverity` in the same way as in `getIssues()`. Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Remove the a performance optimization to simplify the code. Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau
force-pushed
the
model-align-test-issues
branch
from
April 12, 2024 16:57
4c547b1
to
b694266
Compare
sschuberth
approved these changes
Apr 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Align with
getRuleViolations()
andgetVulnerabilities()
and make the API more flexible.This prepares for filtering the issues by their affected path in a following change.
Context: #7921.