From 1ed8b23e8f691f0cc1ea8ecf1c4a84f9c487a6f8 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 4 Nov 2017 15:57:37 -0700 Subject: [PATCH] Created SC1126 (markdown) --- SC1126.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 SC1126.md diff --git a/SC1126.md b/SC1126.md new file mode 100644 index 0000000..7022774 --- /dev/null +++ b/SC1126.md @@ -0,0 +1,23 @@ +## Place shellcheck directives before commands, not after. + +### Problematic code: + +```sh +var=1 # shellcheck disable=SC2034 +``` + +### Correct code: + +```sh +# shellcheck disable=SC2034 +var=1 +``` +### Rationale: + +ShellCheck expects directives to come before the relevant command. They are not allowed after. + +### Exceptions: + +If this is not a directive and just a comment mentioning ShellCheck, please rewrite or capitalize: + + var=1 # ShellCheck encourages lowercase variable names \ No newline at end of file