Skip to content

Commit

Permalink
Update scalafmt-core to 3.5.8 (joernio#1557)
Browse files Browse the repository at this point in the history
* Update scalafmt-core to 3.5.8

* Reformat with scalafmt 3.5.8

Executed command: scalafmt --non-interactive

* Add 'Reformat with scalafmt 3.5.8' to .git-blame-ignore-revs
  • Loading branch information
scala-steward authored Jul 7, 2022
1 parent c9f4bac commit 8ec8372
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.5.8
f7015c7121a95cf4ea078fa5e703fefd7a86e9f2
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.5.3
version = 3.5.8
runner.dialect = scala213
preset = IntelliJ
maxColumn = 120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object BenchmarkTags {
object Simple extends Tag("Simple")
// Additional tags for JInfoFlow
object Context extends Tag("Context")
object Events extends Tag("Event")
object Events extends Tag("Event")

def TAGS: Seq[String] = Seq(
Aliasing.name,
Expand All @@ -63,7 +63,7 @@ object BenchmarkTags {
Library.name,
Simple.name,
Context.name,
Events.name,
Events.name
)

val confusionMatrix = mutable.Map.empty[String, Array[Int]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ArraysBenchmark6 extends IfspecArraysFixture(JAVA_EXT, 6) {
// ArraySizeStrongUpdate
class ArraysBenchmark7 extends IfspecArraysFixture(JAVA_EXT, 7) {

s"Arrays$benchmarkNo" should "report secure" taggedAs (Arrays, ExplicitFlows) in {
s"Arrays$benchmarkNo" should "report secure" taggedAs (Arrays, ExplicitFlows) in {
assertIsSecure(cpg.fieldAccess.code(".*secret"), cpg.call(".*println.*").argument(1))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class ExceptionsBenchmark4 extends IfspecExceptionsFixture(JAVA_EXT, 4) {
class ExceptionsBenchmark5 extends IfspecExceptionsFixture(JAVA_EXT, 5) {

s"Exceptions$benchmarkNo" should "report insecure" taggedAs (Exceptions, ImplicitFlows) in {
assertIsInsecure(cpg.call(".*nextInt.*").receiver, cpg.call.methodFullName(".*writeToDisk.*", ".*writeToDB.*").argument(1))
assertIsInsecure(
cpg.call(".*nextInt.*").receiver,
cpg.call.methodFullName(".*writeToDisk.*", ".*writeToDB.*").argument(1)
)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ class HighConditionalBenchmark12 extends IfspecHighConditionalFixture(JAVA_EXT,
assertIsSecure(cpg.call(".*reinit.*").argument, cpg.method("seePreview").methodReturn)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class SimpleBenchmark17 extends IfspecSimpleFixture(JAVA_EXT, 17) {

}


// Webstore3
class SimpleBenchmark18 extends IfspecSimpleFixture(JAVA_EXT, 18) {

Expand All @@ -167,4 +166,3 @@ class SimpleBenchmark18 extends IfspecSimpleFixture(JAVA_EXT, 18) {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ArraysBenchmark6 extends IfspecArraysFixture(JVM_EXT, 6) {
// ArraySizeStrongUpdate
class ArraysBenchmark7 extends IfspecArraysFixture(JVM_EXT, 7) {

s"Arrays$benchmarkNo" should "report secure" taggedAs (Arrays, ExplicitFlows) in {
s"Arrays$benchmarkNo" should "report secure" taggedAs (Arrays, ExplicitFlows) in {
assertIsSecure(cpg.fieldAccess.code(".*secret"), cpg.call(".*println.*").argument(1))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class ExceptionsBenchmark4 extends IfspecExceptionsFixture(JVM_EXT, 4) {
class ExceptionsBenchmark5 extends IfspecExceptionsFixture(JVM_EXT, 5) {

s"Exceptions$benchmarkNo" should "report insecure" taggedAs (Exceptions, ImplicitFlows) in {
assertIsInsecure(cpg.call(".*nextInt.*").receiver, cpg.call.methodFullName(".*writeToDisk.*", ".*writeToDB.*").argument(1))
assertIsInsecure(
cpg.call(".*nextInt.*").receiver,
cpg.call.methodFullName(".*writeToDisk.*", ".*writeToDB.*").argument(1)
)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ class HighConditionalBenchmark12 extends IfspecHighConditionalFixture(JVM_EXT, 1
assertIsSecure(cpg.call(".*reinit.*").argument, cpg.method("seePreview").methodReturn)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class SimpleBenchmark17 extends IfspecSimpleFixture(JVM_EXT, 17) {

}


// Webstore3
class SimpleBenchmark18 extends IfspecSimpleFixture(JVM_EXT, 18) {

Expand All @@ -167,4 +166,3 @@ class SimpleBenchmark18 extends IfspecSimpleFixture(JVM_EXT, 18) {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ abstract class BenchmarkFixture(
with Matchers
with BeforeAndAfterAll {

val semanticsFile: String = ProjectRoot.relativise("benchmarks/src/test/resources/default.semantics")
lazy val defaultSemantics: Semantics = Semantics.fromList(new Parser().parseFile(semanticsFile))
implicit val resolver: ICallResolver = NoResolve
val semanticsFile: String = ProjectRoot.relativise("benchmarks/src/test/resources/default.semantics")
lazy val defaultSemantics: Semantics = Semantics.fromList(new Parser().parseFile(semanticsFile))
implicit val resolver: ICallResolver = NoResolve
implicit lazy val engineContext: EngineContext = EngineContext(defaultSemantics, EngineConfig(maxCallDepth = 4))

private lazy val targetFiles = getListOfFiles(ProjectRoot.relativise(constructTargetFilePath))
Expand Down Expand Up @@ -146,9 +146,7 @@ class BenchmarkCpgContext {
}
case None =>
Failure(
new RuntimeException(
s"Unable to guess which language frontend to use to parse the benchmark at '$inputPath'"
)
new RuntimeException(s"Unable to guess which language frontend to use to parse the benchmark at '$inputPath'")
)
}
applyDefaultOverlays(cpg.get)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package io.joern.benchmarks.testfixtures

class IfspecFixture(category: String, fileExt: String, benchmarkNo: String)
extends BenchmarkFixture(
pkg = "ifspec",
category = category,
fileExt = fileExt,
benchmarkNo = benchmarkNo
)
extends BenchmarkFixture(pkg = "ifspec", category = category, fileExt = fileExt, benchmarkNo = benchmarkNo)

class IfspecAliasingFixture(fileExt: String, benchmarkNo: Int)
extends IfspecFixture(category = "Aliasing", fileExt = fileExt, benchmarkNo = benchmarkNo.toString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ package io.joern.benchmarks.testfixtures
import java.io.File

class JInfoFlowFixture(category: String, fileExt: String, benchmarkNo: String)
extends BenchmarkFixture(
pkg = "jinfoflow",
category = category,
fileExt = fileExt,
benchmarkNo = benchmarkNo
)
extends BenchmarkFixture(pkg = "jinfoflow", category = category, fileExt = fileExt, benchmarkNo = benchmarkNo)

class JInfoFlowBasicFixture(fileExt: String, benchmarkNo: Int)
extends JInfoFlowFixture(category = "Basic", fileExt = fileExt, benchmarkNo = benchmarkNo.toString)
Expand All @@ -19,9 +14,9 @@ class JInfoFlowEventsFixture(fileExt: String, benchmarkNo: Int)
extends JInfoFlowFixture(category = "Events", fileExt = fileExt, benchmarkNo = benchmarkNo.toString) {

override protected def getListOfFiles(dir: String): List[File] = {
val targetFiles = super.getListOfFiles(dir)
val eventFramework = new java.io.File(s"$dir${java.io.File.separator}eventframework")
val events = new java.io.File(s"$dir${java.io.File.separator}events")
val targetFiles = super.getListOfFiles(dir)
val eventFramework = new java.io.File(s"$dir${java.io.File.separator}eventframework")
val events = new java.io.File(s"$dir${java.io.File.separator}events")
val supportingFiles = eventFramework.listFiles() ++ events.listFiles()
targetFiles ++ supportingFiles.filter(_.isFile)
}
Expand Down
7 changes: 1 addition & 6 deletions console/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ val CirceVersion = "0.14.2"
val AmmoniteVersion = "2.5.3"
val ZeroturnaroundVersion = "1.15"

dependsOn(
Projects.semanticcpg,
Projects.macros,
Projects.c2cpg % Test,
Projects.x2cpg % "compile->compile;test->test"
)
dependsOn(Projects.semanticcpg, Projects.macros, Projects.c2cpg % Test, Projects.x2cpg % "compile->compile;test->test")

libraryDependencies ++= Seq(
"io.shiftleft" %% "codepropertygraph" % Versions.cpg,
Expand Down
4 changes: 2 additions & 2 deletions joern-cli/frontends/kotlin2cpg/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ libraryDependencies ++= Seq(
)

enablePlugins(JavaAppPackaging, LauncherJarPlugin)
trapExit := false
Test/fork := false
trapExit := false
Test / fork := false
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,13 @@ class DefaultTypeInfoProvider(environment: KotlinCoreEnvironment) extends TypeIn
Option(mapForEntity.get(BindingContext.CLASS.getKey))
.map(getSuperclassDescriptors)
.filter(_.asScala.nonEmpty)
.map(_.asScala.map { superClassDesc =>
TypeRenderer.render(superClassDesc.getDefaultType)
}.toList)
.map(
_.asScala
.map { superClassDesc =>
TypeRenderer.render(superClassDesc.getDefaultType)
}
.toList
)
.getOrElse(defaultValue)
}

Expand Down
16 changes: 8 additions & 8 deletions project/Projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ object Projects {
lazy val semanticcpg = project.in(file("semanticcpg"))
lazy val benchmarks = project.in(file("benchmarks"))

lazy val c2cpg = project.in(frontendsRoot / "c2cpg")
lazy val ghidra2cpg = project.in(frontendsRoot / "ghidra2cpg")
lazy val x2cpg = project.in(frontendsRoot / "x2cpg")
lazy val pysrc2cpg = project.in(frontendsRoot / "pysrc2cpg")
lazy val php2cpg = project.in(frontendsRoot / "php2cpg")
lazy val jssrc2cpg = project.in(frontendsRoot / "jssrc2cpg")
lazy val c2cpg = project.in(frontendsRoot / "c2cpg")
lazy val ghidra2cpg = project.in(frontendsRoot / "ghidra2cpg")
lazy val x2cpg = project.in(frontendsRoot / "x2cpg")
lazy val pysrc2cpg = project.in(frontendsRoot / "pysrc2cpg")
lazy val php2cpg = project.in(frontendsRoot / "php2cpg")
lazy val jssrc2cpg = project.in(frontendsRoot / "jssrc2cpg")
lazy val javasrc2cpg = project.in(frontendsRoot / "javasrc2cpg")
lazy val jimple2cpg = project.in(frontendsRoot / "jimple2cpg")
lazy val kotlin2cpg = project.in(frontendsRoot / "kotlin2cpg")
lazy val jimple2cpg = project.in(frontendsRoot / "jimple2cpg")
lazy val kotlin2cpg = project.in(frontendsRoot / "kotlin2cpg")
}

0 comments on commit 8ec8372

Please sign in to comment.