Skip to content

Commit

Permalink
refactor(static-html): Use a shorter name for DependencyRow
Browse files Browse the repository at this point in the history
Also move the class into `ProjectTable` to allow for that shorter name.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed May 3, 2024
1 parent 801b3ad commit e8a563a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
108 changes: 54 additions & 54 deletions plugins/reporters/static-html/src/main/kotlin/ReportTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal data class ReportTable(
/**
* The dependencies of this project.
*/
val rows: List<DependencyRow>,
val rows: List<Row>,

/**
* The path to the directory containing the definition file of the project, relative to the analyzer root,
Expand All @@ -96,60 +96,60 @@ internal data class ReportTable(
val pathExcludes: List<PathExclude>
) {
fun isExcluded() = pathExcludes.isNotEmpty()
}

data class DependencyRow(
/**
* The identifier of the package.
*/
val id: Identifier,

/**
* The remote artifact where the source package can be downloaded.
*/
val sourceArtifact: RemoteArtifact,

/**
* The VCS information of the package.
*/
val vcsInfo: VcsInfo,

/**
* The scopes the package is used in.
*/
val scopes: SortedMap<String, List<ScopeExclude>>,

/**
* The concluded license of the package.
*/
val concludedLicense: SpdxExpression?,

/**
* The licenses declared by the package.
*/
val declaredLicenses: List<ResolvedLicense>,

/**
* The detected licenses aggregated from all [ScanResult]s for this package.
*/
val detectedLicenses: List<ResolvedLicense>,

/**
* The effective license of the package derived from the licenses of the license sources chosen by a
* LicenseView, with optional choices applied.
*/
val effectiveLicense: SpdxExpression?,

/**
* All analyzer issues related to this package.
*/
val analyzerIssues: List<ResolvableIssue>,

/**
* All scan issues related to this package.
*/
val scanIssues: List<ResolvableIssue>
)
data class Row(
/**
* The identifier of the package.
*/
val id: Identifier,

/**
* The remote artifact where the source package can be downloaded.
*/
val sourceArtifact: RemoteArtifact,

/**
* The VCS information of the package.
*/
val vcsInfo: VcsInfo,

/**
* The scopes the package is used in.
*/
val scopes: SortedMap<String, List<ScopeExclude>>,

/**
* The concluded license of the package.
*/
val concludedLicense: SpdxExpression?,

/**
* The licenses declared by the package.
*/
val declaredLicenses: List<ResolvedLicense>,

/**
* The detected licenses aggregated from all [ScanResult]s for this package.
*/
val detectedLicenses: List<ResolvedLicense>,

/**
* The effective license of the package derived from the licenses of the license sources chosen by a
* LicenseView, with optional choices applied.
*/
val effectiveLicense: SpdxExpression?,

/**
* All analyzer issues related to this package.
*/
val analyzerIssues: List<ResolvableIssue>,

/**
* All scan issues related to this package.
*/
val scanIssues: List<ResolvableIssue>
)
}

data class IssueTable(
val type: Type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import org.ossreviewtoolkit.model.config.Excludes
import org.ossreviewtoolkit.model.config.ScopeExclude
import org.ossreviewtoolkit.model.licenses.LicenseView
import org.ossreviewtoolkit.model.orEmpty
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.DependencyRow
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.IssueTable
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.ProjectTable
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.ProjectTable.Row
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.ResolvableIssue
import org.ossreviewtoolkit.plugins.reporters.statichtml.ReportTable.ResolvableViolation
import org.ossreviewtoolkit.reporter.HowToFixTextProvider
Expand Down Expand Up @@ -73,7 +73,7 @@ internal object ReportTableModelMapper {

val pkg = input.ortResult.getPackageOrProject(id)?.metadata

DependencyRow(
Row(
id = id,
sourceArtifact = pkg?.sourceArtifact.orEmpty(),
vcsInfo = pkg?.vcsProcessed.orEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class StaticHtmlReporter : Reporter {
}
}

private fun TBODY.projectRow(projectId: String, rowIndex: Int, row: ReportTable.DependencyRow) {
private fun TBODY.projectRow(projectId: String, rowIndex: Int, row: ProjectTable.Row) {
// Only mark the row as excluded if all scopes the dependency appears in are excluded.
val rowExcludedClass =
if (row.scopes.isNotEmpty() && row.scopes.all { it.value.isNotEmpty() }) "ort-excluded" else ""
Expand Down

0 comments on commit e8a563a

Please sign in to comment.