Skip to content

Commit 83462f3

Browse files
author
Tebogo Selahle
committed
refactor: scalafmt run
1 parent 1ac725b commit 83462f3

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th
103103
// create closure local used for capturing
104104
createClosureBindingInformation(scope.lookupSelfInOuterScope.toSet)
105105
.collect { case (_, name, _, Some(closureBindingId)) =>
106-
val capturingLocal = localNode(node.body, name, name, Defines.Any, closureBindingId = Option(closureBindingId))
106+
val capturingLocal =
107+
localNode(node.body, name, name, Defines.Any, closureBindingId = Option(closureBindingId))
107108
scope.addToScope(capturingLocal.name, capturingLocal)
108109
}
109110
val baseStmtBlockAst = astForMethodBody(node.body, optionalStatementList)
@@ -224,13 +225,13 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th
224225
.distinctBy(_.name)
225226
.map {
226227
case i if i.name == Defines.Self => scope.lookupSelfInOuterScope
227-
case i => scope.lookupVariableInOuterScope(i.name)
228+
case i => scope.lookupVariableInOuterScope(i.name)
228229
}
229230
.filter(_.iterator.nonEmpty)
230231
.flatten
231232
.toSet
232233

233-
val selfLocal = scope.lookupSelfInOuterScope.toSet
234+
val selfLocal = scope.lookupSelfInOuterScope.toSet
234235
val capturedNodes = capturedLocalNodes ++ selfLocal
235236

236237
val capturedIdentifiers = baseStmtBlockAst.nodes.collect {
@@ -627,7 +628,9 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th
627628
}
628629
}
629630

630-
private def createClosureBindingInformation(capturedNodes: Set[DeclarationNew]): Set[(DeclarationNew, String, String, Option[String])] = {
631+
private def createClosureBindingInformation(
632+
capturedNodes: Set[DeclarationNew]
633+
): Set[(DeclarationNew, String, String, Option[String])] = {
631634
capturedNodes
632635
.collect {
633636
case local: NewLocal =>

joern-cli/frontends/rubysrc2cpg/src/test/scala/io/joern/rubysrc2cpg/querying/DoBlockTests.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,7 @@ class DoBlockTests extends RubyCode2CpgFixture {
546546
}
547547

548548
"A `self` reference in a lambda" should {
549-
val cpg = code(
550-
"""
549+
val cpg = code("""
551550
|foo("something") { |x| send x }
552551
|""".stripMargin)
553552

joern-cli/frontends/rubysrc2cpg/src/test/scala/io/joern/rubysrc2cpg/querying/ErbTests.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,7 @@ class ErbTests extends RubyCode2CpgFixture {
456456
case xs => fail(s"Expected one local for self, got ${xs.name.mkString("[", ",", "]")}")
457457
}
458458

459-
inside(
460-
cpg.method.fullNameExact("Test0.rb:<main>.Admin.UsersController.show.<lambda>0").local.name("self").l) {
459+
inside(cpg.method.fullNameExact("Test0.rb:<main>.Admin.UsersController.show.<lambda>0").local.name("self").l) {
461460
case selfLocal :: Nil =>
462461
selfLocal.closureBindingId shouldBe Some("Test0.rb:<main>.Admin.UsersController.show.<lambda>0.self")
463462
case xs => fail(s"Expected one local for self, got ${xs.name.mkString("[", ",", "]")}")

0 commit comments

Comments
 (0)