From 1f7679e619a64bdc1557db90995b1276531c52b8 Mon Sep 17 00:00:00 2001 From: Adriaan Zonnenberg Date: Fri, 31 Mar 2017 00:33:38 +0200 Subject: [PATCH] Remove 'col' from linters where it is hardcoded to 1 (#434) * Remove 'col' from linters where it is hardcoded to 1 When 'col' is 1, the first column will get highlighted for no reason. It should be 0 (which is the default). In the scalac linter there was also a check about the outcome of `stridx`. It would set l:col to 0 if it was -1, and then it uses `'col': l:col + 1` to convert the outcome of `stridx` to the actual column number. This will make 'col' equals 1 when there is no match. We can remove the check because `-1 + 1 = 0`. * Remove outdated comments about vcol vcol was added as a default, and the loclists that follow these comments do not contain 'vcol' anymore Conflicts: ale_linters/elixir/dogma.vim --- ale_linters/chef/foodcritic.vim | 1 - ale_linters/coffee/coffeelint.vim | 3 --- ale_linters/d/dmd.vim | 1 - ale_linters/dockerfile/hadolint.vim | 1 - ale_linters/elixir/credo.vim | 1 - ale_linters/erlang/erlc.vim | 1 - ale_linters/haskell/hlint.vim | 1 - ale_linters/html/tidy.vim | 1 - ale_linters/java/javac.vim | 1 - ale_linters/javascript/eslint.vim | 1 - ale_linters/javascript/standard.vim | 1 - ale_linters/json/jsonlint.vim | 1 - ale_linters/lua/luacheck.vim | 1 - ale_linters/matlab/mlint.vim | 1 - ale_linters/perl/perl.vim | 3 --- ale_linters/perl/perlcritic.vim | 3 --- ale_linters/php/php.vim | 1 - ale_linters/php/phpcs.vim | 1 - ale_linters/php/phpmd.vim | 1 - ale_linters/puppet/puppet.vim | 1 - ale_linters/ruby/rubocop.vim | 1 - ale_linters/scala/scalac.vim | 5 ----- ale_linters/scss/scsslint.vim | 1 - ale_linters/sh/shell.vim | 3 --- ale_linters/sml/smlnj.vim | 1 - ale_linters/typescript/tslint.vim | 1 - ale_linters/typescript/typecheck.vim | 1 - ale_linters/verilog/iverilog.vim | 1 - ale_linters/verilog/verilator.vim | 1 - ale_linters/yaml/yamllint.vim | 1 - test/handler/test_coffeelint_handler.vader | 1 - 31 files changed, 43 deletions(-) diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim index 44ab5681..0a6807b2 100644 --- a/ale_linters/chef/foodcritic.vim +++ b/ale_linters/chef/foodcritic.vim @@ -17,7 +17,6 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort let l:text = l:match[1] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[3] + 0, diff --git a/ale_linters/coffee/coffeelint.vim b/ale_linters/coffee/coffeelint.vim index e32f7b79..614f45aa 100644 --- a/ale_linters/coffee/coffeelint.vim +++ b/ale_linters/coffee/coffeelint.vim @@ -32,15 +32,12 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort endif let l:line = l:match[1] + 0 - let l:column = 1 let l:type = l:match[3] ==# 'error' ? 'E' : 'W' let l:text = l:match[4] - " vcol is needed to indicate that the column is a character call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': l:column, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim index bf3d3d38..45565d0c 100644 --- a/ale_linters/d/dmd.vim +++ b/ale_linters/d/dmd.vim @@ -68,7 +68,6 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort let l:type = l:match[3] let l:text = l:match[4] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': bufnr('%'), \ 'lnum': l:line, diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim index f82cb8a1..d0789ae8 100644 --- a/ale_linters/dockerfile/hadolint.vim +++ b/ale_linters/dockerfile/hadolint.vim @@ -23,7 +23,6 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort let l:type = 'W' let l:text = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:lnum, diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim index 8ce12427..06c2a913 100644 --- a/ale_linters/elixir/credo.vim +++ b/ale_linters/elixir/credo.vim @@ -23,7 +23,6 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort let l:type = 'W' endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/erlang/erlc.vim b/ale_linters/erlang/erlc.vim index 871d4c88..d6adf126 100644 --- a/ale_linters/erlang/erlc.vim +++ b/ale_linters/erlang/erlc.vim @@ -73,7 +73,6 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort let l:type = 'E' endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, diff --git a/ale_linters/haskell/hlint.vim b/ale_linters/haskell/hlint.vim index 6a907ab9..77952cf4 100644 --- a/ale_linters/haskell/hlint.vim +++ b/ale_linters/haskell/hlint.vim @@ -7,7 +7,6 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort let l:output = [] for l:error in l:errors - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:error.startLine + 0, diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim index de873c86..9067f9d4 100644 --- a/ale_linters/html/tidy.vim +++ b/ale_linters/html/tidy.vim @@ -49,7 +49,6 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort let l:type = l:match[3] ==# 'Error' ? 'E' : 'W' let l:text = l:match[4] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim index 5652d9d3..9df95774 100644 --- a/ale_linters/java/javac.vim +++ b/ale_linters/java/javac.vim @@ -34,7 +34,6 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, - \ 'col': 1, \ 'text': l:match[2] . ':' . l:match[3], \ 'type': l:match[2] ==# 'error' ? 'E' : 'W', \}) diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim index ac88dd00..4b4660b8 100644 --- a/ale_linters/javascript/eslint.vim +++ b/ale_linters/javascript/eslint.vim @@ -76,7 +76,6 @@ function! ale_linters#javascript#eslint#Handle(buffer, lines) abort let l:text .= ' [' . l:match[4] . ']' endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim index 1232b652..891de83f 100644 --- a/ale_linters/javascript/standard.vim +++ b/ale_linters/javascript/standard.vim @@ -47,7 +47,6 @@ function! ale_linters#javascript#standard#Handle(buffer, lines) abort let l:type = 'Error' let l:text = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/json/jsonlint.vim b/ale_linters/json/jsonlint.vim index e1fb2bd5..83e74c71 100644 --- a/ale_linters/json/jsonlint.vim +++ b/ale_linters/json/jsonlint.vim @@ -14,7 +14,6 @@ function! ale_linters#json#jsonlint#Handle(buffer, lines) abort continue endif - " vcol is needed to indicate that the column is a character call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim index c4c79b16..e208c93b 100644 --- a/ale_linters/lua/luacheck.vim +++ b/ale_linters/lua/luacheck.vim @@ -19,7 +19,6 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort continue endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/matlab/mlint.vim b/ale_linters/matlab/mlint.vim index 563cf19d..775d431c 100644 --- a/ale_linters/matlab/mlint.vim +++ b/ale_linters/matlab/mlint.vim @@ -40,7 +40,6 @@ function! ale_linters#matlab#mlint#Handle(buffer, lines) abort continue endif - " vcol is needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:lnum, diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim index 9d24ed9a..23586a76 100644 --- a/ale_linters/perl/perl.vim +++ b/ale_linters/perl/perl.vim @@ -29,15 +29,12 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort endif let l:line = l:match[3] - let l:column = 1 let l:text = l:match[1] let l:type = 'E' - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': l:column, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/perl/perlcritic.vim b/ale_linters/perl/perlcritic.vim index f146085d..8f31e513 100644 --- a/ale_linters/perl/perlcritic.vim +++ b/ale_linters/perl/perlcritic.vim @@ -13,15 +13,12 @@ function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort endif let l:line = l:match[3] - let l:column = 1 let l:text = l:match[1] let l:type = 'E' - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': l:column, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/php/php.vim b/ale_linters/php/php.vim index 6edc66b3..ebc21ea3 100644 --- a/ale_linters/php/php.vim +++ b/ale_linters/php/php.vim @@ -16,7 +16,6 @@ function! ale_linters#php#php#Handle(buffer, lines) abort continue endif - " vcol is needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[3] + 0, diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim index 2edd6ed5..73dd940f 100644 --- a/ale_linters/php/phpcs.vim +++ b/ale_linters/php/phpcs.vim @@ -29,7 +29,6 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort let l:text = l:match[4] let l:type = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/php/phpmd.vim b/ale_linters/php/phpmd.vim index e172a6a1..c8d1b79d 100644 --- a/ale_linters/php/phpmd.vim +++ b/ale_linters/php/phpmd.vim @@ -18,7 +18,6 @@ function! ale_linters#php#phpmd#Handle(buffer, lines) abort continue endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim index 6561bf8e..12bc980e 100644 --- a/ale_linters/puppet/puppet.vim +++ b/ale_linters/puppet/puppet.vim @@ -14,7 +14,6 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort continue endif - " vcol is needed to indicate that the column is a character call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[2] + 0, diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim index 7f6985de..42e06e42 100644 --- a/ale_linters/ruby/rubocop.vim +++ b/ale_linters/ruby/rubocop.vim @@ -19,7 +19,6 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort let l:text = l:match[4] let l:type = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/scala/scalac.vim b/ale_linters/scala/scalac.vim index 6cd4d249..c6ab9c6d 100644 --- a/ale_linters/scala/scalac.vim +++ b/ale_linters/scala/scalac.vim @@ -23,13 +23,8 @@ function! ale_linters#scala#scalac#Handle(buffer, lines) abort if l:ln + 1 < len(a:lines) let l:col = stridx(a:lines[l:ln + 1], '^') - - if l:col == -1 - let l:col = 0 - endif endif - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/scss/scsslint.vim b/ale_linters/scss/scsslint.vim index d8aeef06..bc02e931 100644 --- a/ale_linters/scss/scsslint.vim +++ b/ale_linters/scss/scsslint.vim @@ -20,7 +20,6 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines) abort continue endif - " vcol is needed to indicate that the column is a character call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim index c7365ae9..7ab98fd6 100644 --- a/ale_linters/sh/shell.vim +++ b/ale_linters/sh/shell.vim @@ -49,15 +49,12 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort endif let l:line = l:match[1] + 0 - let l:column = 1 let l:text = l:match[2] let l:type = 'E' - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': l:column, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/sml/smlnj.vim b/ale_linters/sml/smlnj.vim index c75f89bb..a227a95d 100644 --- a/ale_linters/sml/smlnj.vim +++ b/ale_linters/sml/smlnj.vim @@ -23,7 +23,6 @@ function! ale_linters#sml#smlnj#Handle(buffer, lines) abort call add(l:out, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, - \ 'col': 1, \ 'text': l:match[2] . ': ' . l:match[3], \ 'type': l:match[2] ==# 'error' ? 'E' : 'W', \}) diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index 8eeb98d7..72e230c5 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -37,7 +37,6 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort let l:type = 'E' let l:text = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, diff --git a/ale_linters/typescript/typecheck.vim b/ale_linters/typescript/typecheck.vim index c5ba05f2..2362b3c9 100644 --- a/ale_linters/typescript/typecheck.vim +++ b/ale_linters/typescript/typecheck.vim @@ -22,7 +22,6 @@ function! ale_linters#typescript#typecheck#Handle(buffer, lines) abort let l:type = 'E' let l:text = l:match[3] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, diff --git a/ale_linters/verilog/iverilog.vim b/ale_linters/verilog/iverilog.vim index 0a118f3e..a061e473 100644 --- a/ale_linters/verilog/iverilog.vim +++ b/ale_linters/verilog/iverilog.vim @@ -25,7 +25,6 @@ function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': 1, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim index b1344382..fbff2b2e 100644 --- a/ale_linters/verilog/verilator.vim +++ b/ale_linters/verilog/verilator.vim @@ -39,7 +39,6 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, - \ 'col': 1, \ 'text': l:text, \ 'type': l:type, \}) diff --git a/ale_linters/yaml/yamllint.vim b/ale_linters/yaml/yamllint.vim index dcad70c3..018553db 100644 --- a/ale_linters/yaml/yamllint.vim +++ b/ale_linters/yaml/yamllint.vim @@ -35,7 +35,6 @@ function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort let l:type = l:match[3] let l:text = l:match[4] - " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, diff --git a/test/handler/test_coffeelint_handler.vader b/test/handler/test_coffeelint_handler.vader index 2d56e7c8..10370221 100644 --- a/test/handler/test_coffeelint_handler.vader +++ b/test/handler/test_coffeelint_handler.vader @@ -6,7 +6,6 @@ Execute(The coffeelint handler should parse lines correctly): \ { \ 'bufnr': 347, \ 'lnum': 125, - \ 'col': 1, \ 'text': "Line exceeds maximum allowed length Length is 122, max is 120.", \ 'type': 'E', \ },