-
Notifications
You must be signed in to change notification settings - Fork 16
/
.scalafmt.conf
124 lines (104 loc) · 3.86 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
123
124
#!hocon
# NOTE: This is the scalafmt config for Personalization. It is based off of the default.conf with the following changes:
# - spaces.beforeContextBoundColon = true
# - verticalMultiline.arityThreshold = 2
# - rewrite.redundantBraces.methodBodies = false
#
version = "3.5.9"
runner.dialect = scala213
# Only format files tracked by git (we don't care what crazy you make that you don't commit ;)
project.git = true
# The Scala style guide is not explicit about alignment but does have multiple examples that show you should NOT align:
# https://docs.scala-lang.org/style/indentation.html#methods-with-numerous-arguments
# https://docs.scala-lang.org/style/control-structures.html#curly-braces
align.preset = none
# Bumped from the default of 80 because we live in the age of wide-screen laptops and 4K monitors not punch cards with
# 80 characters
# https://softwareengineering.stackexchange.com/questions/148677/why-is-80-characters-the-standard-limit-for-code-width)
maxColumn = 120
# Scala's standard style guide says to use 2 indent, it never recommends 4 (the default)
# https://docs.scala-lang.org/style/indentation.html
continuationIndent {
defnSite = 2
extendSite = 2
}
# We don't use the standard strip margin character "|" for anything else, yet
assumeStandardLibraryStripMargin = true
# Put a space before context bound in type parameter
spaces.beforeContextBoundColon = true
newlines {
# The Scala style guide is not explicit about blank lines but does have multiple examples of using them:
# https://docs.scala-lang.org/style/files.html
# https://docs.scala-lang.org/style/scaladoc.html#packages
topLevelStatements = [before]
# This looks kinda gross with the rest of the format. We take strides to ensure that we chop down long parameter lists.
sometimesBeforeColonInMethodReturnType = false
implicitParamListModifierForce = [after]
}
# Prevent wrapping of docstrings so that they appear on a single line
docstrings.wrap = false
# Chops down ALL method signatures with more than one argument.
# https://scalameta.org/scalafmt/docs/configuration.html#forcing-config-style
optIn.configStyleArguments = true
verticalMultiline {
# Chops down ALL method signatures when the line length exceeds `maxColumn` or `arityThreshold`. The default is 100
# which basically means only `maxColumn` will be hit. We've set this to 2 to force all arguments after the first
# will chopdown so that adding, removing, changing a single parameter is easily visible in a diff.
# https://scalameta.org/scalafmt/docs/configuration.html#vertical-multiline
arityThreshold = 2
atDefnSite = true
newlineAfterOpenParen = true
}
danglingParentheses {
exclude = []
}
rewrite {
# Adding "AvoidInfix" to the default because it's part of Scala's standard style guide,
# see https://docs.scala-lang.org/style/method-invocation.html#arity-1-infix-notation
rules = [AvoidInfix, PreferCurlyFors, RedundantBraces, RedundantParens, SortImports, SortModifiers]
# Do NOT remove braces around single-line methods.
# It is nice to be able to insert debug statements in existing code without reformatting.
# Also, adding braces around a block is a good escape hatch for breaking a line.
redundantBraces.methodBodies = false
sortModifiers.order = [
"override", "private", "protected", "implicit", "final", "sealed", "abstract", "lazy"
]
neverInfix.excludeFilters = [
# default exclusions
until
to
by
eq
ne
"should.*"
"contain.*"
"must.*"
in
ignore
be
taggedAs
thrownBy
synchronized
have
when
size
only
noneOf
oneElementOf
noElementsOf
atLeastOneElementOf
atMostOneElementOf
allElementsOf
inOrderElementsOf
theSameElementsAs
# non-default exclusions
and
or
not
like
min
max
]
}
# Allow trailing commas
trailingCommas = preserve # Options: always, preserve, never