From 28dafe655d71643f3b6b46310cec52c4598ad8a8 Mon Sep 17 00:00:00 2001 From: Lucas Larson Date: Sat, 13 Jul 2024 11:30:55 -0400 Subject: [PATCH] add another possible cause of error --- SC1072.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SC1072.md b/SC1072.md index 1f75e58..01e6e12 100644 --- a/SC1072.md +++ b/SC1072.md @@ -3,3 +3,19 @@ *Note: There is a [known bug](../issues/1036) in the current version when [directives](../wiki/Directive) appear within `then` clauses of `if` blocks that causes Shellcheck to report SC1072 on otherwise valid code. Avoid using directives within `then` clauses - instead place them at the top of the `if` block or another enclosing block. This is fixed on the [online version](https://www.shellcheck.net/) and the next release.* See [Parser Error](https://github.com/koalaman/shellcheck/wiki/Parser-Error). + +This error can also occur with an [incomplete shellcheck directive](https://github.com/koalaman/shellcheck/wiki/Ignore/ceb874a8defc0df77b285e4fc54f897ed9dbb231#ignoring-all-errors-in-a-file-08) like `# shellcheck disable` instead of `# shellcheck disable=all` + +### Problematic code +```sh +# shellcheck disable +echo stuff that shellcheck up to at least v0.10.0 will not even see because of the incorrect directive above +``` + +### Correct code +```sh +# shellcheck disable=all +echo stuff that shellcheck will correctly ignore entirely +``` + +### \ No newline at end of file