Add argon linter for haskell

Argon is a monitor for cyclomatic complexity
in Haskell.

https://github.com/rubik/argon
This commit is contained in:
2018-06-17 02:16:06 +02:00
parent f1b72218c3
commit 024369c72d
5 changed files with 193 additions and 1 deletions

View File

@@ -0,0 +1,74 @@
Before:
runtime ale_linters/haskell/argon.vim
After:
call ale#linter#Reset()
Execute(The argon handler should parse items correctly):
AssertEqual
\ [
\ {
\ 'filename': 'src/Main.hs',
\ 'lnum': 69,
\ 'col': 1,
\ 'text': 'toMicrosec: cyclomatic complexity of 13',
\ 'type': 'E',
\ },
\ {
\ 'filename': 'src/Main.hs',
\ 'lnum': 202,
\ 'col': 1,
\ 'text': 'same: cyclomatic complexity of 8',
\ 'type': 'W',
\ },
\ {
\ 'filename': 'src/Main.hs',
\ 'lnum': 503,
\ 'col': 1,
\ 'text': 'go: cyclomatic complexity of 7',
\ 'type': 'I',
\ },
\ ],
\ ale_linters#haskell#argon#Handle(bufnr(''), [json_encode([
\ {
\ "blocks": [
\ {
\ "complexity":13,
\ "name":"toMicrosec",
\ "lineno":69,
\ "col":1,
\ },
\ {
\ "complexity":8,
\ "name":"same",
\ "lineno":202,
\ "col":1,
\ },
\ {
\ "complexity":7,
\ "name":"go",
\ "lineno":503,
\ "col":1,
\ }
\ ],
\ "path":"src/Main.hs",
\ "type":"result"
\ },
\ ])])
Execute(The argon handler should handle empty output):
AssertEqual
\ [],
\ ale_linters#haskell#argon#Handle(bufnr(''), [])
Execute(The argon handler should handle errors):
AssertEqual
\ [],
\ ale_linters#haskell#argon#Handle(bufnr(''), [json_encode([
\ {
\ "path":"src/Main.hs",
\ "type":"error",
\ "message":"3:6 Illegal datatype context (use DatatypeContexts): Show a =>",
\ },
\ ])])