From 964d3ab9ec404dd80283703249e5cdaabf3447bf Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 30 Mar 2017 16:37:28 +0100 Subject: [PATCH 1/9] Merge pull request #431 from janclarin/master Check for existence of g:ale_emit_conflict_warnings before checking value --- after/plugin/ale.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/after/plugin/ale.vim b/after/plugin/ale.vim index 463b65a..d738dbd 100644 --- a/after/plugin/ale.vim +++ b/after/plugin/ale.vim @@ -1,13 +1,22 @@ +" Author: w0rp +" Description: Follow-up checks for the plugin: warn about conflicting plugins. + +" A flag for ensuring that this is not run more than one time. if exists('g:loaded_ale_after') finish endif +" Set the flag so this file is not run more than one time. let g:loaded_ale_after = 1 -if !g:ale_emit_conflict_warnings +" Check if the flag is available and set to 0 to disable checking for and +" emitting conflicting plugin warnings. +if exists('g:ale_emit_conflict_warnings') && !g:ale_emit_conflict_warnings finish endif +" Conflicting Plugins Checks + function! s:GetConflictingPluginWarning(plugin_name) abort return 'ALE conflicts with ' . a:plugin_name \ . '. Uninstall it, or disable this warning with ' From 1f7679e619a64bdc1557db90995b1276531c52b8 Mon Sep 17 00:00:00 2001 From: Adriaan Zonnenberg Date: Fri, 31 Mar 2017 00:33:38 +0200 Subject: [PATCH 2/9] 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 44ab568..0a6807b 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 e32f7b7..614f45a 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 bf3d3d3..45565d0 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 f82cb8a..d0789ae 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 8ce1242..06c2a91 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 871d4c8..d6adf12 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 6a907ab..77952cf 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 de873c8..9067f9d 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 5652d9d..9df9577 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 ac88dd0..4b4660b 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 1232b65..891de83 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 e1fb2bd..83e74c7 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 c4c79b1..e208c93 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 563cf19..775d431 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 9d24ed9..23586a7 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 f146085..8f31e51 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 6edc66b..ebc21ea 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 2edd6ed..73dd940 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 e172a6a..c8d1b79 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 6561bf8..12bc980 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 7f6985d..42e06e4 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 6cd4d24..c6ab9c6 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 d8aeef0..bc02e93 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 c7365ae..7ab98fd 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 c75f89b..a227a95 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 8eeb98d..72e230c 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 c5ba05f..2362b3c 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 0a118f3..a061e47 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 b134438..fbff2b2 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 dcad70c..018553d 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 2d56e7c..1037022 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', \ }, From 80a16668c9f282cbf3b558b07209996f8f77fae2 Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 3 Apr 2017 19:21:11 +0100 Subject: [PATCH 3/9] #446 Do not run ALE if inside of a command window --- autoload/ale.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/ale.vim b/autoload/ale.vim index 830a281..3c15f5d 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -11,6 +11,7 @@ function! ale#ShouldDoNothing() abort " Do nothing for blacklisted files " OR if ALE is running in the sandbox return index(g:ale_filetype_blacklist, &filetype) >= 0 + \ || (exists('*getcmdwintype') && !empty(getcmdwintype())) \ || ale#util#InSandbox() endfunction From b4667a0432a0675e1f20f60014e3738d8e7ca88f Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 3 Apr 2017 22:51:39 +0100 Subject: [PATCH 4/9] #447 Support zsh in the shell linter --- ale_linters/sh/shell.vim | 6 +-- test/handler/test_shell_handler.vader | 53 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 test/handler/test_shell_handler.vader diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim index 7ab98fd..412aa8b 100644 --- a/ale_linters/sh/shell.vim +++ b/ale_linters/sh/shell.vim @@ -38,7 +38,7 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort " " bash: line 13: syntax error near unexpected token `d' " sh: 11: Syntax error: "(" unexpected - let l:pattern = '^[^:]\+: \%(\w\+ \|\)\(\d\+\): \(.\+\)' + let l:pattern = '\v(line |: ?)(\d+): (.+)$' let l:output = [] for l:line in a:lines @@ -48,8 +48,8 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort continue endif - let l:line = l:match[1] + 0 - let l:text = l:match[2] + let l:line = l:match[2] + 0 + let l:text = l:match[3] let l:type = 'E' call add(l:output, { diff --git a/test/handler/test_shell_handler.vader b/test/handler/test_shell_handler.vader new file mode 100644 index 0000000..1250682 --- /dev/null +++ b/test/handler/test_shell_handler.vader @@ -0,0 +1,53 @@ +After: + call ale#linter#Reset() + +Execute(The shell handler should parse lines correctly): + runtime ale_linters/sh/shell.vim + + AssertEqual + \ [ + \ { + \ 'bufnr': 347, + \ 'lnum': 13, + \ 'text': 'syntax error near unexpected token d', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 7, + \ 'text': 'line 42: line 36:', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 11, + \ 'text': 'Syntax error: "(" unexpected', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 95, + \ 'text': 'parse error near `out=$(( $1 / 1024. )...', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 9, + \ 'text': '`done'' unexpected', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ 'bash: line 13: syntax error near unexpected token d', + \ 'bash: line 7: line 42: line 36:', + \ 'sh: 11: Syntax error: "(" unexpected', + \ 'qfm:95: parse error near `out=$(( $1 / 1024. )...', + \ 'qfm:22: :11: :33: :44:', + \ 'foo.sh: syntax error at line 9: `done'' unexpected', + \ ]) From e73baafd95dc2a98d8c9d84b31f07d325f321955 Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 3 Apr 2017 23:11:25 +0100 Subject: [PATCH 5/9] #447 Pass a temporary file to the shell linter instead --- ale_linters/sh/shell.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim index 412aa8b..8cb7a49 100644 --- a/ale_linters/sh/shell.vim +++ b/ale_linters/sh/shell.vim @@ -30,7 +30,7 @@ function! ale_linters#sh#shell#GetExecutable(buffer) abort endfunction function! ale_linters#sh#shell#GetCommand(buffer) abort - return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n' + return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n %t' endfunction function! ale_linters#sh#shell#Handle(buffer, lines) abort From 80ac8ec69f60f636e2d339f1f3c5c8e58774bee0 Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 3 Apr 2017 23:23:17 +0100 Subject: [PATCH 6/9] Fix tests in the 1.2.x branch --- test/test_history_saving.vader | 9 ++++++++- test/vimrc | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader index 303a02f..2f1044d 100644 --- a/test/test_history_saving.vader +++ b/test/test_history_saving.vader @@ -1,4 +1,8 @@ Before: + " Temporarily set the shell to /bin/sh, if it isn't already set that way. + " This will make it so the test works when running it directly. + let g:current_shell = &shell + let &shell = '/bin/sh' let g:history = [] let g:ale_buffer_info = {} let g:ale_max_buffer_history_size = 20 @@ -16,6 +20,9 @@ Before: \}) After: + " Reset the shell back to what it was before. + let &shell = g:current_shell + unlet g:current_shell let g:ale_history_enabled = 1 let g:ale_history_log_output = 0 unlet g:history @@ -37,7 +44,7 @@ Execute(History should be set when commands are run): AssertEqual 1, len(g:history) AssertEqual sort(['status', 'exit_code', 'job_id', 'command']), sort(keys(g:history[0])) - AssertEqual ['/bin/bash', '-c', 'echo command history test'], g:history[0].command + AssertEqual ['/bin/sh', '-c', 'echo command history test'], g:history[0].command AssertEqual 'finished', g:history[0].status AssertEqual 0, g:history[0].exit_code " The Job ID will change each time, but we can check the type. diff --git a/test/vimrc b/test/vimrc index ef67884..57af7e1 100644 --- a/test/vimrc +++ b/test/vimrc @@ -7,6 +7,8 @@ set runtimepath=/home/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/testplu " The following is just an example filetype plugin indent on syntax on +set shell=/bin/sh +set shellcmdflag=-c set nocompatible set tabstop=4 set softtabstop=4 From a55f94134985fe8fa052f0d0ff9329e77319eeac Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 10 Apr 2017 22:05:28 +0100 Subject: [PATCH 7/9] Merge pull request #460 from TheLonelyGhost/master Typo correcting 3.0.7 -> 0.3.7 for `vint --no-color` --- ale_linters/vim/vint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim index fb177b9..4b2c544 100644 --- a/ale_linters/vim/vint.vim +++ b/ale_linters/vim/vint.vim @@ -7,7 +7,7 @@ let g:ale_vim_vint_show_style_issues = let s:warning_flag = g:ale_vim_vint_show_style_issues ? '-s' : '-w' let s:vint_version = ale#semver#Parse(system('vint --version')) -let s:has_no_color_support = ale#semver#GreaterOrEqual(s:vint_version, [3, 0, 7]) +let s:has_no_color_support = ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7]) let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' From a1932b7ff5517225ed364f18c6e4d9c752a87672 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 12 Apr 2017 23:58:01 +0100 Subject: [PATCH 8/9] Merge pull request #467 from adriaanzon/php-fix-double-errors PHP: Fix double errors and support fatal errors --- ale_linters/php/php.vim | 4 ++-- test/handler/test_php_handler.vader | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ale_linters/php/php.vim b/ale_linters/php/php.vim index ebc21ea..3f354de 100644 --- a/ale_linters/php/php.vim +++ b/ale_linters/php/php.vim @@ -1,11 +1,11 @@ -" Author: Spencer Wood +" Author: Spencer Wood , Adriaan Zonnenberg " Description: This file adds support for checking PHP with php-cli function! ale_linters#php#php#Handle(buffer, lines) abort " Matches patterns like the following: " " PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 15 - let l:pattern = '\vParse error:\s+(.+unexpected ''(.+)%(expecting.+)@ Date: Wed, 19 Apr 2017 22:55:06 +0100 Subject: [PATCH 9/9] Remove error highlights when buffers are cleaned up --- autoload/ale/cleanup.vim | 1 + autoload/ale/highlight.vim | 19 +++++++++++++------ test/test_highlight_placement.vader | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/autoload/ale/cleanup.vim b/autoload/ale/cleanup.vim index 3b0b1d9..8b6494e 100644 --- a/autoload/ale/cleanup.vim +++ b/autoload/ale/cleanup.vim @@ -13,6 +13,7 @@ function! ale#cleanup#Buffer(buffer) abort " Clear delayed highlights for a buffer being removed. if g:ale_set_highlights call ale#highlight#UnqueueHighlights(a:buffer) + call ale#highlight#RemoveHighlights([]) endif call remove(g:ale_buffer_info, a:buffer) diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim index 8d70ead..8ff5120 100644 --- a/autoload/ale/highlight.vim +++ b/autoload/ale/highlight.vim @@ -46,18 +46,25 @@ function! s:GetCurrentMatchIDs(loclist) abort return l:current_id_map endfunction +" Given a loclist for current items to highlight, remove all highlights +" except these which have matching loclist item entries. +function! ale#highlight#RemoveHighlights(loclist) abort + let l:current_id_map = s:GetCurrentMatchIDs(a:loclist) + + for l:match in s:GetALEMatches() + if !has_key(l:current_id_map, l:match.id) + call matchdelete(l:match.id) + endif + endfor +endfunction + function! ale#highlight#UpdateHighlights() abort let l:buffer = bufnr('%') let l:has_new_items = has_key(s:buffer_highlights, l:buffer) let l:loclist = l:has_new_items ? remove(s:buffer_highlights, l:buffer) : [] - let l:current_id_map = s:GetCurrentMatchIDs(l:loclist) if l:has_new_items || !g:ale_enabled - for l:match in s:GetALEMatches() - if !has_key(l:current_id_map, l:match.id) - call matchdelete(l:match.id) - endif - endfor + call ale#highlight#RemoveHighlights(l:loclist) endif " Remove anything with a current match_id diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader index 52e861d..bca7bfd 100644 --- a/test/test_highlight_placement.vader +++ b/test/test_highlight_placement.vader @@ -74,3 +74,20 @@ Execute(Existing highlights should be kept): \ {'group': 'ALEWarning', 'id': 8, 'priority': 10, 'pos1': [4, 1, 1]}, \ ], \ getmatches() + +" This test is important for preventing ALE from showing highlights for +" the wrong files. +Execute(Highlights set by ALE should be removed when buffer cleanup is done): + call ale#engine#InitBufferInfo(bufnr('%')) + + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \]) + + AssertEqual + \ [{'group': 'ALEError', 'id': 9, 'priority': 10, 'pos1': [3, 2, 1]}], + \ getmatches() + + call ale#cleanup#Buffer(bufnr('%')) + + AssertEqual [], getmatches()