Skip to content

Commit a09400d

Browse files
authored
[NFC] Update .swiftformat config for consistency (#6122)
`UserToolchain.swift` was formatted by `swift-format` with a config that's inconsistent with `.swiftformat` committed in the repository, primarily in its use of 2-space indentation. Reverted the commit that applies `swift-format`. Also updated `.swiftformat` with more tweaks that codify conventions already established in our repository. Applied new rules to `UserToolchain.swift`
1 parent 551d9fa commit a09400d

File tree

2 files changed

+677
-629
lines changed

2 files changed

+677
-629
lines changed

.swiftformat

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
1-
# file options
1+
## File options
22

33
--swiftversion 5.5
44
--exclude .build
55

6-
# format options
6+
## Formatting options
77

8-
--self insert
9-
--patternlet inline
10-
--stripunusedargs unnamed-only
8+
# Configure the placement of an extension's access control keyword.
9+
--extensionacl on-declarations
10+
11+
# #if indenting
1112
--ifdef no-indent
13+
14+
# Wrap lines that exceed the specified maximum width.
1215
--maxwidth 120
13-
--extensionacl on-declarations
1416

15-
# rules
17+
# Reposition `let` or `var` bindings within pattern.
18+
--patternlet inline
19+
20+
# Insert explicit `self` where applicable.
21+
--self insert
22+
23+
# Mark unused function arguments with `_`.
24+
--stripunusedargs unnamed-only
25+
26+
# Remove trailing space at end of a line.
27+
--trimwhitespace always
28+
29+
# Wrap `@attributes` onto a separate line.
30+
--funcattributes prev-line
31+
--typeattributes prev-line
32+
--varattributes prev-line
33+
34+
# Use `Void` for type declarations and `()` for values.
35+
--voidtype void
36+
37+
# Align wrapped function arguments or collection elements.
38+
--wraparguments before-first
39+
40+
## Rules
41+
42+
# Prefer `&&` over `,` comma in `if`, `guard` or `while` conditions.
43+
--disable andOperator

0 commit comments

Comments
 (0)