Add hamllint linter for Haml (#377)
* Add hamllint linter for Haml * Simplify hamllint
This commit is contained in:
parent
2750c605c1
commit
9e9e15bc87
@ -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) |
|
||||
|
33
ale_linters/haml/hamllint.vim
Normal file
33
ale_linters/haml/hamllint.vim
Normal file
@ -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'
|
||||
\})
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user