mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1126 (markdown)
23
SC1126.md
Normal file
23
SC1126.md
Normal file
@@ -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
|
Reference in New Issue
Block a user