Skip to content

Instantly share code, notes, and snippets.

@tvoklov
Last active May 19, 2023 21:07
Show Gist options
  • Save tvoklov/fa67b513b891b0e47bedc2b141b54b37 to your computer and use it in GitHub Desktop.
Save tvoklov/fa67b513b891b0e47bedc2b141b54b37 to your computer and use it in GitHub Desktop.
my preferred scalafmt configuration
version = 3.7.3
runner.dialect = scala3
align.preset = more
maxColumn = 80
align.multiline = true
align.stripMargin = true
assumeStandardLibraryStripMargin = true
indent.withSiteRelativeToExtends = 2
indent.relativeToLhsLastLine = [match, infix]
newlines.source = unfold
newlines.implicitParamListModifierForce = [before, after]
newlines.beforeMultiline = unfold
newlines.forceBeforeMultilineAssign = any
newlines.topLevelStatementBlankLines = [
{
blanks = 1
}
]
newlines.topLevelBodyIfMinStatements = [before, after]
danglingParentheses.defnSite = true
danglingParentheses.callSite = true
danglingParentheses.ctrlSite = true
danglingParentheses.tupleSite = true
danglingParentheses.exclude = [] // required cause verticalMultiline is on
verticalMultiline.atDefnSite = true
verticalMultiline.arityThreshold = 1
verticalMultiline.newlineAfterOpenParen = true
rewrite.rules = [RedundantBraces, RedundantParens, SortModifiers, PreferCurlyFors, Imports]
rewrite.redundantBraces.defnBodies = "noParams"
rewrite.redundantBraces.stringInterpolation = true
rewrite.sortModifiers.order = [
"implicit", "final", "sealed", "abstract",
"override", "private", "protected", "lazy"
]
rewrite.imports.sort = original
rewrite.imports.groups = [
["cats\\..*"],
["^(?!scala|java|volk|cats).*"],
["scala\\..*"],
["java\\..*"],
["volk\\..*"],
]
rewrite.trailingCommas.style = always
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = no
comments.wrap = standalone
docstrings.style = Asterisk
docstrings.removeEmpty = true
docstrings.oneline = unfold
docstrings.forceBlankLineBefore = true
project.git = true
spaces.beforeContextBoundColon = IfMultipleBounds
spaces.inImportCurlyBraces = true
spaces.inInterpolatedStringCurlyBraces = true
spaces.afterSymbolicDefs = true
includeNoParensInSelectChains = true
importSelectors = binPack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment