passforios/scripts/swiftlint.sh
Danny Mösch d9bd0f3014
Update SwiftLint and SwiftFormat (#613)
* Update Swift version used by SwiftFormat

* Update SwiftLint version

* Rely on new virtual 'all' rule in SwiftLint

* Enable SwiftLint rule 'direct_return' rule and fix all violations

* Enable SwiftLint rule 'shorthand_optional_binding' rule and fix all violations

* Enable SwiftLint rule 'blanket_disable_command' rule and fix all violations
2023-04-23 13:01:37 -07:00

26 lines
707 B
Bash
Executable file

export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"
SWIFTLINT_VERSION="0.51.*"
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