Skip to content

Commit

Permalink
RedundantBraces: check comment in scala3 ArgClause
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jan 21, 2025
1 parent 7b885cf commit f81215e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,19 +428,18 @@ class RedundantBraces(implicit val ftoks: FormatTokens)
(plo eq t) || !plo.parent.contains(t)
case _ => true
}) &&
(style.dialect.allowSignificantIndentation ||
(t.parent match {
case Some(_: Term.Block) => true
case Some(_: Term.ArgClause) =>
val pft = ftoks.prevNonComment(left.ft)
pft.left match {
case _: T.LeftParen =>
isLeftParenReplacedWithBraceOnLeft(pft)
case _: T.LeftBrace => true
case _ => false
}
case _ => false
}) || okComment(ft) && !elseAfterRightBraceThenpOnLeft) =>
((t.parent match {
case Some(_: Term.Block) => true
case Some(_: Term.ArgClause) =>
val pft = ftoks.prevNonComment(left.ft)
pft.left match {
case _: T.LeftParen =>
isLeftParenReplacedWithBraceOnLeft(pft)
case _: T.LeftBrace => true
case _ => false
}
case _ => style.dialect.allowSignificantIndentation
}) || okComment(ft) && !elseAfterRightBraceThenpOnLeft) =>
(left, removeToken)
case ReplacementType.Replace if left.ft.right.is[T.LeftParen] =>
left -> replaceTokenBy(")", t.parent)(x =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,13 @@ runner.dialect = scala3
}
}
>>>
Idempotency violated
=> Diff (- obtained, + expected)
pending
- // Write here your test ....
- // don't forget to remove `pending`
+ // Write here your test ....
+ // don't forget to remove `pending`
}
"Service" must {
"have at least one test" in {
pending
// Write here your test ....
// don't forget to remove `pending`
}
}
<<< #4731 scala3 coloneol
runner.dialect = scala3
===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
val explored = Debug.explored.get()
logger.debug(s"Total explored: $explored")
if (!onlyUnit && !onlyManual)
assertEquals(explored, 1258954, "total explored")
assertEquals(explored, 1258958, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit f81215e

Please sign in to comment.