Last active
July 15, 2019 15:49
-
-
Save ilyapuchka/f27ec248c2ccac270e9e5003d458000d to your computer and use it in GitHub Desktop.
Run swiftlint only on files changed from the latest commit
This file contains hidden or 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
!/bin/sh | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
FILES=($(git ls-files -m | grep ".*\.swift$" | grep -v ".*R.generated.swift$")) | |
if [[ ${FILES[@]} ]]; then | |
export "SCRIPT_INPUT_FILE_COUNT"="${#FILES[@]}" | |
for i in "${!FILES[@]}"; do | |
export "SCRIPT_INPUT_FILE_$i"="${FILES[$i]}" | |
done | |
$SRCROOT/../Utils/swiftlint autocorrect --use-script-input-files | |
$SRCROOT/../Utils/swiftlint lint --use-script-input-files | |
fi | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment