2019-01-12 20:30:08 +00:00
|
|
|
#!/bin/bash -e
|
2019-01-16 01:31:51 +00:00
|
|
|
#
|
|
|
|
# script/lint
|
2019-01-19 04:37:51 +00:00
|
|
|
# mas
|
2019-01-16 01:31:51 +00:00
|
|
|
#
|
2021-03-22 02:17:28 +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"
|
|
|
|
|
2024-02-18 20:16:50 +00:00
|
|
|
for LINTER in git markdownlint periphery shfmt swiftformat swiftlint yamllint; do
|
2021-03-22 07:01:52 +00:00
|
|
|
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-22 07:01:52 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-01-16 01:15:55 +00:00
|
|
|
echo "--> 🕊️ Swift"
|
2021-04-26 23:44:17 +00:00
|
|
|
for SOURCE in Package.swift Sources Tests; do
|
2021-04-26 22:10:17 +00:00
|
|
|
swiftformat --lint ${SOURCE}
|
2021-05-08 20:26:25 +00:00
|
|
|
swift run swift-format lint --recursive ${SOURCE}
|
2021-04-26 22:10:17 +00:00
|
|
|
swiftlint lint --strict ${SOURCE}
|
2021-03-22 05:25:18 +00:00
|
|
|
done
|
2021-06-09 02:28:43 +00:00
|
|
|
periphery scan
|
2019-01-16 01:15:55 +00:00
|
|
|
|
2024-02-18 20:16:50 +00:00
|
|
|
echo "--> 🌳 Git"
|
|
|
|
git diff --check
|
|
|
|
|
|
|
|
echo "--> 〽️ Markdown"
|
|
|
|
markdownlint --config .markdownlint.json .github .
|
|
|
|
|
|
|
|
echo "--> 🖊 YAML"
|
|
|
|
yamllint .
|
|
|
|
|
2019-01-16 01:15:55 +00:00
|
|
|
echo "--> 📜 Bash"
|
2021-06-09 01:56:27 +00:00
|
|
|
shellcheck --shell=bash script/*
|
2024-03-31 17:05:04 +00:00
|
|
|
shfmt \
|
|
|
|
--diff \
|
|
|
|
--list \
|
|
|
|
--indent 2 \
|
|
|
|
--case-indent \
|
|
|
|
contrib/ script/
|