2022-05-23 10:54:11 -07:00
|
|
|
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"
|
|
|
|
|
|
2023-02-04 14:14:57 -08:00
|
|
|
SWIFTLINT_VERSION="0.50.*"
|
2020-08-28 18:29:15 +02:00
|
|
|
|
2020-12-23 20:26:58 -08:00
|
|
|
if [[ "${CI}" == "true" ]]; then
|
2020-08-28 18:29:15 +02:00
|
|
|
echo "Running in a Continuous Integration environment. Linting is skipped."
|
2020-12-30 15:38:03 +01:00
|
|
|
exit 0
|
2020-08-28 18:29:15 +02:00
|
|
|
fi
|
|
|
|
|
|
2020-12-30 15:44:11 +01:00
|
|
|
if [[ "${CONFIGURATION}" == "Release" ]]; then
|
2020-08-28 18:29:15 +02:00
|
|
|
echo "Running during a release build. Linting is skipped."
|
2020-12-30 15:38:03 +01:00
|
|
|
exit 0
|
2020-08-28 18:29:15 +02:00
|
|
|
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
|
|
|
|
|
|