-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftformat
127 lines (120 loc) · 5.23 KB
/
.swiftformat
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
125
126
127
# File options
--exclude Pods
# Rules
## Enabled
--enable andOperator
--enable anyObjectProtocol
--enable assertionFailures
--enable blankLinesBetweenScopes
--enable blockComments
--enable braces
--enable consecutiveBlankLines
--enable consecutiveSpaces
--enable duplicateImports
--enable elseOnSameLine
--enable emptyBraces
--enable extensionAccessControl
--enable fileHeader
--enable hoistPatternLet
--enable initCoderUnavailable
--enable isEmpty
--enable leadingDelimiters
--enable linebreakAtEndOfFile
--enable linebreaks
--enable modifierOrder
--enable preferDouble
--enable preferKeyPath
--enable redundantBackticks
--enable redundantBreak
--enable redundantClosure
--enable redundantExtensionACL
--enable redundantFileprivate
--enable redundantGet
--enable redundantInit
--enable redundantLet
--enable redundantLetError
--enable redundantNilInit
--enable redundantObjc
--enable redundantParens
--enable redundantPattern
--enable redundantRawValues
--enable redundantReturn
--enable redundantSelf
--enable redundantType
--enable redundantVoidReturnType
--enable semicolons
--enable sortedImports
--enable sortedSwitchCases
--enable spaceAroundBraces
--enable spaceAroundBrackets
--enable spaceAroundComments
--enable spaceAroundGenerics
--enable spaceAroundOperators
--enable spaceAroundParens
--enable spaceInsideBraces
--enable spaceInsideBrackets
--enable spaceInsideComments
--enable spaceInsideGenerics
--enable spaceInsideParens
--enable strongifiedSelf
--enable strongOutlets
--enable todos
--enable trailingClosures
--enable trailingSpace
--enable typeSugar
--enable void
--enable wrapEnumCases
--enable yodaConditions
## Disabled
--disable acronyms # -> More often than not this breaks API and Backend Call Implementations
--disable blankLinesAroundMark # -> Normally correct, but not for Comments after the MARK
--disable blankLinesAtEndOfScope # -> disabled until it is possible to add 1 line for classes, structs & enums, but 0 for func etc. --> https://github.com/nicklockwood/SwiftFormat/issues/261
--disable blankLinesAtStartOfScope # -> disabled until it is possible to add 1 line for classes, structs & enums, but 0 for func etc. --> https://github.com/nicklockwood/SwiftFormat/issues/261
--disable blankLinesBetweenImports # -> Normally correct, but I write the @testable import first, then a blank line and then the alphabetized list of imports
--disable enumNamespaces # -> Caseless enums should be avoided in my opinion
--disable indent # -> This destroys clarity in too many cases
--disable markTypes # -> MARK Comments are not always preferential
--disable numberFormatting # -> When working on banking related projects we have different formatting for things like bank codes than we have on normal numbers. Those can't be automatically detected.
--disable organizeDeclarations # -> Properties & Methods sometimes have more clarity when ordered semantically
--disable sortDeclarations # -> Too much overhead having to write // swiftformat:sort in files
--disable trailingCommas # -> A comma after the last element of a collection is never necessary
--disable unusedArguments # -> This destroys some Protocol implementations (applicationDidLaunch etc.)
--disable wrap # -> I have a widescreen monitor, I don't need wrapping
--disable wrapArguments # -> Normally I don't wrap arguments and if I do, it is decided on a case-by-case basis
--disable wrapAttributes # -> Wanted behavior: prev-line for func and computed properties, same-line for normal properties and types --> https://github.com/nicklockwood/SwiftFormat/issues/1232
--disable wrapConditionalBodies # -> Please don't! 1 line guard statements should always be written in one line in my opinion
--disable wrapSwitchCases # -> Sometimes having all cases in one line is okay!
--disable wrapMultilineStatementBraces # -> Objective-C is dying for many reasons ... and this is one of them!
# Format options
--allman false
--closurevoid remove
--elseposition same-line
--emptybraces spaced
--extensionacl on-extension
--guardelse same-line
--header "\n📄 {file}\n👨🏼💻 Author: Benno Kress\n"
--ifdef indent
--importgrouping alpha
--indent 4
--indentcase false
--linebreaks lf
--modifierorder optional,required,convenience,override,indirect,private,fileprivate,internal,public,open,private(set),fileprivate(set),internal(set),public(set),final,dynamic,lazy,static,class,weak,unowned,mutating,nonmutating,prefix,postfix
--operatorfunc spaced
--patternlet hoist
--ranges spaced
--redundanttype inferred
--self init-only
--semicolons inline
--shortoptionals always
--smarttabs enabled
--stripunusedargs always
--swiftversion 5.6
--tabwidth 4
--trimwhitespace always
--voidtype void
--xcodeindentation disabled
--yodaswap always
# Wait for wrapAttributes to support differentiation of stored and computed properties --> https://github.com/nicklockwood/SwiftFormat/issues/1232
# --funcattributes prev-line
# --typeattributes prev-line
# --varattributes same-line # but not for computed properties