summaryrefslogtreecommitdiffhomepage
path: root/ios/.swiftformat
blob: 7c599d7ee0bb29160b630203e35227e8b3968f07 (plain)
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
# file options
--exclude Build, .spm, MullvadVPNScreenshots/SnapshotHelper.swift, PacketTunnelCore/Daita/Maybenot.swift

# general options
--swiftversion 5.8

# format options
--indent 4
# Google suggests 100, but Mullvad historically uses 120
--maxwidth 120
# The cardinal rules of Google Swift style for line-wrapping are:
  # If the entire declaration, statement, or expression fits on one line, then do that.
  # All elements must fit on the same line, or each element must be on its own line.
--wraparguments before-first
--wrapcollections before-first
--wrapternary before-operators
--redundanttype inferred
--ifdef no-indent
# Use K&R brace style, which is what Apple also uses
--allman false
# Use consistent ordering for member modifiers.
--modifierorder
--disable                         \
initCoderUnavailable,             \
unusedArguments,                  \
redundantRawValues,               \
preferKeyPath,                    \
extensionAccessControl,           \
hoistTry,                         \
# Do not reorganize declarations
organizeDeclarations,             \
# Do not reorder switch case statements
sortedSwitchCases,                \
# Do not add // MARK: ClassName before every type
markTypes,                        \
# disable enum imports since it seems borken
enumNamespaces


--rules                           \
blankLinesAroundMark,             \
blankLinesAtEndOfScope,           \
blankLinesAtStartOfScope,         \
blankLinesBetweenScopes,          \
braces,                           \
consecutiveBlankLines,            \
consecutiveSpaces,                \
duplicateImports,                 \
elseOnSameLine,                   \
emptyBraces,                      \
enumNamespaces,                   \
extensionAccessControl,           \
hoistPatternLet,                  \
indent,                           \
leadingDelimiters,                \
linebreakAtEndOfFile,             \
redundantInit,                    \
redundantParens,                  \
redundantPattern,                 \
redundantRawValues,               \
redundantType,                    \
redundantVoidReturnType,          \
semicolons,                       \
sortImports,                      \
spaceAroundBraces,                \
spaceAroundBrackets,              \
spaceAroundComments,              \
spaceAroundGenerics,              \
spaceAroundOperators,             \
spaceAroundParens,                \
spaceInsideBraces,                \
spaceInsideBrackets,              \
spaceInsideComments,              \
spaceInsideGenerics,              \
spaceInsideParens,                \
todos,                            \
trailingClosures,                 \
trailingCommas,                   \
trailingSpace,                    \
typeSugar,                        \
void,                             \
wrap,                             \
wrapArguments,                    \
wrapAttributes