mas/script/lint

41 lines
893 B
Text
Raw Normal View History

2019-01-12 20:30:08 +00:00
#!/bin/bash -e
2019-01-16 01:31:51 +00:00
#
# script/lint
# mas
2019-01-16 01:31:51 +00:00
#
# Linting checks for development and CI.
2019-01-16 01:31:51 +00:00
#
2021-03-29 00:16:37 +00:00
# Reports style violations without making any modifications to the code.
#
# Please keep in sync with script/format.
#
2019-01-12 20:30:08 +00:00
echo "==> 🚨 Linting mas"
2021-05-08 22:49:32 +00:00
for LINTER in git markdownlint periphery shfmt swiftformat swiftlint; do
if [[ ! -x "$(command -v ${LINTER})" ]]; then
echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'."
exit 1
fi
done
echo "--> 🌳 Git"
git diff --check
2021-05-03 20:42:10 +00:00
echo
echo "--> 🖊 Markdown"
markdownlint --config .markdownlint.json .github .
2019-01-16 01:15:55 +00:00
echo
echo "--> 🕊️ Swift"
2021-04-26 23:44:17 +00:00
for SOURCE in Package.swift Sources Tests; do
swiftformat --lint ${SOURCE}
swift run swift-format lint --recursive ${SOURCE}
swiftlint lint --strict ${SOURCE}
2021-03-22 05:25:18 +00:00
done
2021-05-08 22:49:32 +00:00
periphery scan --retain-public --strict
2019-01-16 01:15:55 +00:00
echo
echo "--> 📜 Bash"
shfmt -d -i 2 -l contrib/ script/