Skip to content

Commit c4284ff

Browse files
committed
scalafmt
on-behalf-of: @e-solutions-GmbH <[email protected]>
2 parents f74019b + 391a02b commit c4284ff

File tree

7 files changed

+55
-31
lines changed

7 files changed

+55
-31
lines changed

src/main/scala/com/github/sbt/sbom/BomExtractor.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ class BomExtractor(settings: BomExtractorParams, report: UpdateReport, rootModul
274274
}
275275
}
276276

277-
private def moduleGraph: ModuleGraph = SbtUpdateReport.fromConfigurationReport(configurationReport, rootModuleID, log)
277+
private def moduleGraph: ModuleGraph =
278+
SbtUpdateReport.fromConfigurationReport(configurationReport, rootModuleID, log)
278279
}
279280

280281
private def toCycloneDxProjectType(e: ProjectType): Component.Type = {
@@ -312,7 +313,12 @@ class BomExtractor(settings: BomExtractorParams, report: UpdateReport, rootModul
312313
}
313314

314315
object BomExtractor {
315-
private[sbom] def purl(group: String, name: String, version: String, qualifier: Map[String, String] = Map[String, String]()): String = {
316+
private[sbom] def purl(
317+
group: String,
318+
name: String,
319+
version: String,
320+
qualifier: Map[String, String] = Map[String, String]()
321+
): String = {
316322
val convertedMap = new TM[String, String](qualifier.asJava)
317323

318324
new PackageURL(PackageURL.StandardTypes.MAVEN, group, name, version, convertedMap, null).canonicalize()

src/main/scala/com/github/sbt/sbom/BomExtractorParams.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ final case class BomExtractorParams(
2020
projectType: ProjectType,
2121
bomOutputPath: sbt.File
2222
)
23-

src/main/scala/com/github/sbt/sbom/BomSbtPlugin.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ object BomSbtPlugin extends AutoPlugin {
109109
)
110110
}
111111
}
112-

src/main/scala/com/github/sbt/sbom/BomSbtSettings.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ object BomSbtSettings {
109109
}
110110

111111
}
112-

src/main/scala/com/github/sbt/sbom/BomTask.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,3 @@ abstract class BomTask[T](protected val properties: BomTaskProperties) {
133133

134134
protected lazy val bomOutputPath: sbt.File = properties.bomOutputPath
135135
}
136-

src/main/scala/com/github/sbt/sbom/ProjectType.scala

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,43 @@
55
package com.github.sbt.sbom
66

77
sealed trait ProjectType
8-
case object APPLICATION extends ProjectType
9-
case object FRAMEWORK extends ProjectType
10-
case object LIBRARY extends ProjectType
11-
case object CONTAINER extends ProjectType
12-
case object PLATFORM extends ProjectType
13-
case object OPERATING_SYSTEM extends ProjectType
14-
case object DEVICE extends ProjectType
15-
case object DEVICE_DRIVER extends ProjectType
16-
case object FIRMWARE extends ProjectType
17-
case object FILE extends ProjectType
18-
case object MACHINE_LEARNING_MODEL extends ProjectType
19-
case object DATA extends ProjectType
20-
case object CRYPTOGRAPHIC_ASSET extends ProjectType
8+
case object APPLICATION extends ProjectType
9+
case object FRAMEWORK extends ProjectType
10+
case object LIBRARY extends ProjectType
11+
case object CONTAINER extends ProjectType
12+
case object PLATFORM extends ProjectType
13+
case object OPERATING_SYSTEM extends ProjectType
14+
case object DEVICE extends ProjectType
15+
case object DEVICE_DRIVER extends ProjectType
16+
case object FIRMWARE extends ProjectType
17+
case object FILE extends ProjectType
18+
case object MACHINE_LEARNING_MODEL extends ProjectType
19+
case object DATA extends ProjectType
20+
case object CRYPTOGRAPHIC_ASSET extends ProjectType
2121

2222
object ProjectType {
2323
def fromString(t: String): ProjectType = {
2424
val projType = t.trim().toUpperCase().replace("-", "_")
2525

26-
Vector(APPLICATION, FRAMEWORK, LIBRARY, CONTAINER, PLATFORM, OPERATING_SYSTEM,
27-
DEVICE, DEVICE_DRIVER, FIRMWARE, FILE, MACHINE_LEARNING_MODEL, DATA, CRYPTOGRAPHIC_ASSET).find(_.toString == projType)
28-
.getOrElse(throw new ClassNotFoundException(
29-
s"Given Project Type not found. Refer to ${ProjectType.getClass.getName} or the list of available type.")
26+
Vector(
27+
APPLICATION,
28+
FRAMEWORK,
29+
LIBRARY,
30+
CONTAINER,
31+
PLATFORM,
32+
OPERATING_SYSTEM,
33+
DEVICE,
34+
DEVICE_DRIVER,
35+
FIRMWARE,
36+
FILE,
37+
MACHINE_LEARNING_MODEL,
38+
DATA,
39+
CRYPTOGRAPHIC_ASSET
40+
).find(_.toString == projType)
41+
.getOrElse(
42+
throw new ClassNotFoundException(
43+
s"Given Project Type not found. Refer to ${ProjectType.getClass.getName} or the list of available type."
44+
)
3045
)
3146
}
3247
}

src/main/scala/com/github/sbt/sbom/SbtUpdateReport.scala

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,33 @@ object SbtUpdateReport {
6767
val qualifier = new mutable.HashMap[String, String]()
6868

6969
// Getting artifact with the same name as module name as purl qualifier
70-
val moduleArtifacts = moduleReport.artifacts.filter(ar => {
71-
ar._1.name.equals(moduleReport.module.name)
72-
}).sortBy { x => (x._1.`type`, x._1.classifier, x._1.hashCode()) }
70+
val moduleArtifacts = moduleReport.artifacts
71+
.filter(ar => {
72+
ar._1.name.equals(moduleReport.module.name)
73+
})
74+
.sortBy { x => (x._1.`type`, x._1.classifier, x._1.hashCode()) }
7375

7476
moduleArtifacts.size match {
7577
case 0 => () // ignore empty found artifacts
7678
case x =>
7779
if (x > 1 && log.isDefined) {
78-
log.foreach(_.warn("Multiple artifacts with the same name as module name are detected. Taking the first artifact match as Purl qualifier."))
80+
log.foreach(
81+
_.warn(
82+
"Multiple artifacts with the same name as module name are detected. Taking the first artifact match as Purl qualifier."
83+
)
84+
)
7985
}
8086
if (moduleArtifacts.head._1.`type`.nonEmpty) {
8187
// "jar" type will not be shown, since it's the default value of an artifact.
8288
if (moduleArtifacts.head._1.`type` != "jar") {
8389
qualifier.put("type", moduleArtifacts.head._1.`type`)
8490
}
8591
}
86-
moduleArtifacts.head._1.classifier.foreach(classifier => if (classifier.nonEmpty) {
87-
qualifier.put("classifier", classifier)
88-
})
92+
moduleArtifacts.head._1.classifier.foreach(classifier =>
93+
if (classifier.nonEmpty) {
94+
qualifier.put("classifier", classifier)
95+
}
96+
)
8997
}
9098

9199
qualifier.toMap
@@ -122,4 +130,3 @@ object SbtUpdateReport {
122130
ModuleGraph(root +: nodes, edges.flatten)
123131
}
124132
}
125-

0 commit comments

Comments
 (0)