Merge pull request #496 from wizzup/haskell-ghc-mod

Haskell:  new ghc-mod linter
This commit is contained in:
w0rp 2017-05-15 19:57:50 +01:00 committed by GitHub
commit 113f53a5d2
4 changed files with 45 additions and 2 deletions

View File

@ -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)

View File

@ -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',
\})

View File

@ -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'

View File

@ -0,0 +1,27 @@
Execute(HandleGhcFormat should handle ghc-mod problems):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'col': 1,
\ 'type': 'E',
\ 'text': 'Failed to load interface for MissingUse -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 MissingUse -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',
\ ])