diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | ale_linters/haskell/ghc-mod.vim | 16 | ||||
-rw-r--r-- | doc/ale.txt | 2 | ||||
-rw-r--r-- | test/handler/test_ghc_mod_handler.vader | 27 |
4 files changed, 45 insertions, 2 deletions
@@ -76,7 +76,7 @@ name. That seems to be the fairest way to arrange this table. | Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter), [go build](https://golang.org/cmd/go/), [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple), [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) | | Haml | [haml-lint](https://github.com/brigade/haml-lint) | Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) | -| Haskell | [ghc](https://www.haskell.org/ghc/), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) | +| Haskell | [ghc](https://www.haskell.org/ghc/), [ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) | | 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) | | JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo) diff --git a/ale_linters/haskell/ghc-mod.vim b/ale_linters/haskell/ghc-mod.vim new file mode 100644 index 00000000..d3d23649 --- /dev/null +++ b/ale_linters/haskell/ghc-mod.vim @@ -0,0 +1,16 @@ +" Author: wizzup <wizzup@gmail.com> +" Description: ghc-mod for Haskell files + +call ale#linter#Define('haskell', { +\ 'name': 'ghc-mod', +\ 'executable': 'ghc-mod', +\ 'command': 'ghc-mod check %t', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) + +call ale#linter#Define('haskell', { +\ 'name': 'stack-ghc-mod', +\ 'executable': 'stack', +\ 'command': 'stack exec ghc-mod check %t', +\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', +\}) diff --git a/doc/ale.txt b/doc/ale.txt index d4d75173..c5411fc9 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -136,7 +136,7 @@ The following languages and tools are supported. * Go: 'gofmt', 'go vet', 'golint', 'go build', 'gosimple', 'staticcheck' * Haml: 'hamllint' * Handlebars: 'ember-template-lint' -* Haskell: 'ghc', 'hlint', 'hdevtools' +* Haskell: 'ghc', 'ghc-mod', 'hlint', 'hdevtools' * HTML: 'HTMLHint', 'proselint', 'tidy' * Java: 'javac' * JavaScript: 'eslint', 'jscs', 'jshint', 'flow', 'xo' diff --git a/test/handler/test_ghc_mod_handler.vader b/test/handler/test_ghc_mod_handler.vader new file mode 100644 index 00000000..f9b44b33 --- /dev/null +++ b/test/handler/test_ghc_mod_handler.vader @@ -0,0 +1,27 @@ +Execute(HandleGhcFormat should handle ghc-mod problems): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Failed to load interface for ‘Missing’Use -v to see a list of the files searched for.', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': ' Suggestion: Use camelCaseFound: my_variable = ...Why not: myVariable = ...', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'type': 'E', + \ 'text': ' Warning: Eta reduceFound: myFunc x = succ xWhy not: myFunc = succ', + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ 'check1.hs:2:1:Failed to load interface for ‘Missing’Use -v to see a list of the files searched for.', + \ 'check2.hs:2:1: Suggestion: Use camelCaseFound: my_variable = ...Why not: myVariable = ...', + \ 'check2.hs:6:1: Warning: Eta reduceFound: myFunc x = succ xWhy not: myFunc = succ', + \ ]) |