summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Zimmerman <zimmerman.jake@gmail.com>2017-07-09 16:39:33 -0500
committerw0rp <w0rp@users.noreply.github.com>2017-07-09 22:39:33 +0100
commitb50a7318fbf8836b820df9d10e0fc6ffba6bcd1e (patch)
tree1009c0c1470ecf72576bd43a23d9b23c9d4c78eb
parent47ff5148786e6a9b761c9b23fd119a1121cd87dd (diff)
downloadale-b50a7318fbf8836b820df9d10e0fc6ffba6bcd1e.zip
Add new Haskell linter (#742)
* Add stack-build linter for Haskell The stack-build linter works better than the other two linters when you're working with an entire Haskell project. It builds the project entirely and reports any errors. The other two Haskell GHC linters only work on single files, which can result in spurious errors (for example, not being able to find imports). * Document all available Haskell linters * Split GHC checkers into separate files
-rw-r--r--README.md2
-rw-r--r--ale_linters/haskell/ghc.vim8
-rw-r--r--ale_linters/haskell/stack-build.vim14
-rw-r--r--ale_linters/haskell/stack-ghc.vim10
-rw-r--r--doc/ale.txt2
5 files changed, 26 insertions, 10 deletions
diff --git a/README.md b/README.md
index 6358bc0a..4f2bbf54 100644
--- a/README.md
+++ b/README.md
@@ -81,7 +81,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/), [ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) |
+| Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/), [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-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 | [checkstyle](http://checkstyle.sourceforge.net), [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/), [prettier](https://github.com/prettier/prettier) (and `prettier-eslint`, `prettier-standard`), [xo](https://github.com/sindresorhus/xo)
diff --git a/ale_linters/haskell/ghc.vim b/ale_linters/haskell/ghc.vim
index ee6370b5..fdf22f9f 100644
--- a/ale_linters/haskell/ghc.vim
+++ b/ale_linters/haskell/ghc.vim
@@ -8,11 +8,3 @@ call ale#linter#Define('haskell', {
\ 'command': 'ghc -fno-code -v0 %t',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\})
-
-call ale#linter#Define('haskell', {
-\ 'name': 'stack-ghc',
-\ 'output_stream': 'stderr',
-\ 'executable': 'stack',
-\ 'command': 'stack ghc -- -fno-code -v0 %t',
-\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
-\})
diff --git a/ale_linters/haskell/stack-build.vim b/ale_linters/haskell/stack-build.vim
new file mode 100644
index 00000000..1c2a06f6
--- /dev/null
+++ b/ale_linters/haskell/stack-build.vim
@@ -0,0 +1,14 @@
+" Author: Jake Zimmerman <jake@zimmerman.io>
+" Description: Like stack-ghc, but for entire projects
+"
+" Note: Ideally, this would *only* typecheck. Right now, it also does codegen.
+" See <https://github.com/commercialhaskell/stack/issues/977>.
+
+call ale#linter#Define('haskell', {
+\ 'name': 'stack-build',
+\ 'output_stream': 'stderr',
+\ 'executable': 'stack',
+\ 'command': 'stack build',
+\ 'lint_file': 1,
+\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
+\})
diff --git a/ale_linters/haskell/stack-ghc.vim b/ale_linters/haskell/stack-ghc.vim
new file mode 100644
index 00000000..0367dc24
--- /dev/null
+++ b/ale_linters/haskell/stack-ghc.vim
@@ -0,0 +1,10 @@
+" Author: w0rp <devw0rp@gmail.com>
+" Description: ghc for Haskell files, using Stack
+
+call ale#linter#Define('haskell', {
+\ 'name': 'stack-ghc',
+\ 'output_stream': 'stderr',
+\ 'executable': 'stack',
+\ 'command': 'stack ghc -- -fno-code -v0 %t',
+\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
+\})
diff --git a/doc/ale.txt b/doc/ale.txt
index c80e337c..d678577c 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -172,7 +172,7 @@ The following languages and tools are supported.
* FusionScript: 'fusion-lint'
* Haml: 'hamllint'
* Handlebars: 'ember-template-lint'
-* Haskell: 'ghc', 'ghc-mod', 'hlint', 'hdevtools'
+* Haskell: 'ghc', 'stack-ghc', 'stack-build', 'ghc-mod', 'stack-ghc-mod', 'hlint', 'hdevtools'
* HTML: 'HTMLHint', 'proselint', 'tidy'
* Java: 'javac'
* JavaScript: 'eslint', 'jscs', 'jshint', 'flow', 'prettier', 'prettier-eslint', 'xo'