Skip to content

Commit 7e6ed63

Browse files
Merge branch 'oss-review-toolkit:main' into feat/scanoss/parse-ort-yml-file-on-scanoss-integration-cherry-pick
2 parents 49915ed + 9d6a7e8 commit 7e6ed63

File tree

35 files changed

+183
-258
lines changed

35 files changed

+183
-258
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ jobs:
4141
- name: Checkout Repository
4242
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
44+
uses: github/codeql-action/init@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3
4545
with:
4646
languages: java
4747
- name: Setup Gradle
4848
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4
4949
- name: Build all classes
5050
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx1g --no-build-cache classes
5151
- name: Perform CodeQL Analysis
52-
uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
52+
uses: github/codeql-action/analyze@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3
5353
test:
5454
strategy:
5555
matrix:

.github/workflows/scorecard-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
results_format: sarif
3131
publish_results: true
3232
- name: Upload Code Scanning Results
33-
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
33+
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3
3434
with:
3535
sarif_file: ossf-results.sarif

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- name: Check for Detekt Issues
7171
run: ./gradlew detektAll
7272
- name: Upload SARIF File
73-
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
73+
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3
7474
if: always() # Upload even if the previous step failed.
7575
with:
7676
sarif_file: build/reports/detekt/merged.sarif
@@ -113,7 +113,7 @@ jobs:
113113
post-pr-comment: false
114114
use-caches: false
115115
- name: Upload Code Scanning Results
116-
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3
116+
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3
117117
with:
118118
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json
119119
reuse-tool:

analyzer/src/main/kotlin/PackageManager.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ abstract class PackageManager(val projectType: String) : Plugin {
312312

313313
val issues = listOf(
314314
createAndLogIssue(
315-
source = descriptor.displayName,
316-
message = "${descriptor.displayName} failed to resolve dependencies for path " +
317-
"'$relativePath': ${it.collectMessages()}"
315+
"${descriptor.displayName} failed to resolve dependencies for path '$relativePath': " +
316+
it.collectMessages()
318317
)
319318
)
320319

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[versions]
2-
dependencyAnalysisPlugin = "2.10.1"
2+
dependencyAnalysisPlugin = "2.11.0"
33
detektPlugin = "1.23.8"
44
dokkatooPlugin = "2.4.0"
55
downloadPlugin = "5.6.0"
6-
gitSemverPlugin = "0.15.0"
6+
gitSemverPlugin = "0.16.0"
77
graalVmNativeImagePlugin = "0.10.5"
88
ideaExtPlugin = "1.1.10"
99
jakartaMigrationPlugin = "0.24.0"
@@ -13,7 +13,7 @@ mavenPublishPlugin = "0.31.0"
1313
reproducibleBuildsPlugin = "1.0"
1414
versionsPlugin = "0.52.0"
1515

16-
aeSecurity = "0.135.6"
16+
aeSecurity = "0.135.7"
1717
asciidoctorj = "3.0.0"
1818
asciidoctorjPdf = "2.3.19"
1919
blackduckCommon = "67.0.5"
@@ -59,7 +59,7 @@ postgres = "42.7.5"
5959
postgresEmbedded = "1.1.0"
6060
reflections = "0.10.2"
6161
retrofit = "2.11.0"
62-
s3 = "2.30.31"
62+
s3 = "2.30.36"
6363
saxonHe = "12.5"
6464
scanoss = "0.10.1"
6565
semver4j = "5.6.0"

model/src/main/kotlin/Issue.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import java.time.Instant
2929

3030
import org.apache.logging.log4j.kotlin.logger
3131

32+
import org.ossreviewtoolkit.plugins.api.Plugin
33+
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
3234
import org.ossreviewtoolkit.utils.common.normalizeLineBreaks
3335

3436
/**
@@ -88,3 +90,13 @@ inline fun <reified T : Any> T.createAndLogIssue(
8890
logger.log(issue.severity.toLog4jLevel()) { message }
8991
return issue
9092
}
93+
94+
/**
95+
* Create an [Issue] and log the message. The log level is aligned with the [severity]. The [source][Issue.source] is
96+
* set to the [display name][PluginDescriptor.displayName] of the plugin.
97+
*/
98+
inline fun <reified T : Plugin> T.createAndLogIssue(
99+
message: String,
100+
severity: Severity? = null,
101+
affectedPath: String? = null
102+
) = createAndLogIssue(descriptor.displayName, message, severity, affectedPath)

plugins/advisors/black-duck/src/main/kotlin/BlackDuck.kt

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ class BlackDuck(
120120
pkg.blackDuckOriginId?.let { BlackDuckOriginId.parse(it).toExternalId() }
121121
}.getOrElse {
122122
issues += createAndLogIssue(
123-
source = descriptor.displayName,
124-
message = "Could not parse origin-id '${pkg.blackDuckOriginId}' for '${pkg.id.toCoordinates()}: " +
123+
"Could not parse origin-id '${pkg.blackDuckOriginId}' for '${pkg.id.toCoordinates()}: " +
125124
it.collectMessages()
126125
)
127126
return emptyList()
@@ -132,19 +131,15 @@ class BlackDuck(
132131
blackDuckApi.searchKbComponentsByExternalId(externalId)
133132
}.getOrElse {
134133
issues += createAndLogIssue(
135-
source = descriptor.displayName,
136-
message = "Requesting origins for externalId '$externalId' failed: ${it.collectMessages()}"
134+
"Requesting origins for externalId '$externalId' failed: ${it.collectMessages()}"
137135
)
138136
return emptyList()
139137
}
140138
} else {
141139
runCatching {
142140
blackDuckApi.searchKbComponentsByPurl(pkg.purl)
143141
}.getOrElse {
144-
issues += createAndLogIssue(
145-
source = descriptor.displayName,
146-
message = "Requesting origins for purl ${pkg.purl} failed: ${it.collectMessages()}"
147-
)
142+
issues += createAndLogIssue("Requesting origins for purl ${pkg.purl} failed: ${it.collectMessages()}")
148143
return emptyList()
149144
}
150145
}
@@ -153,10 +148,7 @@ class BlackDuck(
153148
runCatching {
154149
blackDuckApi.getOriginView(searchResult)
155150
}.onFailure {
156-
issues += createAndLogIssue(
157-
source = descriptor.displayName,
158-
message = "Requesting origin details failed: ${it.collectMessages()}"
159-
)
151+
issues += createAndLogIssue("Requesting origin details failed: ${it.collectMessages()}")
160152
}.getOrNull()
161153
}
162154

@@ -171,10 +163,9 @@ class BlackDuck(
171163

172164
if (externalId != null && origins.isEmpty()) {
173165
issues += createAndLogIssue(
174-
source = descriptor.displayName,
175-
message = "The origin-id '${pkg.blackDuckOriginId} of package ${pkg.id.toCoordinates()} does not " +
176-
"match any origin.",
177-
severity = Severity.WARNING
166+
"The origin-id '${pkg.blackDuckOriginId} of package ${pkg.id.toCoordinates()} does not match any " +
167+
"origin.",
168+
Severity.WARNING
178169
)
179170
}
180171

@@ -192,9 +183,7 @@ class BlackDuck(
192183
logger.info { "Found ${it.size} vulnerabilities for origin ${origin.identifier}." }
193184
}.onFailure {
194185
issues += createAndLogIssue(
195-
source = descriptor.displayName,
196-
message = "Requesting vulnerabilities for origin ${origin.identifier} failed: " +
197-
it.collectMessages()
186+
"Requesting vulnerabilities for origin ${origin.identifier} failed: ${it.collectMessages()}"
198187
)
199188
}.getOrDefault(emptyList())
200189
}

plugins/advisors/vulnerable-code/src/main/kotlin/VulnerableCode.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ class VulnerableCode(
154154
VulnerabilityReference(sourceUri, it.scoringSystem, severity, score, vector)
155155
}
156156
}.onFailure {
157-
issues += createAndLogIssue(
158-
descriptor.displayName,
159-
"Failed to map $this to ORT model due to $it.",
160-
Severity.HINT
161-
)
157+
issues += createAndLogIssue("Failed to map $this to ORT model due to $it.", Severity.HINT)
162158
}.getOrElse { emptyList() }
163159

164160
/**

plugins/package-managers/bazel/src/main/kotlin/Bazel.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ class Bazel(override val descriptor: PluginDescriptor = BazelFactory.descriptor)
152152

153153
getPackages(scopes, registry, localPathOverrides, archiveOverrides, projectVcs)
154154
} else {
155-
issues += createAndLogIssue(
156-
descriptor.displayName,
157-
"Bazel registry URL cannot be determined from the lockfile."
158-
)
155+
issues += createAndLogIssue("Bazel registry URL cannot be determined from the lockfile.")
159156
emptySet()
160157
}
161158

plugins/package-managers/bundler/src/main/kotlin/Bundler.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,8 @@ class Bundler(
299299
it.showStackTrace()
300300

301301
issues += createAndLogIssue(
302-
source = descriptor.displayName,
303-
message = "Failed to parse dependency '$gemName' of project '${projectId.toCoordinates()}' in " +
304-
"'$workingDir': ${it.collectMessages()}"
302+
"Failed to parse dependency '$gemName' of project '${projectId.toCoordinates()}' in '$workingDir': " +
303+
it.collectMessages()
305304
)
306305
}
307306
}

0 commit comments

Comments
 (0)