-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
.swiftformat
114 lines (107 loc) · 4.06 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
# SwiftFormat Config
# Version: 0.49.14
# Rules: https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md
# NOTE: Caveat with using both SwiftFormat and SwiftLint:
# It's possible that enabling or changing a rule could cause a warning in SwiftLint if rules are not aligned
# For this reason, after making a change to this file, run the following to ensure that swiftlint doesn't show any additional warnings
# "swiftformat . && swiftlint --quiet"
# TESTING A CHANGE: How to automatically run swiftformat to "Live Test" a change to this config
# 1. Install entr to watch changes to this file: brew install entr
# 2. Run: ls .swiftformat | entr -c sh -c "git add .swiftformat && git checkout . && swiftformat . && git -P diff && swiftlint --quiet"
# Excluded files and dirs
--exclude samples,testing,ads
--exclude Package.swift
# Enabled rules
--rules andOperator
--rules anyObjectProtocol
--rules assertionFailures
--rules blankLinesAroundMark
--rules blankLinesAtEndOfScope
--rules blankLinesBetweenScopes
--rules braces
--rules consecutiveBlankLines
--rules consecutiveSpaces
--rules duplicateImports
--rules elseOnSameLine
--rules emptyBraces
--rules enumNamespaces
--rules extensionAccessControl
--rules fileHeader
--rules hoistPatternLet
--rules indent
--rules initCoderUnavailable
--rules isEmpty # (opt-in)
--rules leadingDelimiters
--rules linebreakAtEndOfFile
--rules linebreaks
--rules modifierOrder
--rules preferKeyPath
--rules redundantBackticks
--rules redundantBreak
--rules redundantClosure
--rules redundantExtensionACL
--rules redundantGet
--rules redundantInit
--rules redundantLet
--rules redundantLetError
--rules redundantNilInit
--rules redundantObjc
--rules redundantParens
--rules redundantPattern
--rules redundantRawValues
--rules redundantReturn
--rules redundantSelf
--rules redundantType
--rules redundantVoidReturnType
--rules semicolons
--rules sortedImports
--rules spaceAroundBraces
--rules spaceAroundBrackets
--rules spaceAroundComments
--rules spaceAroundGenerics
--rules spaceAroundOperators
--rules spaceAroundParens
--rules spaceInsideBraces
--rules spaceInsideBrackets
--rules spaceInsideComments
--rules spaceInsideGenerics
--rules spaceInsideParens
--rules strongifiedSelf
--rules strongOutlets
--rules todos
--rules trailingClosures
--rules trailingCommas
--rules trailingSpace
--rules typeSugar
--rules void
--rules wrap
--rules wrapArguments
--rules wrapAttributes
--rules wrapEnumCases # (opt-in)
--rules yodaConditions
# Disabled Rules
# --rules acronyms # (opt-in) # capitalizes acronyms, ex varWithUrl -> varWithURL, methodWithId() -> methodWithID()
# --rules blankLinesAtStartOfScope # removes the first blank line in classes, structs, funcs etc
# --rules blankLinesBetweenImports # (opt-in) # removes blank line between imports
# --rules blockComments # (opt-in) # changes all block comments i.e. /* ... */ to // style comments
# --rules markTypes # (opt-in) # adds various "// MARK: -" sections at the top of classes, extensions
# --rules numberFormatting # makes numbers like 123_456_789
# --rules organizeDeclarations # (opt-in) # adds Internal, Private, Lifecycle sections and re-orders a lot of code
# --rules preferDouble # (opt-in) # Replaces occurrences of CGFloat with Double
# --rules sortedSwitchCases # (opt-in) # sorts cases in enums
# --rules unusedArguments # changes unused args to an underscore, too many changes
# --rules wrapConditionalBodies # (opt-in) # moves the return in a guard on a new line
# --rules wrapMultilineStatementBraces # puts brace after multiline statement on new line, swiftlint conflict
# --rules wrapSwitchCases # (opt-in) # splits "case .one, .two:" onto 2 lines
# Options
--extensionacl on-declarations
--header "/*\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed under the license found in the\n * LICENSE file in the root directory of this source tree.\n */"
--ifdef no-indent
--importgrouping "testable-first"
--indent 2
--indentstrings true
--modifierorder open, override
--redundanttype "inferred"
--swiftversion 5
--wraparguments before-first
--xcodeindentation enabled