Fix caps and highlight .shellcheckrc sample

John Gardner
2021-12-22 15:46:18 +11:00
parent 44dc80ac6a
commit 3f78e63e5e

@@ -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:
```none
$ cat ~/.shellcheckrc
```shellcheckrc
# ~/.shellcheckrc
# Don't suggest [ -n "$VAR" ] over [ ! -z "$VAR" ]
disable=SC2236
@@ -23,8 +23,8 @@ 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...]
@@ -39,7 +39,7 @@ A range of errors can also be specified, handy when disabling things for the ent
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 +51,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 +59,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 +67,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 file (since 0.7.0).
Give ShellCheck a path in which to search for sourced files (since 0.7.0).
```sh
# The script will now look for src/examples/mylib.sh
@@ -89,7 +89,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 +151,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
```
```