diff --git a/Directive.md b/Directive.md index a09341c..b58edd5 100644 --- a/Directive.md +++ b/Directive.md @@ -1,4 +1,4 @@ -# ShellCheck directives +# ShellCheck Directives Shellcheck directives allow you to control how `shellcheck` works, and take the form of comments in files: @@ -11,8 +11,8 @@ hexToAscii() { or entries in a `.shellcheckrc` in the project root or user's home directory: -```shellcheckrc -# ~/.shellcheckrc +```none +$ cat ~/.shellcheckrc # Don't suggest [ -n "$VAR" ] over [ ! -z "$VAR" ] disable=SC2236 @@ -23,23 +23,21 @@ enable=require-variable-braces ## Supported directives -### `disable` -Prevent ShellCheck from processing one or more warnings: +### disable +Prevent shellcheck from processing one or more warnings: ```sh # shellcheck disable=code[,code...] statement_where_warning_should_be_disabled ``` -A range of errors can also be specified, handy when disabling things for the entire file. +A range of errors can also be specified, handy when disbaling things for the entire file. ```sh #!/bin/bash # shellcheck disable=SC1000-SC9999 ``` -An alias `all` is available instead of specifying 0-9999 to disable all checks. - -### `enable` +### enable Enables an [[optional]] check (since 0.7.0). @@ -51,7 +49,7 @@ echo "Hello $USER" # Will suggest ${USER} To see a list of optional checks with examples, run `shellcheck --list-optional`. See [[here|optional]] for more information. -### `external-sources` +### external-sources Set whether or not to follow arbitrary file paths in `source` statements (since 0.8.0). @@ -59,7 +57,7 @@ Use `external-sources=true` in `.shellcheckrc` to let shellcheck access arbitrar Individual script files can disable but not enable this option. -### `source` +### source Tell ShellCheck where to find a sourced file (since 0.4.0): ```sh @@ -67,9 +65,9 @@ Tell ShellCheck where to find a sourced file (since 0.4.0): . "$(locate_config)" ``` -### `source-path` +### source-path -Give ShellCheck a path in which to search for sourced files (since 0.7.0). +Give ShellCheck a path in which to search for sourced file (since 0.7.0). ```sh # The script will now look for src/examples/mylib.sh @@ -89,7 +87,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" . "$here/utils.sh" ``` -### `shell` +### shell Specify the shell for a script (similar to the shebang, if you for any reason don't want to add one) (since [0.4.5](https://github.com/koalaman/shellcheck/issues/581#issuecomment-249437837)): @@ -151,4 +149,4 @@ The comment can also be added at the end of the directive line. This is the reco ```sh # shellcheck disable=SC1234 # this is intentional statement_where_warning_should_be_disabled -``` +``` \ No newline at end of file