Simplify some code and format some tests better
This commit is contained in:
parent
689921d7e3
commit
99afe586b3
@ -18,7 +18,6 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
|||||||
let l:text = l:match[3]
|
let l:text = l:match[3]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:lnum,
|
\ 'lnum': l:lnum,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
|
@ -50,15 +50,11 @@ function! ale_linters#go#gobuild#HandleGoBuildErrors(buffer, full_filename, line
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[3],
|
\ 'text': l:match[3],
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -32,15 +32,11 @@ function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\ 'type': tolower(l:match[3]) ==# 'warning' ? 'W' : 'E',
|
\ 'type': tolower(l:match[3]) ==# 'warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -22,15 +22,11 @@ function! s:HandleUnixFormat(buffer, lines, type) abort
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[3],
|
\ 'text': l:match[3],
|
||||||
\ 'type': a:type,
|
\ 'type': a:type,
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -60,13 +56,10 @@ function! ale#handlers#HandleCppCheckFormat(buffer, lines) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'text': l:match[3] . ' (' . l:match[2] . ')',
|
\ 'text': l:match[3] . ' (' . l:match[2] . ')',
|
||||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -103,13 +96,10 @@ function! ale#handlers#HandlePEP8Format(buffer, lines) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:code . ': ' . l:match[5],
|
\ 'text': l:code . ': ' . l:match[5],
|
||||||
\ 'type': l:match[4] ==# 'E' ? 'E' : 'W',
|
\ 'type': l:match[4] ==# 'E' ? 'E' : 'W',
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -142,15 +132,11 @@ function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort
|
|||||||
" it is on small echo lines.
|
" it is on small echo lines.
|
||||||
let l:text = '(' . l:errorGroup . ') ' . l:text
|
let l:text = '(' . l:errorGroup . ') ' . l:text
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -176,15 +162,11 @@ function! ale#handlers#HandleStyleLintFormat(buffer, lines) abort
|
|||||||
let l:type = l:match[3] ==# '✖' ? 'E' : 'W'
|
let l:type = l:match[3] ==# '✖' ? 'E' : 'W'
|
||||||
let l:text = l:match[4] . '[' . l:match[5] . ']'
|
let l:text = l:match[4] . '[' . l:match[5] . ']'
|
||||||
|
|
||||||
" vcol is Needed to indicate that the column is a character.
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -233,13 +215,10 @@ function! ale#handlers#HandleGhcFormat(buffer, lines) abort
|
|||||||
let l:type = l:type ==# '' ? 'E' : toupper(l:type[0])
|
let l:type = l:type ==# '' ? 'E' : toupper(l:type[0])
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
\ 'nr': -1,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -53,11 +53,8 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
|
|||||||
\ && (l:span_filename ==# l:filename || l:span_filename ==# '<anon>')
|
\ && (l:span_filename ==# l:filename || l:span_filename ==# '<anon>')
|
||||||
\)
|
\)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:span.line_start,
|
\ 'lnum': l:span.line_start,
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:span.byte_start,
|
\ 'col': l:span.byte_start,
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'text': l:error.message,
|
\ 'text': l:error.message,
|
||||||
\ 'type': toupper(l:error.level[0]),
|
\ 'type': toupper(l:error.level[0]),
|
||||||
\})
|
\})
|
||||||
@ -68,11 +65,8 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
|
|||||||
|
|
||||||
if !empty(l:root_cause)
|
if !empty(l:root_cause)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:root_cause[0],
|
\ 'lnum': l:root_cause[0],
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'col': l:root_cause[1],
|
\ 'col': l:root_cause[1],
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'text': l:error.message,
|
\ 'text': l:error.message,
|
||||||
\ 'type': toupper(l:error.level[0]),
|
\ 'type': toupper(l:error.level[0]),
|
||||||
\})
|
\})
|
||||||
|
@ -1,67 +1,48 @@
|
|||||||
Execute (Run HandleCSSLintFormat):
|
Execute(HandleCSSLintFormat should handle CSS errors):
|
||||||
let g:loclist = ale#handlers#HandleCSSLintFormat(42, [
|
AssertEqual
|
||||||
\ 'something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)',
|
\ [
|
||||||
\ "something.css: line 2, col 5, Warning - Expected ... but found 'wat'. (known-properties)",
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 2,
|
\ 'lnum': 2,
|
||||||
\ 'col': 1,
|
\ 'col': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': '(errors) Expected RBRACE at line 2, col 1.',
|
\ 'text': '(errors) Expected RBRACE at line 2, col 1.',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 2,
|
\ 'lnum': 2,
|
||||||
\ 'col': 5,
|
\ 'col': 5,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': "(known-properties) Expected ... but found 'wat'.",
|
\ 'text': "(known-properties) Expected ... but found 'wat'.",
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandleCSSLintFormat(42, [
|
||||||
|
\ 'something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)',
|
||||||
|
\ "something.css: line 2, col 5, Warning - Expected ... but found 'wat'. (known-properties)",
|
||||||
|
\ ])
|
||||||
|
|
||||||
Execute (Run HandlePEP8Format):
|
Execute (HandlePEP8Format should handle the correct lines of output):
|
||||||
let g:loclist = ale#handlers#HandlePEP8Format(42, [
|
AssertEqual
|
||||||
\ "stdin:6:6: E111 indentation is not a multiple of four",
|
\ [
|
||||||
\ "test.yml:35: [EANSIBLE0002] Trailing whitespace",
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 6,
|
\ 'lnum': 6,
|
||||||
\ 'col': 6,
|
\ 'col': 6,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'E111: indentation is not a multiple of four',
|
\ 'text': 'E111: indentation is not a multiple of four',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 35,
|
\ 'lnum': 35,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': "EANSIBLE0002: Trailing whitespace",
|
\ 'text': "EANSIBLE0002: Trailing whitespace",
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandlePEP8Format(42, [
|
||||||
|
\ "stdin:6:6: E111 indentation is not a multiple of four",
|
||||||
|
\ "test.yml:35: [EANSIBLE0002] Trailing whitespace",
|
||||||
|
\ ])
|
||||||
|
|
||||||
Execute (Run HandleGCCFormat):
|
Execute (HandleGCCFormat should handle the correct lines of output):
|
||||||
let g:loclist = ale#handlers#gcc#HandleGCCFormat(42, [
|
AssertEqual
|
||||||
\ '<stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=]',
|
\ [
|
||||||
\ '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 8,
|
\ 'lnum': 8,
|
||||||
\ 'col': 5,
|
\ 'col': 5,
|
||||||
@ -74,129 +55,99 @@ Then (The loclist should be correct):
|
|||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'invalid operands to binary - (have ‘int’ and ‘char *’)',
|
\ 'text': 'invalid operands to binary - (have ‘int’ and ‘char *’)',
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#gcc#HandleGCCFormat(42, [
|
||||||
|
\ '<stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=]',
|
||||||
|
\ '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
|
||||||
|
\ ])
|
||||||
|
|
||||||
Execute (Run HandleUnixFormatAsError):
|
Execute (HandleUnixFormatAsError should handle some example lines of output):
|
||||||
let g:loclist = ale#handlers#HandleUnixFormatAsError(42, [
|
AssertEqual
|
||||||
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
\ [
|
||||||
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
|
||||||
\ 'test.pug:1:1 ".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 27,
|
\ 'lnum': 27,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 53,
|
\ 'lnum': 53,
|
||||||
\ 'col': 10,
|
\ 'col': 10,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 1,
|
\ 'lnum': 1,
|
||||||
\ 'col': 1,
|
\ 'col': 1,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': '".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
\ 'text': '".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandleUnixFormatAsError(42, [
|
||||||
Execute (Run HandleUnixFormatAsWarning):
|
|
||||||
let g:loclist = ale#handlers#HandleUnixFormatAsWarning(42, [
|
|
||||||
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||||
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
\])
|
\ 'test.pug:1:1 ".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
|
||||||
|
\ ])
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
Execute (HandleUnixFormatAsWarning should handle some example lines of output):
|
||||||
AssertEqual [
|
AssertEqual
|
||||||
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 27,
|
\ 'lnum': 27,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 53,
|
\ 'lnum': 53,
|
||||||
\ 'col': 10,
|
\ 'col': 10,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
\ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandleUnixFormatAsWarning(42, [
|
||||||
|
\ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||||
|
\ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
|
||||||
|
\ ])
|
||||||
|
|
||||||
Execute (Run a Unix format function with a Windows path):
|
Execute (Unix format functions should handle Windows paths):
|
||||||
let g:loclist = ale#handlers#HandleUnixFormatAsError(42, [
|
AssertEqual
|
||||||
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:27: foo',
|
\ [
|
||||||
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:53:10: foo',
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 27,
|
\ 'lnum': 27,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'foo',
|
\ 'text': 'foo',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 53,
|
\ 'lnum': 53,
|
||||||
\ 'col': 10,
|
\ 'col': 10,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'foo',
|
\ 'text': 'foo',
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandleUnixFormatAsError(42, [
|
||||||
|
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:27: foo',
|
||||||
|
\ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:53:10: foo',
|
||||||
|
\ ])
|
||||||
|
|
||||||
Execute (Run HandleCppCheckFormat):
|
Execute (HandleCppCheckFormat should handle some example lines of output):
|
||||||
let g:loclist = ale#handlers#HandleCppCheckFormat(42, [
|
AssertEqual
|
||||||
\ '[/tmp/test.c:5]: (style) Variable a is assigned a value that is never used.',
|
\ [
|
||||||
\ '[/tmp/test.c:12]: (error) Array a[10] accessed at index 10, which is out of bounds.'
|
|
||||||
\])
|
|
||||||
|
|
||||||
Then (The loclist should be correct):
|
|
||||||
AssertEqual [
|
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 5,
|
\ 'lnum': 5,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': 'Variable a is assigned a value that is never used. (style)',
|
\ 'text': 'Variable a is assigned a value that is never used. (style)',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'bufnr': 42,
|
|
||||||
\ 'vcol': 0,
|
|
||||||
\ 'nr': -1,
|
|
||||||
\ 'lnum': 12,
|
\ 'lnum': 12,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'Array a[10] accessed at index 10, which is out of bounds. (error)',
|
\ 'text': 'Array a[10] accessed at index 10, which is out of bounds. (error)',
|
||||||
\ },
|
\ },
|
||||||
\], g:loclist
|
\ ],
|
||||||
|
\ ale#handlers#HandleCppCheckFormat(42, [
|
||||||
After:
|
\ '[/tmp/test.c:5]: (style) Variable a is assigned a value that is never used.',
|
||||||
unlet g:loclist
|
\ '[/tmp/test.c:12]: (error) Array a[10] accessed at index 10, which is out of bounds.'
|
||||||
|
\ ])
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
Execute(The ghc handler should handle hdevtools output):
|
Execute(The ghc handler should handle hdevtools output):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {'lnum': 147, 'bufnr': 12, 'vcol': 0, 'nr': -1, 'type': 'W', 'col': 62, 'text': '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’ Expected type: [T.Text]'},
|
\ {
|
||||||
|
\ 'lnum': 147,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'col': 62,
|
||||||
|
\ 'text': '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’ Expected type: [T.Text]',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#HandleGhcFormat(12, [
|
\ ale#handlers#HandleGhcFormat(12, [
|
||||||
\ '/path/to/foo.hs:147:62: warning:',
|
\ '/path/to/foo.hs:147:62: warning:',
|
||||||
@ -10,13 +14,21 @@ Execute(The ghc handler should handle hdevtools output):
|
|||||||
\ ' Expected type: [T.Text]',
|
\ ' Expected type: [T.Text]',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
|
||||||
Execute(The ghc handler should handle ghc 8 output):
|
Execute(The ghc handler should handle ghc 8 output):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {'lnum': 6, 'bufnr': 47, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 1, 'text': ' Failed to load interface for ‘GitHub.Data’ Use -v to see a list of the files searched for.'},
|
\ {
|
||||||
\ {'lnum': 7, 'bufnr': 47, 'vcol': 0, 'nr': -1, 'type': 'W', 'col': 1, 'text': ' Failed to load interface for ‘GitHub.Endpoints.PullRequests’ Use -v to see a list of the files searched for.'},
|
\ 'lnum': 6,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 1,
|
||||||
|
\ 'text': ' Failed to load interface for ‘GitHub.Data’ Use -v to see a list of the files searched for.',
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 7,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'col': 1,
|
||||||
|
\ 'text': ' Failed to load interface for ‘GitHub.Endpoints.PullRequests’ Use -v to see a list of the files searched for.',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#HandleGhcFormat(47, [
|
\ ale#handlers#HandleGhcFormat(47, [
|
||||||
\ '',
|
\ '',
|
||||||
@ -29,12 +41,15 @@ Execute(The ghc handler should handle ghc 8 output):
|
|||||||
\ ' Use -v to see a list of the files searched for.',
|
\ ' Use -v to see a list of the files searched for.',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
|
||||||
Execute(The ghc handler should handle ghc 7 output):
|
Execute(The ghc handler should handle ghc 7 output):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {'lnum': 168, 'bufnr': 47, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 1, 'text': ' parse error (possibly incorrect indentation or mismatched brackets)'},
|
\ {
|
||||||
|
\ 'lnum': 168,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 1,
|
||||||
|
\ 'text': ' parse error (possibly incorrect indentation or mismatched brackets)',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#HandleGhcFormat(47, [
|
\ ale#handlers#HandleGhcFormat(47, [
|
||||||
\ 'src/Main.hs:168:1:',
|
\ 'src/Main.hs:168:1:',
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
Execute(The Rust handler should handle rustc output):
|
Execute(The Rust handler should handle rustc output):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {'lnum': 15, 'bufnr': 347, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 418, 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`'},
|
\ {
|
||||||
\ {'lnum': 13, 'bufnr': 347, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 407, 'text': 'no method named `wat` found for type `std::string::String` in the current scope'},
|
\ 'lnum': 15,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 418,
|
||||||
|
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 13,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 407,
|
||||||
|
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
|
\ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
|
||||||
\ '',
|
\ '',
|
||||||
@ -16,8 +26,18 @@ Execute(The Rust handler should handle rustc output):
|
|||||||
Execute(The Rust handler should handle cargo output):
|
Execute(The Rust handler should handle cargo output):
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {'lnum': 15, 'bufnr': 347, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 11505, 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`'},
|
\ {
|
||||||
\ {'lnum': 13, 'bufnr': 347, 'vcol': 0, 'nr': -1, 'type': 'E', 'col': 11494, 'text': 'no method named `wat` found for type `std::string::String` in the current scope'},
|
\ 'lnum': 15,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 11505,
|
||||||
|
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 13,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'col': 11494,
|
||||||
|
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
|
\ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
|
||||||
\ '',
|
\ '',
|
||||||
|
Loading…
Reference in New Issue
Block a user