Skip to content

Instantly share code, notes, and snippets.

@smit9612
Created June 3, 2021 09:14
Show Gist options
  • Save smit9612/02f0c9961ffdcf63c29dd610840c239f to your computer and use it in GitHub Desktop.
Save smit9612/02f0c9961ffdcf63c29dd610840c239f to your computer and use it in GitHub Desktop.
#!/bin/bash
git diff --cached --name-only | grep "\.swift" | while read filename; do
if which swiftlint >/dev/null; then
swiftlint lint --path "$filename";
else
echo "warning: SwiftLint not installed, download from https://github.com/ realm/SwiftLint"
fi
done
git-format-staged --formatter "swiftformat stdin --stdinpath '{}'" "*.swift"
@smit9612
Copy link
Author

smit9612 commented Jun 3, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment