add documentation about how to comment directives

Paul Wise
2020-05-02 11:34:48 +00:00
parent d875350859
commit c891a15fcb

@@ -66,4 +66,24 @@ f() {
}
```
Silencing parser errors is purely cosmetic; any parser error found will still stop ShellCheck at the point of the error.
Silencing parser errors is purely cosmetic; any parser error found will still stop ShellCheck at the point of the error.
## Documenting directive use
To document why a specific directive was used, it is recommended to add a comment.
The comment can be added on the preceding line. This is the recommended option for long comments.
```sh
# this is intentional because of reasons
# that are long and need explaining
# shellcheck disable=SC1234
statement_where_warning_should_be_disabled
```
The comment can also be added at the end of the directive line. This is the recommended option for short comments.
```sh
# shellcheck disable=SC1234 # this is intentional
statement_where_warning_should_be_disabled
```