-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.scalafmt.conf
122 lines (104 loc) · 3.77 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# ScalaFmt version
version = 2.7.5
# General
# Max line length.
maxColumn = 100
# Avoid using trailing commas.
trailingCommas = never
# ScalaDoc format.
docstrings = ScalaDoc
# Strip margin alignment.
assumeStandardLibraryStripMargin = true
# Indentation and Alignment
align.preset = most
align.multiline = true
align.openParenCallSite = false
align.openParenDefnSite = false
align.tokens = [
# {code = "=", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))"},
# {code = ":", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))"},
{code = "//", owner = ".*"},
{code = "%", owner = "Term.ApplyInfix"},
{code = "%%", owner = "Term.ApplyInfix"},
{code = "=>", owner = "Case"},
{code = "<-"}
]
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
continuationIndent.ctorSite = 2
continuationIndent.extendSite = 2
continuationIndent.withSiteRelativeToExtends = 2
// Number of parameters at definition site before breaking to multiple lines.
verticalMultiline.atDefnSite = true
verticalMultiline.arityThreshold = 5
verticalMultiline.newlineBeforeImplicitKW = true
verticalMultiline.newlineAfterImplicitKW = true
verticalMultiline.newlineAfterOpenParen = true
danglingParentheses.defnSite = true
danglingParentheses.callSite = true
# Rewrite Rules
rewrite.rules = [SortImports, RedundantBraces, SortModifiers, PreferCurlyFors]
rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}
rewrite.redundantBraces.stringInterpolation = true
rewrite.redundantBraces.maxLines = 2
rewrite.redundantBraces.methodBodies = true
# Ignore transforming .map { _ + 2 } to .map(_ + 2)
rewrite.redundantBraces.parensForOneLineApply = false
# Modifiers ordering
rewrite.sortModifiers.order = [
"implicit", "final", "sealed", "abstract",
"override", "private", "protected", "lazy"
]
# Chaining
includeCurlyBraceInSelectChains = true
# No parenthesis methods cannot break the chain.
includeNoParensInSelectChains = false
# Keeps the line break before a dot if it already exists.
optIn.breakChainOnFirstMethodDot = true
# User cannot opt out of line breaks inside select chains.
optIn.breaksInsideChains = false
# New lines
newlines.alwaysBeforeTopLevelStatements = true
# If true, scalafmt may choose to put a newline before colon : at defs.
newlines.sometimesBeforeColonInMethodReturnType = false
newlines.neverInResultType = true
newlines.alwaysBeforeMultilineDef = false
# If `preserve` leave anonymous functions as is.
# Other options are `never` and `always` (do not try it).
newlines.afterCurlyLambda = preserve
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.avoidAfterYield = true
# Spaces
# Formats [A: T] as [A : T]. We do not want that.
spaces.beforeContextBoundColon = Never
# If true, formats ===( as === (
spaces.afterTripleEquals = true
# If true, formats `import a.b.{ c, d }`. If false, formats `import a.b.{c, d}`.
spaces.inImportCurlyBraces = false
# Prefer `foo(a, b)` over `foo( a, b )`.
spaces.inParentheses = false
# If ["##"] is specified as operator then formats `Generic[Foo] ## Repr` as `Generic[Foo]##Repr`.
spaces.neverAroundInfixTypes = []
# Add space between keyword and parenthesis. Prefer `if (a)` over `if(a)`.
spaces.afterKeywordBeforeParen = true
# If false, removes space in by-name parameter.
spaces.inByNameTypes = true
# If true, adds a single space after an operator method. For example `def <=> [T](that: T): Boolean`
spaces.afterSymbolicDefs = false
# Miscellaneous
# Only formats files tracked by git.
project.git = true
lineEndings = unix
encoding = "UTF-8"
onTestFailure = ""
# Force self annotations in a single line.
optIn.selfAnnotationNewline = false
# Force annotations on separate lines.
optIn.annotationNewlines = false
# If false, always insert a blank line before docstrings.
# If true, preserves blank line only if one exists before.
optIn.blankLineBeforeDocstring = false