mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
We can somewhat easily get it passing and integrate nice with reviewdog by adding a TODO file for the rules that we had enabled, so that we don't need to correct anything now, but we still get alerted for new offenses. So I say let's keep it and enforce it from now on.
57 lines
1.4 KiB
Bash
Executable File
57 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Runs linters and pipes their output to reviewdog so it annotates a pull request with the issues found
|
|
#
|
|
|
|
set -o pipefail
|
|
|
|
echo "::group:: Running prettier with reviewdog 🐶 ..."
|
|
|
|
"$(npm root)/.bin/prettier" --check . 2>&1 | sed --regexp-extended 's/(\[warn\].*)$/\1 File is not properly formatted./' \
|
|
| reviewdog \
|
|
-efm="%-G[warn] Code style issues found in %s. Run Prettier to fix. File is not properly formatted." \
|
|
-efm="[%tarn] %f %m" \
|
|
-efm="%E[%trror] %f: %m (%l:%c)" \
|
|
-efm="%C[error]%r" \
|
|
-efm="%Z[error]%r" \
|
|
-efm="%-G%r" \
|
|
-name="prettier" \
|
|
-reporter="github-pr-check" \
|
|
-filter-mode="nofilter" \
|
|
-fail-level="any" \
|
|
-level="error" \
|
|
-tee
|
|
|
|
prettier=$?
|
|
|
|
echo "::group:: Running rubocop with reviewdog 🐶 ..."
|
|
|
|
bundle exec rubocop \
|
|
--fail-level info \
|
|
| reviewdog -f="rubocop" \
|
|
-name="rubocop" \
|
|
-reporter="github-pr-check" \
|
|
-filter-mode="nofilter" \
|
|
-level="error" \
|
|
-fail-level="any" \
|
|
-tee
|
|
|
|
rubocop=$?
|
|
|
|
echo "::group:: Running haml-lint with reviewdog 🐶 ..."
|
|
|
|
bundle exec haml-lint \
|
|
--fail-level warning \
|
|
| reviewdog -f="haml-lint" \
|
|
-name="haml-lint" \
|
|
-reporter="github-pr-check" \
|
|
-filter-mode="nofilter" \
|
|
-level="error" \
|
|
-fail-level="any" \
|
|
-tee
|
|
|
|
haml_lint=$?
|
|
|
|
! (( prettier || rubocop || haml_lint ))
|