diff --git a/.hooks/pre-commit b/.hooks/pre-commit index a363c193f..eaa6fa8ff 100755 --- a/.hooks/pre-commit +++ b/.hooks/pre-commit @@ -1,5 +1,7 @@ #!/bin/bash -git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do - swift run swiftformat "${line}" --quiet; - git add "$line"; -done \ No newline at end of file + +swift_files=$(git diff --diff-filter=d --staged --name-only -- '*.swift') + +echo $swift_files | xargs swift run swiftformat --quiet + +echo $swift_files | xargs git add diff --git a/.swiftformat b/.swiftformat index fd9dd5b4a..f4cccbf8c 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,7 +1,12 @@ ---indent 4 +# file config +--swiftversion 5.7 --exclude Pods,Tooling,**Dummy.swift +# format config + +--indent 4 + --wraparguments before-first --importgrouping testable-bottom