diff options
author | Patrick Lewis <patrick@endpoint.com> | 2017-03-03 15:27:07 -0500 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-03-03 20:27:07 +0000 |
commit | 9e9e15bc87571ec3beb95231fdbb6d818c2ea203 (patch) | |
tree | ca335493ce3a89a8f9f87644bae8ecf3a3c2ddcf | |
parent | 2750c605c1ee320a8675fb40a224a60d27f8de6f (diff) | |
download | ale-9e9e15bc87571ec3beb95231fdbb6d818c2ea203.zip |
Add hamllint linter for Haml (#377)
* Add hamllint linter for Haml
* Simplify hamllint
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | ale_linters/haml/hamllint.vim | 33 | ||||
-rw-r--r-- | doc/ale.txt | 1 |
3 files changed, 35 insertions, 0 deletions
@@ -71,6 +71,7 @@ name. That seems to be the fairest way to arrange this table. | Erlang | [erlc](http://erlang.org/doc/man/erlc.html) | | Fortran | [gcc](https://gcc.gnu.org/) | | Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [go build](https://golang.org/cmd/go/) | +| Haml | [haml-lint](https://github.com/brigade/haml-lint) | Haskell | [ghc](https://www.haskell.org/ghc/), [hlint](https://hackage.haskell.org/package/hlint) | | HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) | | Java | [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | diff --git a/ale_linters/haml/hamllint.vim b/ale_linters/haml/hamllint.vim new file mode 100644 index 00000000..fead7472 --- /dev/null +++ b/ale_linters/haml/hamllint.vim @@ -0,0 +1,33 @@ +" Author: Patrick Lewis - https://github.com/patricklewis +" Description: haml-lint for Haml files + +function! ale_linters#haml#hamllint#Handle(buffer, lines) abort + " Matches patterns like the following: + " <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax. + let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'type': l:match[2], + \ 'text': l:match[3] + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('haml', { +\ 'name': 'hamllint', +\ 'executable': 'haml-lint', +\ 'command': 'haml-lint %t', +\ 'callback': 'ale_linters#haml#hamllint#Handle' +\}) diff --git a/doc/ale.txt b/doc/ale.txt index af26b9c9..734c389c 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -91,6 +91,7 @@ The following languages and tools are supported. * Erlang: 'erlc' * Fortran: 'gcc' * Go: 'gofmt -e', 'go vet', 'golint', 'go build' +* Haml: 'hamllint' * Haskell: 'ghc', 'hlint' * HTML: 'HTMLHint', 'proselint', 'tidy' * Java: 'javac' |