Move swiftformat options to a config file (#13423)

This commit is contained in:
Andrew Heard authored and GitHub committed 2024-07-29 15:59:35 -04:00
1 parent 6c5b8b796d
commit 8c5e777a83
2 files changed
+18 -22

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
# Formatting Options - Mimic Google style
--indent 2
--maxwidth 100
--wrapparameters afterfirst
# Disabled Rules
# Too many of our swift files have simplistic examples. While technically
# it's correct to remove the unused argument labels, it makes our examples
# look wrong.
--disable unusedArguments
# We prefer trailing braces.
--disable wrapMultilineStatementBraces
+4 -22
View File
@@ -93,28 +93,10 @@ function join() {
clang_options=(-style=file)
# Rules to disable in swiftformat:
swift_disable=(
# sortedImports is broken, sorting into the middle of the copyright notice.
sortedImports
# Too many of our swift files have simplistic examples. While technically
# it's correct to remove the unused argument labels, it makes our examples
# look wrong.
unusedArguments
# We prefer trailing braces.
wrapMultilineStatementBraces
)
swift_options=(
# Mimic Objective-C style.
--indent 2
--maxwidth 100
--wrapparameters afterfirst
--disable $(join , "${swift_disable[@]}")
)
# Swift formatting options for the repo should be configured in
# https://github.com/firebase/firebase-ios-sdk/blob/main/.swiftformat.
# These may be overriden with additional `.swiftformat` files in subdirectories.
swift_options=()
if [[ $# -gt 0 && "$1" == "test-only" ]]; then
test_only=true