summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/chef/foodcritic.vim2
-rw-r--r--ale_linters/coffee/coffeelint.vim2
-rw-r--r--ale_linters/cs/mcs.vim2
-rw-r--r--ale_linters/d/dmd.vim2
-rw-r--r--ale_linters/dockerfile/hadolint.vim1
-rw-r--r--ale_linters/elixir/credo.vim2
-rw-r--r--ale_linters/elm/make.vim2
-rw-r--r--ale_linters/erlang/erlc.vim4
-rw-r--r--ale_linters/fortran/gcc.vim2
-rw-r--r--ale_linters/go/gobuild.vim2
-rw-r--r--ale_linters/haskell/hlint.vim1
-rw-r--r--ale_linters/html/tidy.vim2
-rw-r--r--ale_linters/java/javac.vim2
-rw-r--r--ale_linters/javascript/eslint.vim2
-rw-r--r--ale_linters/javascript/flow.vim1
-rw-r--r--ale_linters/javascript/standard.vim2
-rw-r--r--ale_linters/json/jsonlint.vim2
-rw-r--r--ale_linters/lua/luacheck.vim2
-rw-r--r--ale_linters/markdown/mdl.vim2
-rw-r--r--ale_linters/matlab/mlint.vim2
-rw-r--r--ale_linters/perl/perl.vim2
-rw-r--r--ale_linters/perl/perlcritic.vim2
-rw-r--r--ale_linters/php/hack.vim1
-rw-r--r--ale_linters/php/php.vim2
-rw-r--r--ale_linters/php/phpcs.vim2
-rw-r--r--ale_linters/php/phpmd.vim2
-rw-r--r--ale_linters/puppet/puppet.vim2
-rw-r--r--ale_linters/python/mypy.vim2
-rw-r--r--ale_linters/ruby/rubocop.vim2
-rw-r--r--ale_linters/scala/scalac.vim2
-rw-r--r--ale_linters/scss/scsslint.vim2
-rw-r--r--ale_linters/sh/shell.vim2
-rw-r--r--ale_linters/sml/smlnj.vim2
-rw-r--r--ale_linters/tex/chktex.vim2
-rw-r--r--ale_linters/tex/lacheck.vim2
-rw-r--r--ale_linters/typescript/tslint.vim2
-rw-r--r--ale_linters/typescript/typecheck.vim2
-rw-r--r--ale_linters/verilog/iverilog.vim2
-rw-r--r--ale_linters/verilog/verilator.vim2
-rw-r--r--ale_linters/yaml/yamllint.vim2
-rw-r--r--autoload/ale/engine.vim43
-rw-r--r--doc/ale.txt20
-rw-r--r--test/test_credo_handler.vader4
-rw-r--r--test/test_eslint_handler.vader6
-rw-r--r--test/test_flow_handler.vader2
-rw-r--r--test/test_fortran_handler.vader12
-rw-r--r--test/test_loclist_corrections.vader130
-rw-r--r--test/test_mypy_handler.vader4
-rw-r--r--test/test_php_handler.vader10
-rw-r--r--test/test_standard_handler.vader6
-rw-r--r--test/test_typecheck_handler.vader4
51 files changed, 185 insertions, 134 deletions
diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim
index 0728a37e..44ab5681 100644
--- a/ale_linters/chef/foodcritic.vim
+++ b/ale_linters/chef/foodcritic.vim
@@ -21,11 +21,9 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[3] + 0,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': l:text,
\ 'type': 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/coffee/coffeelint.vim b/ale_linters/coffee/coffeelint.vim
index 8b1c713e..a7960b98 100644
--- a/ale_linters/coffee/coffeelint.vim
+++ b/ale_linters/coffee/coffeelint.vim
@@ -40,11 +40,9 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/cs/mcs.vim b/ale_linters/cs/mcs.vim
index 3d39cfb7..f1e1fc87 100644
--- a/ale_linters/cs/mcs.vim
+++ b/ale_linters/cs/mcs.vim
@@ -21,11 +21,9 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3] . ': ' . l:match[4],
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim
index 26e80145..bf3d3d38 100644
--- a/ale_linters/d/dmd.vim
+++ b/ale_linters/d/dmd.vim
@@ -72,11 +72,9 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': bufnr('%'),
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
index dc8e642c..f82cb8a1 100644
--- a/ale_linters/dockerfile/hadolint.vim
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -27,7 +27,6 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:lnum,
- \ 'vcol': 0,
\ 'col': 0,
\ 'type': l:type,
\ 'text': l:text,
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 6bf3835d..8ce12427 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -27,11 +27,9 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'type': l:type,
\ 'text': l:text,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim
index 714272c5..23297838 100644
--- a/ale_linters/elm/make.vim
+++ b/ale_linters/elm/make.vim
@@ -22,11 +22,9 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:error.region.start.line,
- \ 'vcol': 0,
\ 'col': l:error.region.start.column,
\ 'type': (l:error.type ==? 'error') ? 'E' : 'W',
\ 'text': l:error.overview,
- \ 'nr': -1,
\})
endif
endfor
diff --git a/ale_linters/erlang/erlc.vim b/ale_linters/erlang/erlc.vim
index 571592fb..8433d9a1 100644
--- a/ale_linters/erlang/erlc.vim
+++ b/ale_linters/erlang/erlc.vim
@@ -43,11 +43,9 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': 0,
- \ 'vcol': 0,
\ 'col': 0,
\ 'type': 'E',
\ 'text': l:match_parse_transform[0],
- \ 'nr': -1,
\})
continue
@@ -77,11 +75,9 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': 0,
\ 'type': l:type,
\ 'text': l:text,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/fortran/gcc.vim b/ale_linters/fortran/gcc.vim
index 8d15cc00..6d3f495c 100644
--- a/ale_linters/fortran/gcc.vim
+++ b/ale_linters/fortran/gcc.vim
@@ -41,9 +41,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
let l:last_loclist_obj = {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
- \ 'nr': -1,
\}
" Start looking for the message and error type.
diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim
index 832669f2..e6ca9f97 100644
--- a/ale_linters/go/gobuild.vim
+++ b/ale_linters/go/gobuild.vim
@@ -190,11 +190,9 @@ function! ale_linters#go#gobuild#Handler(buffer, lines) abort
call add(l:output, {
\ 'bufnr': l:buffer,
\ 'lnum': l:match[2] + 0,
- \ 'vcol': 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[4],
\ 'type': 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/haskell/hlint.vim b/ale_linters/haskell/hlint.vim
index 5b870e3d..6a907ab9 100644
--- a/ale_linters/haskell/hlint.vim
+++ b/ale_linters/haskell/hlint.vim
@@ -11,7 +11,6 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:error.startLine + 0,
- \ 'vcol': 0,
\ 'col': l:error.startColumn + 0,
\ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to,
\ 'type': l:error.severity ==# 'Error' ? 'E' : 'W',
diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim
index 53520347..de873c86 100644
--- a/ale_linters/html/tidy.vim
+++ b/ale_linters/html/tidy.vim
@@ -53,11 +53,9 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:col,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index af2dbc96..5652d9d3 100644
--- a/ale_linters/java/javac.vim
+++ b/ale_linters/java/javac.vim
@@ -34,11 +34,9 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': 1,
\ 'text': l:match[2] . ':' . l:match[3],
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim
index c2794ec8..baca3dd2 100644
--- a/ale_linters/javascript/eslint.vim
+++ b/ale_linters/javascript/eslint.vim
@@ -65,11 +65,9 @@ function! ale_linters#javascript#eslint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:text,
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim
index c1ee4b2d..98bda753 100644
--- a/ale_linters/javascript/flow.vim
+++ b/ale_linters/javascript/flow.vim
@@ -68,7 +68,6 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:col,
\ 'text': l:text,
\ 'type': l:error.level ==# 'error' ? 'E' : 'W',
diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim
index 9dc2d205..1232b652 100644
--- a/ale_linters/javascript/standard.vim
+++ b/ale_linters/javascript/standard.vim
@@ -51,11 +51,9 @@ function! ale_linters#javascript#standard#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:text,
\ 'type': 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/json/jsonlint.vim b/ale_linters/json/jsonlint.vim
index 5af8f625..e1fb2bd5 100644
--- a/ale_linters/json/jsonlint.vim
+++ b/ale_linters/json/jsonlint.vim
@@ -18,11 +18,9 @@ function! ale_linters#json#jsonlint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3],
\ 'type': 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim
index ace464ce..c4c79b16 100644
--- a/ale_linters/lua/luacheck.vim
+++ b/ale_linters/lua/luacheck.vim
@@ -23,11 +23,9 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3],
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/markdown/mdl.vim b/ale_linters/markdown/mdl.vim
index c984252e..7e64304c 100644
--- a/ale_linters/markdown/mdl.vim
+++ b/ale_linters/markdown/mdl.vim
@@ -16,11 +16,9 @@ function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/matlab/mlint.vim b/ale_linters/matlab/mlint.vim
index 8eb747ec..563cf19d 100644
--- a/ale_linters/matlab/mlint.vim
+++ b/ale_linters/matlab/mlint.vim
@@ -44,11 +44,9 @@ function! ale_linters#matlab#mlint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:lnum,
- \ 'vcol': 0,
\ 'col': l:col,
\ 'text': l:text,
\ 'type': 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index 3724244e..4a4ea508 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -21,11 +21,9 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/perl/perlcritic.vim b/ale_linters/perl/perlcritic.vim
index dfad2d48..f146085d 100644
--- a/ale_linters/perl/perlcritic.vim
+++ b/ale_linters/perl/perlcritic.vim
@@ -21,11 +21,9 @@ function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/php/hack.vim b/ale_linters/php/hack.vim
index 5c90247b..762486b4 100644
--- a/ale_linters/php/hack.vim
+++ b/ale_linters/php/hack.vim
@@ -19,7 +19,6 @@ function! ale_linters#php#hack#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[2] + 0,
- \ 'vcol': 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[5],
\ 'type': 'E',
diff --git a/ale_linters/php/php.vim b/ale_linters/php/php.vim
index d95e28a8..aa5229cf 100644
--- a/ale_linters/php/php.vim
+++ b/ale_linters/php/php.vim
@@ -20,11 +20,9 @@ function! ale_linters#php#php#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[3] + 0,
- \ 'vcol': 0,
\ 'col': empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1,
\ 'text': l:match[1],
\ 'type': 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim
index 4b3cabdf..2edd6ed5 100644
--- a/ale_linters/php/phpcs.vim
+++ b/ale_linters/php/phpcs.vim
@@ -33,11 +33,9 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:text,
\ 'type': l:type ==# 'error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/php/phpmd.vim b/ale_linters/php/phpmd.vim
index e7f87bc5..e172a6a1 100644
--- a/ale_linters/php/phpmd.vim
+++ b/ale_linters/php/phpmd.vim
@@ -22,11 +22,9 @@ function! ale_linters#php#phpmd#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim
index 175d059f..6561bf8e 100644
--- a/ale_linters/puppet/puppet.vim
+++ b/ale_linters/puppet/puppet.vim
@@ -18,11 +18,9 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[2] + 0,
- \ 'vcol': 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[1],
\ 'type': 'E',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim
index 55ab9022..187bb83c 100644
--- a/ale_linters/python/mypy.vim
+++ b/ale_linters/python/mypy.vim
@@ -44,11 +44,9 @@ function! g:ale_linters#python#mypy#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3] =~# 'error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 87fc7b79..7f6985de 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -23,11 +23,9 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:text,
\ 'type': index(['C', 'E'], l:type) != -1 ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/scala/scalac.vim b/ale_linters/scala/scalac.vim
index 6f462068..6cd4d249 100644
--- a/ale_linters/scala/scalac.vim
+++ b/ale_linters/scala/scalac.vim
@@ -33,11 +33,9 @@ function! ale_linters#scala#scalac#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:col + 1,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/scss/scsslint.vim b/ale_linters/scss/scsslint.vim
index 1ee06622..d8aeef06 100644
--- a/ale_linters/scss/scsslint.vim
+++ b/ale_linters/scss/scsslint.vim
@@ -24,11 +24,9 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3] ==# 'E' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim
index 786cc0e6..c7365ae9 100644
--- a/ale_linters/sh/shell.vim
+++ b/ale_linters/sh/shell.vim
@@ -57,11 +57,9 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/sml/smlnj.vim b/ale_linters/sml/smlnj.vim
index 5e7f40a4..c75f89bb 100644
--- a/ale_linters/sml/smlnj.vim
+++ b/ale_linters/sml/smlnj.vim
@@ -23,11 +23,9 @@ function! ale_linters#sml#smlnj#Handle(buffer, lines) abort
call add(l:out, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': 1,
\ 'text': l:match[2] . ': ' . l:match[3],
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/tex/chktex.vim b/ale_linters/tex/chktex.vim
index 2d53c667..95fd2bad 100644
--- a/ale_linters/tex/chktex.vim
+++ b/ale_linters/tex/chktex.vim
@@ -44,11 +44,9 @@ function! ale_linters#tex#chktex#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')',
\ 'type': 'W',
- \ 'nr': -1
\})
endfor
diff --git a/ale_linters/tex/lacheck.vim b/ale_linters/tex/lacheck.vim
index 848cbed2..94b79e6c 100644
--- a/ale_linters/tex/lacheck.vim
+++ b/ale_linters/tex/lacheck.vim
@@ -38,11 +38,9 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': 'W',
- \ 'nr': -1
\})
endfor
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index ae41ed4f..2f4d235e 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -27,11 +27,9 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/typescript/typecheck.vim b/ale_linters/typescript/typecheck.vim
index 0de6639c..c5ba05f2 100644
--- a/ale_linters/typescript/typecheck.vim
+++ b/ale_linters/typescript/typecheck.vim
@@ -26,11 +26,9 @@ function! ale_linters#typescript#typecheck#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/verilog/iverilog.vim b/ale_linters/verilog/iverilog.vim
index cf1b0fa8..0a118f3e 100644
--- a/ale_linters/verilog/iverilog.vim
+++ b/ale_linters/verilog/iverilog.vim
@@ -25,11 +25,9 @@ function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': 1,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endfor
diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim
index 4ff2093a..b1344382 100644
--- a/ale_linters/verilog/verilator.vim
+++ b/ale_linters/verilog/verilator.vim
@@ -39,11 +39,9 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': 1,
\ 'text': l:text,
\ 'type': l:type,
- \ 'nr': -1,
\})
endif
endfor
diff --git a/ale_linters/yaml/yamllint.vim b/ale_linters/yaml/yamllint.vim
index 42006fb4..dcad70c3 100644
--- a/ale_linters/yaml/yamllint.vim
+++ b/ale_linters/yaml/yamllint.vim
@@ -39,11 +39,9 @@ function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:line,
- \ 'vcol': 0,
\ 'col': l:col,
\ 'text': l:text,
\ 'type': l:type ==# 'error' ? 'E' : 'W',
- \ 'nr': -1,
\})
endfor
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 61db4a1c..bc834083 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -219,12 +219,9 @@ function! s:HandleExit(job) abort
let l:linter_loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output)
- " Make some adjustments to the loclists to fix common problems.
- call s:FixLocList(l:buffer, l:linter_loclist)
-
- for l:item in l:linter_loclist
- let l:item.linter_name = l:linter.name
- endfor
+ " Make some adjustments to the loclists to fix common problems, and also
+ " to set default values for loclist items.
+ let l:linter_loclist = ale#engine#FixLocList(l:buffer, l:linter, l:linter_loclist)
" Add the loclist items from the linter.
call extend(g:ale_buffer_info[l:buffer].new_loclist, l:linter_loclist)
@@ -303,20 +300,50 @@ function! s:HandleExitStatusVim(job, exit_code) abort
call s:SetExitCode(a:job, a:exit_code)
endfunction
-function! s:FixLocList(buffer, loclist) abort
+function! ale#engine#FixLocList(buffer, linter, loclist) abort
+ let l:new_loclist = []
+
" Some errors have line numbers beyond the end of the file,
" so we need to adjust them so they set the error at the last line
" of the file instead.
let l:last_line_number = ale#util#GetLineCount(a:buffer)
- for l:item in a:loclist
+ for l:old_item in a:loclist
+ " Copy the loclist item with some default values and corrections.
+ "
+ " line and column numbers will be converted to numbers.
+ " The buffer will default to the buffer being checked.
+ " The vcol setting will default to 0, a byte index.
+ " The error type will default to 'E' for errors.
+ " The error number will default to -1.
+ "
+ " The line number and text are the only required keys.
+ "
+ " The linter_name will be set on the errors so it can be used in
+ " output, filtering, etc..
+ let l:item = {
+ \ 'text': l:old_item.text,
+ \ 'lnum': str2nr(l:old_item.lnum),
+ \ 'col': str2nr(get(l:old_item, 'col', 0)),
+ \ 'bufnr': get(l:old_item, 'bufnr', a:buffer),
+ \ 'vcol': get(l:old_item, 'vcol', 0),
+ \ 'type': get(l:old_item, 'type', 'E'),
+ \ 'nr': get(l:old_item, 'nr', -1),
+ \ 'linter_name': a:linter.name,
+ \}
+
if l:item.lnum == 0
" When errors appear at line 0, put them at line 1 instead.
let l:item.lnum = 1
elseif l:item.lnum > l:last_line_number
+ " When errors go beyond the end of the file, put them at the end.
let l:item.lnum = l:last_line_number
endif
+
+ call add(l:new_loclist, l:item)
endfor
+
+ return l:new_loclist
endfunction
" Given part of a command, replace any % with %%, so that no characters in
diff --git a/doc/ale.txt b/doc/ale.txt
index 5f9cdea0..b938ae06 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -1219,6 +1219,26 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
This argument is required.
+ The keys for each item in the List will be handled in
+ the following manner:
+
+ `text` - This error message is required.
+ `lnum` - The line number is required. Any strings
+ will be automatically converted to numbers by
+ using `str2nr()`.
+
+ Line 0 will be moved to line 1, and lines beyond
+ the end of the file will be moved to the end.
+ `col` - The column number is optional and will
+ default to `0`. Any strings will be automatically
+ coverted to number using `str2nr()`.
+ `bufnr` - The buffer number should match the buffer
+ being checked, and this value will default to
+ the buffer being checked.
+ `vcol` - Defaults to `0`.
+ `type` - Defaults to `'E'`.
+ `nr` - Defaults to `-1`.
+
`executable` A |String| naming the executable itself which
will be run. This value will be used to check if the
program requested is installed or not.
diff --git a/test/test_credo_handler.vader b/test/test_credo_handler.vader
index 1100ce1b..73f98ba0 100644
--- a/test/test_credo_handler.vader
+++ b/test/test_credo_handler.vader
@@ -6,20 +6,16 @@ Execute(The credo handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 1,
- \ 'vcol': 0,
\ 'col': 4,
\ 'text': 'There is no whitespace around parentheses/brackets most of the time, but here there is.',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 26,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': 'If/else blocks should not have a negated condition in `if`.',
\ 'type': 'W',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#elixir#credo#Handle(347, [
diff --git a/test/test_eslint_handler.vader b/test/test_eslint_handler.vader
index 57efa6b0..692d8b30 100644
--- a/test/test_eslint_handler.vader
+++ b/test/test_eslint_handler.vader
@@ -6,29 +6,23 @@ Execute(The eslint handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 47,
- \ 'vcol': 0,
\ 'col': 14,
\ 'text': 'Missing trailing comma. [Warning/comma-dangle]',
\ 'type': 'W',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 56,
- \ 'vcol': 0,
\ 'col': 41,
\ 'text': 'Missing semicolon. [Error/semi]',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 13,
- \ 'vcol': 0,
\ 'col': 3,
\ 'text': 'Parsing error: Unexpected token',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#javascript#eslint#Handle(347, [
diff --git a/test/test_flow_handler.vader b/test/test_flow_handler.vader
index 12fe0891..c6b86104 100644
--- a/test/test_flow_handler.vader
+++ b/test/test_flow_handler.vader
@@ -114,7 +114,6 @@ Execute(The flow handler should process errors correctly.):
\ {
\ 'lnum': 417,
\ 'bufnr': 347,
- \ 'vcol': 0,
\ 'type': 'E',
\ 'col': 10,
\ 'text': 'number: This type is incompatible with the expected return type of array type',
@@ -122,7 +121,6 @@ Execute(The flow handler should process errors correctly.):
\ {
\ 'lnum': 419,
\ 'bufnr': 347,
- \ 'vcol': 0,
\ 'type': 'W',
\ 'col': 3,
\ 'text': 'unreachable code:',
diff --git a/test/test_fortran_handler.vader b/test/test_fortran_handler.vader
index 7648ff66..acd83e3c 100644
--- a/test/test_fortran_handler.vader
+++ b/test/test_fortran_handler.vader
@@ -6,20 +6,16 @@ Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
\ {
\ 'bufnr': 357,
\ 'lnum': 4,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 357,
\ 'lnum': 3,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#fortran#gcc#Handle(357, [
@@ -47,20 +43,16 @@ Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
\ {
\ 'bufnr': 357,
\ 'lnum': 3,
- \ 'vcol': 0,
\ 'col': 12,
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 357,
\ 'lnum': 4,
- \ 'vcol': 0,
\ 'col': 12,
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#fortran#gcc#Handle(357, [
@@ -89,20 +81,16 @@ Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
\ {
\ 'bufnr': 337,
\ 'lnum': 3,
- \ 'vcol': 0,
\ 'col': 12,
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 337,
\ 'lnum': 4,
- \ 'vcol': 0,
\ 'col': 12,
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#fortran#gcc#Handle(337, [
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
new file mode 100644
index 00000000..281f6787
--- /dev/null
+++ b/test/test_loclist_corrections.vader
@@ -0,0 +1,130 @@
+Given foo (Some file with lines to count):
+ foo12345678
+ bar12345678
+ baz12345678
+ four12345678
+ five12345678
+ six12345678
+ seven12345678
+ eight12345678
+ nine12345678
+ ten12345678
+
+Execute(FixLocList should set all the default values correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ },
+ \ {
+ \ 'text': 'b',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ {'name': 'foobar'},
+ \ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
+ \ )
+
+Execute(FixLocList should use the values we supply):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 3,
+ \ 'col': 4,
+ \ 'bufnr': 10000,
+ \ 'vcol': 1,
+ \ 'type': 'W',
+ \ 'nr': 42,
+ \ 'linter_name': 'foobar',
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ {'name': 'foobar'},
+ \ [{
+ \ 'text': 'a',
+ \ 'lnum': 3,
+ \ 'col': 4,
+ \ 'bufnr': 10000,
+ \ 'vcol': 1,
+ \ 'type': 'W',
+ \ 'nr': 42,
+ \ }],
+ \ )
+
+Execute(FixLocList should set items with lines beyond the end to the last line):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 10,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ {'name': 'foobar'},
+ \ [{'text': 'a', 'lnum': 11}],
+ \ )
+
+Execute(FixLocList should move line 0 to line 1):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 1,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ {'name': 'foobar'},
+ \ [{'text': 'a', 'lnum': 0}],
+ \ )
+
+Execute(FixLocList should convert line and column numbers correctly):
+ " The numbers should be 10, not 8 as octals.
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 10,
+ \ 'col': 10,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ {'name': 'foobar'},
+ \ [{'text': 'a', 'lnum': '010', 'col': '010'}],
+ \ )
diff --git a/test/test_mypy_handler.vader b/test/test_mypy_handler.vader
index f886501f..e161f8ae 100644
--- a/test/test_mypy_handler.vader
+++ b/test/test_mypy_handler.vader
@@ -6,20 +6,16 @@ Execute(The mypy handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 4,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "No library stub file for module 'django.db'",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 40,
- \ 'vcol': 0,
\ 'col': 5,
\ 'text': "Some other problem",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#python#mypy#Handle(347, [
diff --git a/test/test_php_handler.vader b/test/test_php_handler.vader
index 14e4d60f..c3d76079 100644
--- a/test/test_php_handler.vader
+++ b/test/test_php_handler.vader
@@ -6,47 +6,37 @@ Execute(The php handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 47,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "syntax error, unexpected ';', expecting ']'",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 56,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 13,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "syntax error, unexpected ')'",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 5,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "Invalid numeric literal",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 21,
- \ 'vcol': 0,
\ 'col': 0,
\ 'text': "syntax error, unexpected end of file",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#php#php#Handle(347, [
diff --git a/test/test_standard_handler.vader b/test/test_standard_handler.vader
index 1d1b71c4..4a69c211 100644
--- a/test/test_standard_handler.vader
+++ b/test/test_standard_handler.vader
@@ -6,29 +6,23 @@ Execute(The standard handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 47,
- \ 'vcol': 0,
\ 'col': 14,
\ 'text': 'Expected indentation of 2 spaces but found 4.',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 56,
- \ 'vcol': 0,
\ 'col': 41,
\ 'text': 'Strings must use singlequote.',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 13,
- \ 'vcol': 0,
\ 'col': 3,
\ 'text': 'Parsing error: Unexpected token',
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#javascript#standard#Handle(347, [
diff --git a/test/test_typecheck_handler.vader b/test/test_typecheck_handler.vader
index 2f8a219b..e42bcaf3 100644
--- a/test/test_typecheck_handler.vader
+++ b/test/test_typecheck_handler.vader
@@ -6,20 +6,16 @@ Execute(The typecheck handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 16,
- \ 'vcol': 0,
\ 'col': 7,
\ 'text': "Type 'A' is not assignable to type 'B'",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 7,
- \ 'vcol': 0,
\ 'col': 41,
\ 'text': "Property 'a' does not exist on type 'A'",
\ 'type': 'E',
- \ 'nr': -1,
\ },
\ ],
\ ale_linters#typescript#typecheck#Handle(347, [