Skip to content

Commit 8c5e777

Browse files
authored
Move swiftformat options to a config file (#13423)
1 parent 6c5b8b7 commit 8c5e777

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

.swiftformat

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Formatting Options - Mimic Google style
2+
--indent 2
3+
--maxwidth 100
4+
--wrapparameters afterfirst
5+
6+
# Disabled Rules
7+
8+
# Too many of our swift files have simplistic examples. While technically
9+
# it's correct to remove the unused argument labels, it makes our examples
10+
# look wrong.
11+
--disable unusedArguments
12+
13+
# We prefer trailing braces.
14+
--disable wrapMultilineStatementBraces

scripts/style.sh

+4-22
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,10 @@ function join() {
9393

9494
clang_options=(-style=file)
9595

96-
# Rules to disable in swiftformat:
97-
swift_disable=(
98-
# sortedImports is broken, sorting into the middle of the copyright notice.
99-
sortedImports
100-
101-
# Too many of our swift files have simplistic examples. While technically
102-
# it's correct to remove the unused argument labels, it makes our examples
103-
# look wrong.
104-
unusedArguments
105-
106-
# We prefer trailing braces.
107-
wrapMultilineStatementBraces
108-
)
109-
110-
swift_options=(
111-
# Mimic Objective-C style.
112-
--indent 2
113-
--maxwidth 100
114-
--wrapparameters afterfirst
115-
116-
--disable $(join , "${swift_disable[@]}")
117-
)
96+
# Swift formatting options for the repo should be configured in
97+
# https://github.com/firebase/firebase-ios-sdk/blob/main/.swiftformat.
98+
# These may be overriden with additional `.swiftformat` files in subdirectories.
99+
swift_options=()
118100

119101
if [[ $# -gt 0 && "$1" == "test-only" ]]; then
120102
test_only=true

0 commit comments

Comments
 (0)