Skip to content

Commit

Permalink
♻️ (tuist): Refactor swiftlint post build script
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Dec 10, 2023
1 parent d362982 commit 066e4d5
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions Scripts/SwiftLintRunScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,8 @@ if ! command -v swiftlint &> /dev/null; then
exit 1
fi

if ! command -v gxargs &> /dev/null; then
echo "error: gxargs not installed, download from https://www.gnu.org/software/findutils/"
echo "error: or install with brew install findutils"
exit 1
fi

SCRIPT_PATH=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
ROOT_DIR=$(realpath "$SCRIPT_DIR/..")

echo "SCRIPT_PATH: $SCRIPT_PATH"
echo "ROOT_DIR: $ROOT_DIR"
echo "SCRIPT_DIR: $SCRIPT_DIR"

which swiftlint
which gxargs

git diff --name-status origin/main \
| grep -E "^A|^M" | sed "s/^[AM]\t//g" \
| grep -E "\.swift\$$" \
| gxargs -I '{}' -d '\n' --no-run-if-empty swiftlint --config $ROOT_DIR/.swiftlint.yml --reporter xcode $ROOT_DIR/{}
swiftlint --config $ROOT_DIR/.swiftlint.yml --reporter xcode

0 comments on commit 066e4d5

Please sign in to comment.