-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.swiftformat
117 lines (104 loc) · 8.17 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
#
# .swiftformat
#
# Configuration. Configure first two format options (swiftversion, header) if needed.
# Excluded files/directories. Uncomment the next line to define excluded files/directories in your project.
# --exclude
# Rules & options documentation: https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md
# Supported version of SwiftFormat: 0.46.x
# Format Options
--swiftversion 5.2
--allman false
--binarygrouping none
--commas inline
--comments indent
--decimalgrouping none
--elseposition same-line
--empty void
--exponentcase lowercase
--exponentgrouping disabled
--fractiongrouping disabled
--hexgrouping none
--hexliteralcase uppercase
--ifdef indent
--indent 4
--indentcase false
--importgrouping testable-bottom
--linebreaks lf
--maxwidth none
--octalgrouping none
--operatorfunc spaced
--patternlet hoist
--ranges spaced
--self remove
--semicolons inline
--stripunusedargs closure-only
--trimwhitespace always
--wraparguments preserve
--wrapcollections preserve
--trailingclosures map,flatMap
--nospaceoperators ...,..<
# All rules - only these will be respected. This is to avoid automatically opting-in to new rules when SwiftFormat is updated.
--rules andOperator,anyObjectProtocol,blankLinesAroundMark,blankLinesAtEndOfScope,blankLinesBetweenScopes,braces,consecutiveBlankLines,consecutiveSpaces,duplicateImports,elseOnSameLine,emptyBraces,hoistPatternLet,indent,leadingDelimiters,linebreakAtEndOfFile,modifierOrder,numberFormatting,redundantBreak,redundantExtensionACL,redundantFileprivate,redundantGet,redundantInit,redundantLet,redundantLetError,redundantNilInit,redundantObjc,redundantParens,redundantPattern,redundantReturn,redundantSelf,redundantVoidReturnType,semicolons,spaceAroundBraces,spaceAroundBrackets,spaceAroundComments,spaceAroundGenerics,spaceAroundOperators,spaceAroundParens,spaceInsideBraces,spaceInsideBrackets,spaceInsideComments,spaceInsideGenerics,spaceInsideParens,strongOutlets,strongifiedSelf,todos,trailingClosures,trailingCommas,trailingSpace,typeSugar,unusedArguments,void,fileHeader,yodaConditions,isEmpty,wrapArguments,redundantRawValues,sortedImports,wrap,blankLinesAtStartOfScope
# Enabled rules
--enable andOperator # Prefer comma over && in if, guard or while conditions.
--enable anyObjectProtocol # Prefer AnyObject over class in protocol definitions.
--enable blankLinesAroundMark # Insert blank line before and after MARK: comments.
--enable blankLinesAtEndOfScope # Remove trailing blank line at the end of a scope.
--enable blankLinesBetweenScopes # Insert blank line before class, struct, enum, extension, protocol or function declarations.
--enable braces # Wrap braces in accordance with selected style (K&R or Allman). Options: allman
--enable consecutiveBlankLines # Replace consecutive blank lines with a single blank line.
--enable consecutiveSpaces # Replace consecutive spaces with a single space.
--enable duplicateImports # Remove duplicate import statements.
--enable elseOnSameLine # Place else, catch or while keyword in accordance with current style (same or next line). Options: --elseposition
--enable emptyBraces # Remove whitespace inside empty braces.
--enable hoistPatternLet # Reposition let or var bindings within pattern. Options: --patternlet
--enable indent # Indent code in accordance with the scope level. Options: --indent, --tabwidth, --indentcase, --ifdef, --xcodeindentation
--enable leadingDelimiters # Move leading delimiters to the end of the previous line.
--enable linebreakAtEndOfFile # Add empty blank line at end of file. Options: --linebreaks
--enable modifierOrder # Use consistent ordering for member modifiers. Options: --modifierorder
--enable numberFormatting # Use consistent grouping for numeric literals. Options: --decimalgrouping, --binarygrouping, --octalgrouping, --hexgrouping, --fractiongrouping, --exponentgrouping, --hexliteralcase, --exponentcase
--enable redundantBreak # Remove redundant break in switch case.
--enable redundantExtensionACL # Remove redundant access control specifiers.
--enable redundantFileprivate # Prefer private over fileprivate where equivalent.
--enable redundantGet # Remove unneeded get clause inside computed properties.
--enable redundantInit # Remove explicit init if not required.
--enable redundantLet # Remove redundant let/var from ignored variables.
--enable redundantLetError # Remove redundant let error from catch clause.
--enable redundantNilInit # Remove redundant nil default value (Optional vars are nil by default).
--enable redundantObjc # Remove redundant @objc annotations.
--enable redundantParens # Remove redundant parentheses.
--enable redundantPattern # Remove redundant pattern matching parameter syntax.
--enable redundantReturn # Remove unneeded return keyword.
--enable redundantSelf # Insert/remove explicit self where applicable. Options: --self, --selfrequired
--enable redundantVoidReturnType # Remove explicit Void return type.
--enable semicolons # Remove semicolons. Options: --semicolons
--enable spaceAroundBraces # Add or remove space around curly braces.
--enable spaceAroundBrackets # Add or remove space around square brackets.
--enable spaceAroundComments # Add space before and/or after comments.
--enable spaceAroundGenerics # Remove space around angle brackets.
--enable spaceAroundOperators # Add or remove space around operators or delimiters. Options: --operatorfunc, --nospaceoperators
--enable spaceAroundParens # Add or remove space around parentheses.
--enable spaceInsideBraces # Add or remove space inside curly braces.
--enable spaceInsideBrackets # Remove space inside square brackets.
--enable spaceInsideComments # Add leading and/or trailing space inside comments.
--enable spaceInsideGenerics # Remove space inside angle brackets.
--enable spaceInsideParens # Remove space inside parentheses.
--enable strongOutlets # Remove weak specifier from @IBOutlet properties.
--enable strongifiedSelf # Remove backticks around self in Optional unwrap expressions.
--enable todos # Use correct formatting for TODO:, MARK: or FIXME: comments.
--enable trailingClosures # Use trailing closure syntax where applicable. Options: --trailingclosures
--enable trailingCommas # Add or remove trailing comma from the last item in a collection literal. Options: --commas
--enable trailingSpace # Remove trailing space at end of a line. Options: --trimwhitespace
--enable typeSugar # Prefer shorthand syntax for Arrays, Dictionaries and Optionals.
--enable unusedArguments # Mark unused function arguments with _. Options: --stripunusedargs
--enable void # Use Void for type declarations and () for values. Options: --empty
--enable fileHeader # Use specified source file header template for all files. Options: --header
--enable yodaConditions # Prefer constant values to be on the right-hand-side of expressions.
# Disabled rules
--disable isEmpty # In rare cases, the isEmpty rule may insert an isEmpty call for a type that doesn't implement that property, breaking the program. For this reason, the rule is disabled by default, and must be manually enabled via the --enable isEmpty option.
--disable wrapArguments # Align wrapped function arguments or collection elements. Options: --wraparguments, --wrapparameters, --wrapcollections, --closingparen
--disable redundantRawValues # Remove redundant raw string values for enum cases.
--disable sortedImports # Sort import statements alphabetically.
--disable wrap # Wrap lines that exceed the specified maximum width. Options: --maxwidth
--disable blankLinesAtStartOfScope # Remove leading blank line at the start of a scope.