Skip to content

Commit 084a37c

Browse files
committed
refactor(evaluated-model): Add advisor provider issues
Add the provider issues that aren't part of the advisor results to the `EvaluatedModel` issues. Signed-off-by: Johanna Lamppu <johanna.lamppu@doubleopen.org>
1 parent 19d969a commit 084a37c

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed

plugins/reporters/evaluated-model/src/funTest/resources/evaluated-model-reporter-test-deduplicate-expected-output.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ issues:
304304
pkg: 2
305305
how_to_fix: "Some how to fix text."
306306
- _id: 21
307+
timestamp: "2026-02-26T08:54:38.920436615Z"
308+
type: "ADVISOR"
309+
source: "Advisor"
310+
message: "Example provider issue."
311+
severity: "ERROR"
312+
how_to_fix: "Some how to fix text."
313+
- _id: 22
307314
timestamp: "2024-04-25T07:44:20.725613974Z"
308315
type: "ANALYZER"
309316
source: "Gradle"
@@ -312,7 +319,7 @@ issues:
312319
pkg: 2
313320
path: 0
314321
how_to_fix: "Some how to fix text."
315-
- _id: 22
322+
- _id: 23
316323
timestamp: "2024-04-25T07:44:20.725613974Z"
317324
type: "ANALYZER"
318325
source: "Gradle"
@@ -1052,7 +1059,7 @@ dependency_trees:
10521059
linkage: "DYNAMIC"
10531060
pkg: 2
10541061
issues:
1055-
- 21
1062+
- 22
10561063
children:
10571064
- key: 4
10581065
linkage: "DYNAMIC"
@@ -1077,7 +1084,7 @@ dependency_trees:
10771084
linkage: "DYNAMIC"
10781085
pkg: 3
10791086
issues:
1080-
- 22
1087+
- 23
10811088
children:
10821089
- key: 10
10831090
linkage: "DYNAMIC"
@@ -1161,10 +1168,10 @@ statistics:
11611168
rule_violation_resolutions: 1
11621169
vulnerability_resolutions: 0
11631170
open_issues:
1164-
errors: 6
1171+
errors: 7
11651172
warnings: 4
11661173
hints: 3
1167-
severe: 10
1174+
severe: 11
11681175
open_rule_violations:
11691176
errors: 1
11701177
warnings: 1

plugins/reporters/evaluated-model/src/funTest/resources/evaluated-model-reporter-test-expected-output.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@
352352
"how_to_fix" : "Some how to fix text."
353353
}, {
354354
"_id" : 21,
355+
"timestamp" : "2026-02-26T08:54:38.920436615Z",
356+
"type" : "ADVISOR",
357+
"source" : "Advisor",
358+
"message" : "Example provider issue.",
359+
"severity" : "ERROR",
360+
"how_to_fix" : "Some how to fix text."
361+
}, {
362+
"_id" : 22,
355363
"timestamp" : "2024-04-25T07:44:20.725613974Z",
356364
"type" : "ANALYZER",
357365
"source" : "Gradle",
@@ -361,7 +369,7 @@
361369
"path" : 0,
362370
"how_to_fix" : "Some how to fix text."
363371
}, {
364-
"_id" : 22,
372+
"_id" : 23,
365373
"timestamp" : "2024-04-25T07:44:20.725613974Z",
366374
"type" : "ANALYZER",
367375
"source" : "Gradle",
@@ -1128,7 +1136,7 @@
11281136
"key" : 3,
11291137
"linkage" : "DYNAMIC",
11301138
"pkg" : 2,
1131-
"issues" : [ 21 ],
1139+
"issues" : [ 22 ],
11321140
"children" : [ {
11331141
"key" : 4,
11341142
"linkage" : "DYNAMIC",
@@ -1157,7 +1165,7 @@
11571165
"key" : 9,
11581166
"linkage" : "DYNAMIC",
11591167
"pkg" : 3,
1160-
"issues" : [ 22 ],
1168+
"issues" : [ 23 ],
11611169
"children" : [ {
11621170
"key" : 10,
11631171
"linkage" : "DYNAMIC",
@@ -1250,10 +1258,10 @@
12501258
"vulnerability_resolutions" : 0
12511259
},
12521260
"open_issues" : {
1253-
"errors" : 6,
1261+
"errors" : 7,
12541262
"warnings" : 4,
12551263
"hints" : 3,
1256-
"severe" : 10
1264+
"severe" : 11
12571265
},
12581266
"open_rule_violations" : {
12591267
"errors" : 1,

plugins/reporters/evaluated-model/src/funTest/resources/evaluated-model-reporter-test-expected-output.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ issues:
304304
pkg: 2
305305
how_to_fix: "Some how to fix text."
306306
- _id: 21
307+
timestamp: "2026-02-26T08:54:38.920436615Z"
308+
type: "ADVISOR"
309+
source: "Advisor"
310+
message: "Example provider issue."
311+
severity: "ERROR"
312+
how_to_fix: "Some how to fix text."
313+
- _id: 22
307314
timestamp: "2024-04-25T07:44:20.725613974Z"
308315
type: "ANALYZER"
309316
source: "Gradle"
@@ -312,7 +319,7 @@ issues:
312319
pkg: 2
313320
path: 0
314321
how_to_fix: "Some how to fix text."
315-
- _id: 22
322+
- _id: 23
316323
timestamp: "2024-04-25T07:44:20.725613974Z"
317324
type: "ANALYZER"
318325
source: "Gradle"
@@ -1052,7 +1059,7 @@ dependency_trees:
10521059
linkage: "DYNAMIC"
10531060
pkg: 2
10541061
issues:
1055-
- 21
1062+
- 22
10561063
children:
10571064
- key: 4
10581065
linkage: "DYNAMIC"
@@ -1077,7 +1084,7 @@ dependency_trees:
10771084
linkage: "DYNAMIC"
10781085
pkg: 3
10791086
issues:
1080-
- 22
1087+
- 23
10811088
children:
10821089
- key: 10
10831090
linkage: "DYNAMIC"
@@ -1161,10 +1168,10 @@ statistics:
11611168
rule_violation_resolutions: 1
11621169
vulnerability_resolutions: 0
11631170
open_issues:
1164-
errors: 6
1171+
errors: 7
11651172
warnings: 4
11661173
hints: 3
1167-
severe: 10
1174+
severe: 11
11681175
open_rule_violations:
11691176
errors: 1
11701177
warnings: 1

plugins/reporters/evaluated-model/src/funTest/resources/reporter-test-input.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,11 @@ advisor:
779779
Vulnerable_code:
780780
options:
781781
server_url: "http://localhost:8000"
782+
provider_issues:
783+
- timestamp: "2026-02-26T08:54:38.920436615Z"
784+
source: "Advisor"
785+
message: "Example provider issue."
786+
severity: "ERROR"
782787
results:
783788
Maven:org.apache.commons:commons-text:1.1:
784789
- advisor:

plugins/reporters/evaluated-model/src/main/kotlin/EvaluatedModelMapper.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) {
148148
}
149149
}
150150

151+
addIssues(
152+
issues = input.ortResult.getAdvisorProviderIssues(),
153+
type = EvaluatedIssueType.ADVISOR,
154+
pkg = null,
155+
scanResult = null,
156+
path = null
157+
)
158+
151159
resultProjects.forEach { project ->
152160
val pkg = packages.getValue(project.id)
153161
addDependencyTree(project, pkg, deduplicateDependencyTree)
@@ -649,7 +657,7 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) {
649657
private fun addIssues(
650658
issues: Collection<Issue>,
651659
type: EvaluatedIssueType,
652-
pkg: EvaluatedPackage,
660+
pkg: EvaluatedPackage?,
653661
scanResult: EvaluatedScanResult?,
654662
path: EvaluatedPackagePath?
655663
): List<EvaluatedIssue> {
@@ -663,7 +671,7 @@ internal class EvaluatedModelMapper(private val input: ReporterInput) {
663671
message = issue.message,
664672
severity = issue.severity,
665673
resolutions = resolutions,
666-
isExcluded = input.ortResult.isExcluded(issue, pkg.id),
674+
isExcluded = pkg?.id?.let { input.ortResult.isExcluded(issue, it) } ?: false,
667675
pkg = pkg,
668676
scanResult = scanResult,
669677
path = path,

0 commit comments

Comments
 (0)