From ec9009fc7c7f86b5998b236f52bd68d5302bf6fe Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 22 Feb 2024 11:38:36 +0900 Subject: [PATCH] explain how to disable/enable shellcheck rules --- docs/checks.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/checks.md b/docs/checks.md index dda5cbc42..846c0f542 100644 --- a/docs/checks.md +++ b/docs/checks.md @@ -832,6 +832,26 @@ false positives can be avoided by showing the shell name explicitly. It is also shell: pwsh ``` +When you want to control shellcheck behaivor, [`SHELLCHECK_OPTS` environment variable][shellcheck-env-var] is useful. + +From command line: + +```sh +# Enable some optional rules +SHELLCHECK_OPTS='--enable=avoid-nullary-conditions' actionlint + +# Disable some rules +SHELLCHECK_OPTS='--exclude=SC2129' actionlint +``` + +On GitHub Actions: + +```yaml +- run: actionlint + env: + SHELLCHECK_OPTS: --exclude=SC2129 +``` + ## [pyflakes][] integration for `run:` @@ -2650,6 +2670,7 @@ characters around `${{ }}`. [SC2194]: https://github.com/koalaman/shellcheck/wiki/SC2194 [SC2154]: https://github.com/koalaman/shellcheck/wiki/SC2154 [SC2157]: https://github.com/koalaman/shellcheck/wiki/SC2157 +[shellcheck-env-var]: https://github.com/koalaman/shellcheck/wiki/Integration#environment-variables [pyflakes]: https://github.com/PyCQA/pyflakes [expr-doc]: https://docs.github.com/en/actions/learn-github-actions/expressions [contexts-doc]: https://docs.github.com/en/actions/learn-github-actions/contexts