Skip to content
koalaman edited this page Aug 20, 2015 · 29 revisions

Shellcheck directives allows selectively silencing warnings, and takes the form of comments in files:

hexToAscii() {
  # shellcheck disable=SC2059
  printf "\x$1"
}

Supported directives are disable to disable warnings:

# shellcheck disable=code[,code...]
statement_where_warning_should_be_disabled

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.

Clone this wiki locally