-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.scalafmt.conf
48 lines (40 loc) · 1.88 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
version = 3.7.17
// alignment is cute. i think it helps readability overall, but sometimes it produces silly results. consider restructuring code in those cases
align.preset = more
// 120 is choosen mostly because it seems to be a length at which the automatic wrapping very rarely bothers me.
// use manual linebreakes to emphasize the structure of your code.
maxColumn = 120
newlines.source = keep
// trailing commas are nice, because they are systematic – copy and reorder lines without worries.
// at the same time, a lot of code does not change often, so the additional commas are just noise.
// use good judgement
rewrite.trailingCommas.style = keep
// docstrings are the scaladoc comments (using /** */)
// single line folding reduces empty lines.
// wrapping is disabled because I do not believe in forcing word-wrap for flow text – use good judgement
docstrings.oneline = fold
docstrings.wrap = no
// one line per import just produces insanely long headers, though it is more convenient for modifications.
// unsure on what is best here, but for now, I read files more often than I have to edit their imports.
importSelectors = binPack
// the following cause operands on separate lines to have the same indentation
// naming is based on the default being indentation, and these “enable” no indentation
// https://scalameta.org/scalafmt/docs/configuration.html#indentoperator
indentOperator.exemptScope = all
indentOperator.includeRegex = "^.*=$"
indentOperator.excludeRegex = "^$"
// scala 2, scala 3, and sbt all use slightly different variants on scala syntax
// this defaults to scala 3 syntax, but has some well-known exceptions
runner.dialect = scala3
fileOverride {
"glob:**/scala-2/**" {
runner.dialect = scala213
}
"glob:**/*.sbt" {
runner.dialect = sbt1
}
// project files are sbt projects, sbt always uses scala 2.12
"glob:/project/*.scala" {
runner.dialect = scala212
}
}