-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Adds a CI job that runs `swiftformat --lint` so that formatting is enforced. 2. Updates the pre-commit hook to use [git-format-staged](https://github.com/hallettj/git-format-staged) when formatting. 3. Removes the SwiftPM dependency on SwiftFormat, preferring mise. 4. Formats everything. Recommend reviewing by commit to see the changes that aren't formatting. Fixes #33
- Loading branch information
Showing
194 changed files
with
1,062 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
#!/bin/bash | ||
|
||
swift_files=$(git diff --diff-filter=d --staged --name-only -- '*.swift') | ||
# Do not run on merge | ||
if [[ $(git rev-parse -q --verify MERGE_HEAD) ]]; then | ||
exit 0 | ||
fi | ||
|
||
echo $swift_files | xargs swift run swiftformat --quiet | ||
ROOT="$(git rev-parse --show-toplevel)" | ||
SWIFT_FORMAT="mise x -- swiftformat" | ||
GIT_FORMAT_STAGED="$ROOT/Scripts/git-format-staged" | ||
CONFIG="${ROOT}/.swiftformat" | ||
|
||
echo $swift_files | xargs git add | ||
$SWIFT_FORMAT --version 1>/dev/null 2>&1 | ||
if [ $? -eq 0 ] | ||
then | ||
$GIT_FORMAT_STAGED --formatter "$SWIFT_FORMAT stdin --config "$CONFIG" --stdinpath '{}'" "*.swift" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// FakeModel.swift | ||
// Model.swift | ||
// AsyncWorker | ||
// | ||
// Created by Mark Johnson on 6/16/22. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.