ShellCheck for Visual Studio Code
Integrates ShellCheck into VS Code, a linter for Shell scripts.
vscode-shellcheck (this "extension"), requires shellcheck (the awesome static analysis tool for shell scripts) to work.
Since v0.10.0, precompiled shellcheck binaries are bundled for these platforms:
- Linux (x86_64)
- macOS (x86_64)
- Windows: precompiled 32bit binary will be used on both 32bit and 64bit Windows, please note that this requires you have WoW64 enabled, althouth it's not a problem for Desktop users.
Install Extension command from Command Palette.
- Search and choose
There are various options that can be configured by making changes to your user or workspace preferences.
Default options are:
"shellcheck.executablePath": "", // Priority: user defined > bundled shellcheck binary > "shellcheck"
"shellcheck.ignoreFileSchemes": ["git", "gitfs"],
shellcheck.ignorePatterns works exactly the same as
search.exclude, read more about glob patterns here
Experimental Quick Fix
In order to enable the "auto fix" feature, shellcheck v0.7.0 or better is required.
Since this feature is still in experimental, additionally,
shellcheck.enableQuickFix should be
Lint onType or onSave
By default the linter will lint as you type. Alternatively, set
onSave if you want to lint only when the file is saved (works best if auto-save is on).
"shellcheck.run": "onType" // also: "onSave"
By default all shellcheck checks are performed and reported on as necessary. To globally ignore certain checks in all files, add the "SC identifiers" to
shellcheck.exclude. For example, to exclude SC1017:
Using Docker version of shellcheck
In order to get it work, you need a "shim" script, and then, just remember, do not try to construct command line arguments for shellcheck yourself.
Here is a simple "shim" script to get start with (See discussion: #24):
exec docker run --rm -i -v "$PWD:/mnt:ro" koalaman/shellcheck:v0.7.0 "$@"
This extension is based on hoovercj's Haskell Linter.
This extension is licensed under the MIT license.
Bundled shellcheck binaries are licensed under GPLv3.