mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated Directive (markdown)
10
Directive.md
10
Directive.md
@@ -5,10 +5,16 @@ Shellcheck directives allows selectively silencing warnings, and takes the form
|
|||||||
printf "\x$1"
|
printf "\x$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
The only supported directive is `disable`:
|
Supported directives are `disable` to disable warnings:
|
||||||
|
|
||||||
# shellcheck disable=code[,code...]
|
# shellcheck disable=code[,code...]
|
||||||
|
statement_where_warning_should_be_disabled
|
||||||
|
|
||||||
Directives are scoped to the structure that follows it. For example, before a function it silences all warnings in the function. Before a case statement, it silences all warnings in all branches of the case statement.
|
and `source` to tell ShellCheck where to find a sourced file:
|
||||||
|
|
||||||
|
# shellcheck source=src/examples/config.sh
|
||||||
|
. "$(locate_config)"
|
||||||
|
|
||||||
|
Directives are scoped to the structure that follows it. For example, before a function it silences all warnings (or overrides all `source` statements) in the function Before a case statement, it silences all warnings in all branches of the case statement.
|
||||||
|
|
||||||
Silencing parser errors is purely cosmetic, and will not make ShellCheck continue.
|
Silencing parser errors is purely cosmetic, and will not make ShellCheck continue.
|
Reference in New Issue
Block a user