-
Notifications
You must be signed in to change notification settings - Fork 7
/
.scalafmt.conf
96 lines (79 loc) · 2.99 KB
/
.scalafmt.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# This file has been automatically generated and should
# not be edited nor added to source control systems.
# To edit the original configurations go to
# https://github.com/alejandrohdezma/sbt-scalafmt-defaults/edit/master/.scalafmt.conf
version = "3.7.4"
# This value is automatically set based on your current `ThisBuild / scalaVersion` setting.
# `scala212source3`/`scala213source3` will be set if `scalaVersion` is set to any of those versions
# and `-Xsource:3` option is present under `ThisBuild / scalacOptions`.
runner.dialect = scala3
# Number of maximum characters in a column
maxColumn = 120
# Ensure newlines are added arround top level body definitions always
newlines.topLevelBodyIfMinStatements = [before,after]
newlines.topLevelBodyMinStatements = 1
# Allow line-overflow for comments and lines that would overflow even with a newline.
newlines.avoidForSimpleOverflow=[slc, tooLong]
# Ensure newlines around every statement except `case object` definitions
newlines.topLevelStatementBlankLines = [
{
blanks = 1,
minBreaks = 0,
regex = "^(?!((Term\\.Apply)|(Defn\\.Object)))"
}
]
# Ensure lines starting with the margin character `|` are indented differently
assumeStandardLibraryStripMargin = true
# Align everything that can be aligned
align.preset = most
align.multiline = false
align.tokens."+" = [
{
code = ":=", owner = "Term.ApplyInfix"
},
{
code = "+=", owner = "Term.ApplyInfix"
},
{
code = "++=", owner = "Term.ApplyInfix"
},
{
code = "--=", owner = "Term.ApplyInfix"
},
{
code = "-=", owner = "Term.ApplyInfix"
}
]
# Allow literal argument lists with newlines only once `maxColumn` is reached
binPack.literalArgumentLists = true
binPack.literalsIncludeSimpleExpr = true
binPack.literalsExclude = [ "Term.Name" ]
# Use ScalaDoc style and enable wrapping when reaching `maxColumn`
docstrings.style = "SpaceAsterisk"
docstrings.wrap = yes
docstrings.oneline = fold
rewrite.rules = [
AvoidInfix, # Avoid infix calls (except for operators)
RedundantBraces,
RedundantParens, # Ensure redundant parentheses are removed
SortModifiers, # Ensure modifiers like `implicit` or `final` are sorted the same
PreferCurlyFors, # Replaces parentheses into curly braces in for comprehensions that contain multiple enumerator generators
Imports
]
# Ensure redundant braces are removed
rewrite.redundantBraces.maxLines = 1
rewrite.redundantBraces.stringInterpolation = true
# Ensure a separate line is created for each selector within a `{...}` import.
rewrite.imports.expand = true
# Avoid ASCII tokens
rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}
# Select followed by curly braces should not start a chain
includeCurlyBraceInSelectChains = false
# Ensure code blocks inside markdown files get formated too
project.includePaths = ["glob:**.scala", "glob:**.sbt", "glob:**.sc", "glob:**.md"]
project.excludePaths = ["glob:**metals.sbt"]
rewrite.neverInfix.excludeFilters."+" = [ "should", "be", "must", "equalTo", "like", "and", "some", "lessThan" ]