Shellcheck Support

ShellCheck, version 0.7.1, is bundled with BashSupport Pro.

Error Highlighting

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

ShellCheck Directives

ShellCheck supports # shellcheck comments to control how it works.

Tooltips

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

shellcheck disable=

The ShellCheck disable directive is automatically inserted by BashSupport Pro to suppress ShellCheck messages. It works as usual:

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

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

shellcheck source=

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

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

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

If you use a dynamic value in script, then you can use the # shellcheck source= directive to define the static location:

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

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 NavigateGo to Declaration action.
Rename
The source= path is updated when you rename the referenced file. It’s also updated when you move the file, which contains the source directive.

Settings

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 & FrameworksBashSupport Pro . Please make sure, that it points to ShellCheck 0.7.1 or later.

How to set a custom path to ShellCheck
How to set a custom path to ShellCheck