-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
Configuration (required)
Please paste the contents of your .scalafmt.conf
file here:
version: 3.7.2
runner.dialect: scala213
maxColumn: 120
docstrings.style: Asterisk
docstrings.wrap: "yes"
assumeStandardLibraryStripMargin: true
align.preset: none
trailingCommas: multiple
lineEndings: unix
continuationIndent {
callSite: 2
defnSite: 2
extendSite: 2
}
newlines {
alwaysBeforeElseAfterCurlyIf: false
beforeCurlyLambdaParams: never
}
verticalMultiline {
atDefnSite: true
newlineAfterOpenParen: true
arityThreshold: 5
}
Command-line parameters (required)
When I run scalafmt via CLI like this: sbt scalafmtAll
Steps
Given code like this:
package logging
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
def showThrowable(e: Throwable): String =
Option(e.getMessage)
.filter(_.nonEmpty)
.fold(e.getClass.getName)(m => s"${e.getClass.getName}: ${redactIds(m)}")
Problem
Scalafmt formats code like this:
package logging
object Log {
def redactIds(
s: String
): String = s.replaceAll("\\d{5,}", "<redacted>")
def showThrowable(
e: Throwable
): String =
Option(e.getMessage)
.filter(_.nonEmpty)
.fold(e.getClass.getName)(m => s"${e.getClass.getName}: ${redactIds(m)}")
Expectation
I would like the formatted output to look like this:
package logging
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
def showThrowable(e: Throwable): String =
Option(e.getMessage)
.filter(_.nonEmpty)
.fold(e.getClass.getName)(m => s"${e.getClass.getName}: ${redactIds(m)}")
Workaround
Use 3.7.1
Metadata
Metadata
Assignees
Labels
No labels