Skip to content

Commit

Permalink
feat(scanner): Expose the snippet choices to the scanner
Browse files Browse the repository at this point in the history
By adding the snippet choices configuration to the scanner context, the
snippet scanner implementations such as ScanOSS and FossID can be extended
to take into account this configuration.
This will be done in a future commit.

Signed-off-by: Nicolas Nobelis <[email protected]>
  • Loading branch information
nnobelis committed Feb 23, 2024
1 parent e78cae4 commit a84d484
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion scanner/src/main/kotlin/ScanContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.PackageType
import org.ossreviewtoolkit.model.config.Excludes
import org.ossreviewtoolkit.model.config.ScannerConfiguration
import org.ossreviewtoolkit.model.config.SnippetChoices
import org.ossreviewtoolkit.utils.spdx.SpdxExpression

/**
Expand Down Expand Up @@ -60,5 +61,10 @@ data class ScanContext(
* The packages known to be covered in the context of this scan. For package scanners, this is the list of packages
* that have the same provenance as the reference package.
*/
val coveredPackages: List<Package> = emptyList()
val coveredPackages: List<Package> = emptyList(),

/**
* The [SnippetChoices] of the project to scan.
*/
val snippetChoices: List<SnippetChoices> = emptyList()
)
6 changes: 4 additions & 2 deletions scanner/src/main/kotlin/Scanner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class Scanner(
ortResult.labels + labels,
PackageType.PROJECT,
ortResult.repository.config.excludes,
scannerConfig.detectedLicenseMapping
scannerConfig.detectedLicenseMapping,
snippetChoices = ortResult.repository.config.snippetChoices
)
)

Expand All @@ -127,7 +128,8 @@ class Scanner(
ortResult.labels,
PackageType.PACKAGE,
ortResult.repository.config.excludes,
scannerConfig.detectedLicenseMapping
scannerConfig.detectedLicenseMapping,
snippetChoices = ortResult.repository.config.snippetChoices
)
)

Expand Down

0 comments on commit a84d484

Please sign in to comment.