@@ -4,18 +4,23 @@ import java.nio.file.Paths
4
4
5
5
import scala .concurrent .Await
6
6
import scala .concurrent .duration .Duration
7
- import scala .util .{Properties , Try }
7
+ import scala .sys .process ._
8
+ import scala .util .Properties
9
+ import scala .util .Try
10
+
8
11
import ch .epfl .scala .GithubDependencyGraphPlugin .autoImport ._
9
12
import ch .epfl .scala .githubapi ._
13
+ import gigahorse .FullResponse
14
+ import gigahorse .HttpClient
10
15
import gigahorse .support .asynchttpclient .Gigahorse
11
16
import sbt ._
12
17
import sbt .internal .util .complete ._
13
- import sjsonnew .shaded .scalajson .ast .unsafe .{JArray , JObject , JField , JString }
14
- import gigahorse .{FullResponse , HttpClient }
18
+ import sjsonnew .shaded .scalajson .ast .unsafe .JArray
19
+ import sjsonnew .shaded .scalajson .ast .unsafe .JField
20
+ import sjsonnew .shaded .scalajson .ast .unsafe .JObject
21
+ import sjsonnew .shaded .scalajson .ast .unsafe .JString
15
22
import sjsonnew .support .scalajson .unsafe .{Parser => JsonParser }
16
23
17
- import scala .sys .process ._
18
-
19
24
object AnalyzeDependencyGraph {
20
25
21
26
object Model {
@@ -139,18 +144,15 @@ object AnalyzeDependencyGraph {
139
144
}
140
145
141
146
private def getAllArtifacts (state : State ): Seq [String ] =
142
- getGithubManifest(state)
143
- .flatMap { manifests =>
144
- manifests.flatMap {
145
- case (_, manifest) =>
146
- manifest.resolved.values.toSeq.map(_.package_url)
147
- }
147
+ getGithubManifest(state).flatMap { manifests =>
148
+ manifests.flatMap {
149
+ case (_, manifest) =>
150
+ manifest.resolved.values.toSeq.map(_.package_url)
148
151
}
149
- .distinct
150
-
151
- private def translateToSemVer (string : String ): String =
152
- string.replaceAll(" ([a-zA-Z]+)" , " 0" ).replaceAll(" ([0-9]+)\\ .([0-9]+)\\ .([0-9]+)\\ .([0-9]+)" , " $1.$2.$3-$4" )
152
+ }.distinct
153
153
154
+ private def translateToSemVer (string : String ): String =
155
+ string.replaceAll(" ([a-zA-Z]+)" , " 0" ).replaceAll(" ([0-9]+)\\ .([0-9]+)\\ .([0-9]+)\\ .([0-9]+)" , " $1.$2.$3-$4" )
154
156
155
157
private def versionMatchesRange (versionStr : String , rangeStr : String ): Boolean = {
156
158
val range = rangeStr.replaceAll(" " , " " ).replace(" ," , " " )
@@ -175,7 +177,8 @@ object AnalyzeDependencyGraph {
175
177
}
176
178
177
179
private def analyzeCves (state : State ): State = {
178
- val vulnerabilities = getStateOrWarn(state, githubAlertsKey, " artifcats" , s " ${AnalyzeDependencies } alerts " ).getOrElse(Seq .empty)
180
+ val vulnerabilities =
181
+ getStateOrWarn(state, githubAlertsKey, " artifcats" , s " ${AnalyzeDependencies } alerts " ).getOrElse(Seq .empty)
179
182
val artifacts = getAllArtifacts(state)
180
183
vulnerabilities.foreach { v =>
181
184
val matches = vulnerabilityMatchesArtifacts(v, artifacts)
@@ -239,5 +242,5 @@ object AnalyzeDependencyGraph {
239
242
}
240
243
}
241
244
242
- private def githubToken ( ): String = Properties .envOrElse(" GITHUB_TOKEN" , " " )
245
+ private def githubToken (): String = Properties .envOrElse(" GITHUB_TOKEN" , " " )
243
246
}
0 commit comments