mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Fix caps and highlighted embedded code where possible
13
Optional.md
13
Optional.md
@@ -1,4 +1,4 @@
|
|||||||
## Optional Checks
|
## Optional checks
|
||||||
|
|
||||||
ShellCheck supports additional checks that are not enabled by default. These are generally subjective or stylistic.
|
ShellCheck supports additional checks that are not enabled by default. These are generally subjective or stylistic.
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ ShellCheck supports additional checks that are not enabled by default. These are
|
|||||||
|
|
||||||
Checks can be enabled with flags or an `enable` [[directive]] in the file or `.shellcheckrc`:
|
Checks can be enabled with flags or an `enable` [[directive]] in the file or `.shellcheckrc`:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# shellcheck enable=require-variable-braces
|
# shellcheck enable=require-variable-braces
|
||||||
echo "$RANDOM" # Will emit a suggestion to use `${RANDOM}`
|
echo "$RANDOM" # Will emit a suggestion to use `${RANDOM}`
|
||||||
@@ -14,7 +14,11 @@ echo "$RANDOM" # Will emit a suggestion to use `${RANDOM}`
|
|||||||
|
|
||||||
or put `enable=require-variable-braces` in a `.shellcheckrc` in your home directory or project root.
|
or put `enable=require-variable-braces` in a `.shellcheckrc` in your home directory or project root.
|
||||||
|
|
||||||
They can also be enabled on the command line with `shellcheck -o require-variable-braces myscript`
|
They can also be enabled on the command-line with `-o`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ shellcheck -o require-variable-braces myscript
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Enabling all checks
|
### Enabling all checks
|
||||||
@@ -29,7 +33,8 @@ However, if you for debugging or evaluation purposes want to see what's availabl
|
|||||||
To see which checks are available in your version of ShellCheck, use the `--list-optional` flag.
|
To see which checks are available in your version of ShellCheck, use the `--list-optional` flag.
|
||||||
|
|
||||||
Optional checks as of version 0.8.0:
|
Optional checks as of version 0.8.0:
|
||||||
```
|
|
||||||
|
```console
|
||||||
$ shellcheck --list-optional
|
$ shellcheck --list-optional
|
||||||
|
|
||||||
name: add-default-case
|
name: add-default-case
|
||||||
|
Reference in New Issue
Block a user