ShellCheck Support

ShellCheck, a powerful tool to analyze shell scripts, is bundled with BashSupport Pro.

Binaries of ShellCheck 0.10.0 are shipped with the plugin for macOS, Windows, and Linux. Please refer to all supported ShellCheck codes for a complete list of all supported codes of ShellCheck.

Error Highlighting

BashSupport Pro integrates ShellCheck’s warnings and error messages into the editor.

The fixes returned by ShellCheck are shown as quick fixes in the user interface. BashSupport Pro adds some additional quick fixes for a few common ShellCheck warnings.

ShellCheck Directives

ShellCheck supports # shellcheck comments to configure ShellCheck and to control the warnings shown for a file.


BashSupport Pro displays tooltips on the SC–codes of directives so that you don’t have to learn or search for the codes.

Tooltip on a ShellCheck code
Tooltip on a ShellCheck code

Directive shellcheck disable=

The ShellCheck disable directive is automatically inserted by BashSupport Pro to suppress ShellCheck messages.

It works as usual:

  • Press AltEnter on a warning to see quickfixes and intentions
  • Choose Suppress for statement in the context menu of the warning you want to suppress. Depending on the context, you can also choose Suppress for function or Suppress for file.
    Intentions for ShellCheck messages
    Intentions for ShellCheck messages

Multiple disable= directives for the same line are separated by a comma (,).

# shellcheck disable=SC2046,SC2005
echo $(echo $*)

Directive shellcheck source=

BashSupport Pro supports ShellCheck’s source directive. This directive is useful for filenames, which are not static.

source "$(dirname "${BASH_SOURCE[0]}")/../"

Here, ../ is a static value, but "$(dirname "${BASH_SOURCE[0]}")/" is not. ShellCheck and BashSupport Pro only understand static values.

Now you can use the # shellcheck source= directive to define the static location:

# shellcheck source=../
source "$(dirname "${BASH_SOURCE[0]}")/../"

BashSupport Pro assumes that the source path is relative to the current file. By default, ShellCheck uses the directory where it’s executed as root for source paths. Use the source-path directive or execute shellcheck -P ... if this is a problem in your setup.

Go to Declaration
You can navigate to the source files by ctrlclick or by using the Navigate → Go to Declaration action.
The source= path is updated when you rename the referenced file. It’s also updated when you move the file containing the source directive.


BashSupport Pro bundles ShellCheck binaries for macOS, Linux and Windows. If you want to use a locally installed version of ShellCheck, then you can set your own path at Settings… → Languages & Frameworks → BashSupport Pro. Please make sure, that it points to ShellCheck 0.10.0 or later.

How to set a custom path to ShellCheck
How to set a custom path to ShellCheck
© 2020–2024 Joachim Ansorg
Правовая информация
Политика конфиденциальности
Юридическая информация