2019-01-16 01:31:51 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
#
|
|
|
|
# script/swiftlint_runscript
|
|
|
|
# mas-cli
|
|
|
|
#
|
2019-01-19 04:37:51 +00:00
|
|
|
# Invokes SwiftLint from inside an Xcode run script build phase. Minimal output.
|
|
|
|
# https://github.com/realm/SwiftLint
|
2019-01-16 01:31:51 +00:00
|
|
|
#
|
|
|
|
|
2021-03-21 23:50:09 +00:00
|
|
|
if test -n "$JENKINS_URL"; then
|
|
|
|
echo "Skipping SwiftLint run script on CI, will run in Lint stage."
|
|
|
|
exit
|
2019-01-16 01:31:51 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# 😕 When run from Xcode, the command command doesn't support these options
|
|
|
|
# command --quiet --search swiftlint
|
|
|
|
# : command: --: invalid option
|
|
|
|
# : command: usage: command [-pVv] command [arg ...]
|
|
|
|
|
2021-03-21 23:50:09 +00:00
|
|
|
if command -v swiftlint >/dev/null; then
|
|
|
|
swiftlint autocorrect
|
|
|
|
swiftlint lint --quiet
|
2019-01-16 01:31:51 +00:00
|
|
|
else
|
2021-03-21 23:50:09 +00:00
|
|
|
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
|
2019-01-16 01:31:51 +00:00
|
|
|
fi
|