passforios/scripts/swiftlint.sh

25 lines
641 B
Bash
Raw Normal View History

2021-03-06 15:26:42 +01:00
SWIFTLINT_VERSION="0.43.*"
2020-12-23 20:26:58 -08:00
if [[ "${CI}" == "true" ]]; then
echo "Running in a Continuous Integration environment. Linting is skipped."
exit 0
fi
if [[ "${CONFIGURATION}" == "Release" ]]; then
echo "Running during a release build. Linting is skipped."
exit 0
fi
if which swiftlint > /dev/null; then
if [[ "$(swiftlint version)" == $SWIFTLINT_VERSION ]]; then
swiftlint --strict
else
echo "Failure: SwiftLint $SWIFTLINT_VERSION is required. Install it or update the build script to use a newer version."
exit 1
fi
else
echo "Failure: SwiftLint not installed. Get it via 'brew install swiftlint'."
exit 2
fi