Skip to content

Commit

Permalink
Add Windows support using WSL (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz authored and kaste committed Mar 2, 2018
1 parent 47b8ba2 commit 895d6de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Before using this plugin, you must ensure that `shellcheck` is installed on your
To install `shellcheck`, follow the instructions on [the shellcheck GitHub repository](https://github.com/koalaman/shellcheck).

`shellcheck` can be installed with ``apt-get`` on Debian sid, ``brew`` on Mac OS X, or compiled from its Haskell sources (manually, or through `cabal`).
There is no Windows installer.

In order for `shellcheck` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover [troubleshooting PATH configuration](http://sublimelinter.readthedocs.io/en/latest/troubleshooting.html#finding-a-linter-executable).
On Windows, the Linux Subsystem must be enabled. See [Microsoft's guide](https://docs.microsoft.com/en-us/windows/wsl/install-win10), then run `wsl sudo apt install shellcheck` to install Shellcheck (if you installed ubuntu).

On native Linux systems, in order for `shellcheck` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover [troubleshooting PATH configuration](http://sublimelinter.readthedocs.io/en/latest/troubleshooting.html#finding-a-linter-executable).

## Settings
- SublimeLinter settings: http://sublimelinter.readthedocs.org/en/latest/settings.html
Expand Down
9 changes: 9 additions & 0 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@
"""

from SublimeLinter.lint import Linter
from shutil import which
import sublime


class Shellcheck(Linter):
"""Provides an interface to shellcheck."""

syntax = ('shell-unix-generic', 'bash')
cmd = 'shellcheck --format gcc -'

if sublime.platform() == 'windows':
if which('wsl'):
cmd = 'wsl ' + cmd
else:
raise OSError('Either the current system is not 64-bit, or WSL is not enabled. See the README file.')

regex = (
r'^.+?:(?P<line>\d+):(?P<col>\d+): '
r'(?:(?P<error>error)|(?P<warning>(warning|note))): '
Expand Down

0 comments on commit 895d6de

Please sign in to comment.