Last active
April 25, 2018 11:26
-
-
Save mohammad19991/61b6619c83d489a6ce9615f692cda251 to your computer and use it in GitHub Desktop.
swiftlint script to check modified or added files in git.
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
#if [ "${CONFIGURATION}" = "Debug" ]; then | |
if which swiftlint >/dev/null; then | |
count=0 | |
for file_path in $(git diff --diff-filter=ACM --name-only | grep ".*.swift$"); do | |
export SCRIPT_INPUT_FILE_$count=$file_path | |
count=$((count + 1)) | |
done | |
for file_path in $(git diff --cached --name-only --diff-filter=ACM | grep ".*.swift$"); do | |
export SCRIPT_INPUT_FILE_$count=$file_path | |
count=$((count + 1)) | |
done | |
export SCRIPT_INPUT_FILE_COUNT=$count | |
if (( $count > 0 )); then | |
swiftlint --config .swiftlint.yml --use-script-input-files | |
fi | |
else | |
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" | |
fi | |
#fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment