2021-03-29 00:16:37 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
#
|
|
|
|
# script/format
|
|
|
|
# mas
|
|
|
|
#
|
|
|
|
# Linting checks for development and CI.
|
|
|
|
#
|
|
|
|
# Automatically formats and fixes style violations using various tools.
|
|
|
|
# Additionally runs `lint` to report any remaining style violations.
|
|
|
|
#
|
|
|
|
# Please keep in sync with script/lint.
|
|
|
|
#
|
|
|
|
|
|
|
|
echo "==> 🚨 Formatting mas"
|
|
|
|
|
|
|
|
for LINTER in shfmt swift-format swiftformat swiftlint; do
|
|
|
|
if [[ ! -x "$(command -v ${LINTER})" ]]; then
|
2021-03-29 00:40:44 +00:00
|
|
|
echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'."
|
2021-03-29 00:16:37 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "--> 🕊️ Swift"
|
2021-04-28 21:50:29 +00:00
|
|
|
for SOURCE in Package.swift Sources Tests; do
|
|
|
|
swiftformat ${SOURCE}
|
2021-03-29 00:16:37 +00:00
|
|
|
swift-format format --in-place --configuration .swift-format --recursive ${SOURCE}
|
2021-04-28 21:50:29 +00:00
|
|
|
swiftlint lint --fix --strict ${SOURCE}
|
2021-03-29 00:16:37 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "--> 📜 Bash"
|
|
|
|
shfmt -i 2 -l -w contrib/ script/
|
|
|
|
|
|
|
|
script/lint
|