Skip to content

Commit 038573a

Browse files
committed
refactor(scancode): Use the file-level license via the interface
This allows to avoid the version check. A separate variable is introduced here as smart-cast does not work in this case. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 260d85d commit 038573a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/scanners/scancode/src/main/kotlin/ScanCodeResultModelMapper.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import org.ossreviewtoolkit.model.TextLocation
3232
import org.ossreviewtoolkit.model.createAndLogIssue
3333
import org.ossreviewtoolkit.model.mapLicense
3434
import org.ossreviewtoolkit.model.utils.associateLicensesWithExceptions
35-
import org.ossreviewtoolkit.plugins.scanners.scancode.model.FileEntry
3635
import org.ossreviewtoolkit.plugins.scanners.scancode.model.LicenseEntry
3736
import org.ossreviewtoolkit.plugins.scanners.scancode.model.ScanCodeResult
3837

@@ -105,9 +104,10 @@ fun ScanCodeResult.toScanSummary(preferFileLicense: Boolean = false): ScanSummar
105104
it.value.first()
106105
}
107106

108-
if (preferFileLicense && file is FileEntry.Version3 && file.detectedLicenseExpressionSpdx != null) {
107+
val fileLicense = file.detectedLicenseExpressionSpdx
108+
if (preferFileLicense && fileLicense != null) {
109109
licenseFindings += LicenseFinding(
110-
license = file.detectedLicenseExpressionSpdx,
110+
license = fileLicense,
111111
location = TextLocation(
112112
path = file.path,
113113
startLine = licenses.minOf { it.startLine },

0 commit comments

Comments
 (0)