2019-01-12 13:30:08 -07:00
|
|
|
#!/bin/bash -e
|
2019-01-15 18:31:51 -07:00
|
|
|
#
|
|
|
|
# script/lint
|
2019-01-18 21:37:51 -07:00
|
|
|
# mas
|
2019-01-15 18:31:51 -07:00
|
|
|
#
|
2021-03-21 19:17:28 -07:00
|
|
|
# Linting checks for development and CI.
|
2019-01-15 18:31:51 -07:00
|
|
|
#
|
2021-03-28 17:16:37 -07:00
|
|
|
# Reports style violations without making any modifications to the code.
|
|
|
|
#
|
|
|
|
# Please keep in sync with script/format.
|
|
|
|
#
|
2019-01-12 13:30:08 -07:00
|
|
|
|
|
|
|
echo "==> 🚨 Linting mas"
|
|
|
|
|
2021-03-28 17:16:37 -07:00
|
|
|
for LINTER in git swift-format swiftformat swiftlint; do
|
2021-03-22 00:01:52 -07:00
|
|
|
if [[ ! -x "$(command -v ${LINTER})" ]]; then
|
2021-03-28 17:40:44 -07:00
|
|
|
echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'."
|
2021-03-22 00:01:52 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-03-21 19:17:28 -07:00
|
|
|
echo "--> 🌳 Git"
|
|
|
|
git diff --check
|
|
|
|
|
2019-01-15 18:15:55 -07:00
|
|
|
echo
|
|
|
|
echo "--> 🕊️ Swift"
|
2021-03-28 17:16:37 -07:00
|
|
|
swiftformat --lint .
|
2021-03-21 22:25:18 -07:00
|
|
|
for SOURCE in mas MasKit MasKitTests; do
|
2021-03-28 17:16:37 -07:00
|
|
|
swift-format lint --configuration .swift-format --recursive ${SOURCE}
|
2021-03-21 22:25:18 -07:00
|
|
|
done
|
2021-03-28 17:16:37 -07:00
|
|
|
swiftlint lint --strict
|
2019-01-15 18:15:55 -07:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "--> 📜 Bash"
|
2021-03-28 17:16:37 -07:00
|
|
|
shfmt -d -i 2 -l -w contrib/ script/
|