summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-09-04 16:51:18 +0100
committerw0rp <devw0rp@gmail.com>2018-09-04 16:51:18 +0100
commitd476578a402763f2c6e4e0ada2eb345d0ac938d7 (patch)
tree77f5a61c6eada15821391ecb4f78b87fa8e406db /ale_linters
parent8f2e1c393f74326979e1c74af8dc9b6ca8004778 (diff)
downloadale-d476578a402763f2c6e4e0ada2eb345d0ac938d7.zip
Improve ALE project style checking
* The project style linter now runs while you type. * Now the scripts for checking the project require blank lines. * Many style issues have been found and fixed.
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/apiblueprint/drafter.vim2
-rw-r--r--ale_linters/c/clangd.vim1
-rw-r--r--ale_linters/clojure/joker.vim2
-rw-r--r--ale_linters/cpp/clangd.vim1
-rw-r--r--ale_linters/cucumber/cucumber.vim1
-rw-r--r--ale_linters/cuda/nvcc.vim2
-rw-r--r--ale_linters/dafny/dafny.vim1
-rw-r--r--ale_linters/dockerfile/hadolint.vim2
-rw-r--r--ale_linters/elixir/mix.vim3
-rw-r--r--ale_linters/go/gobuild.vim1
-rw-r--r--ale_linters/go/govet.vim1
-rw-r--r--ale_linters/html/tidy.vim2
-rw-r--r--ale_linters/idris/idris.vim3
-rw-r--r--ale_linters/java/javac.vim2
-rw-r--r--ale_linters/java/javalsp.vim1
-rwxr-xr-xale_linters/javascript/flow.vim3
-rw-r--r--ale_linters/json/jsonlint.vim1
-rw-r--r--ale_linters/kotlin/kotlinc.vim7
-rw-r--r--ale_linters/make/checkmake.vim1
-rw-r--r--ale_linters/markdown/remark_lint.vim2
-rw-r--r--ale_linters/objc/clangd.vim1
-rw-r--r--ale_linters/objcpp/clangd.vim1
-rw-r--r--ale_linters/perl/perl.vim1
-rw-r--r--ale_linters/puppet/languageserver.vim2
-rw-r--r--ale_linters/puppet/puppet.vim1
-rw-r--r--ale_linters/rst/rstcheck.vim1
-rw-r--r--ale_linters/ruby/solargraph.vim1
-rw-r--r--ale_linters/rust/cargo.vim2
-rw-r--r--ale_linters/scala/sbtserver.vim4
-rw-r--r--ale_linters/scala/scalastyle.vim2
-rw-r--r--ale_linters/sml/smlnj_cm.vim1
-rw-r--r--ale_linters/solidity/solhint.vim1
-rw-r--r--ale_linters/tcl/nagelfar.vim1
-rw-r--r--ale_linters/terraform/tflint.vim1
-rw-r--r--ale_linters/tex/lacheck.vim1
-rw-r--r--ale_linters/thrift/thrift.vim3
-rw-r--r--ale_linters/vim/ale_custom_linting_rules.vim28
-rw-r--r--ale_linters/xml/xmllint.vim4
-rw-r--r--ale_linters/yang/yang_lsp.vim1
39 files changed, 68 insertions, 28 deletions
diff --git a/ale_linters/apiblueprint/drafter.vim b/ale_linters/apiblueprint/drafter.vim
index 198709f9..5d40c53a 100644
--- a/ale_linters/apiblueprint/drafter.vim
+++ b/ale_linters/apiblueprint/drafter.vim
@@ -16,10 +16,12 @@ function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
\ 'lnum': l:match[3] + 0,
\ 'col': l:match[4] + 0,
\}
+
if l:match[5] isnot# ''
let l:item.end_lnum = l:match[6] + 0
let l:item.end_col = l:match[7] + 0
endif
+
call add(l:output, l:item)
endfor
diff --git a/ale_linters/c/clangd.vim b/ale_linters/c/clangd.vim
index 2c7c5c13..6cad601a 100644
--- a/ale_linters/c/clangd.vim
+++ b/ale_linters/c/clangd.vim
@@ -6,6 +6,7 @@ call ale#Set('c_clangd_options', '')
function! ale_linters#c#clangd#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
diff --git a/ale_linters/clojure/joker.vim b/ale_linters/clojure/joker.vim
index 7a3330a8..2f61148b 100644
--- a/ale_linters/clojure/joker.vim
+++ b/ale_linters/clojure/joker.vim
@@ -9,9 +9,11 @@ function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:type = 'E'
+
if l:match[4] is? 'Parse warning'
let l:type = 'W'
endif
+
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
diff --git a/ale_linters/cpp/clangd.vim b/ale_linters/cpp/clangd.vim
index 1d716c33..9139f054 100644
--- a/ale_linters/cpp/clangd.vim
+++ b/ale_linters/cpp/clangd.vim
@@ -6,6 +6,7 @@ call ale#Set('cpp_clangd_options', '')
function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
diff --git a/ale_linters/cucumber/cucumber.vim b/ale_linters/cucumber/cucumber.vim
index 6708d32f..e8ae09ff 100644
--- a/ale_linters/cucumber/cucumber.vim
+++ b/ale_linters/cucumber/cucumber.vim
@@ -22,6 +22,7 @@ function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
endtry
let l:output = []
+
for l:element in get(l:json, 'elements', [])
for l:step in l:element['steps']
if l:step['result']['status'] is# 'undefined'
diff --git a/ale_linters/cuda/nvcc.vim b/ale_linters/cuda/nvcc.vim
index a3678910..f4442cb8 100644
--- a/ale_linters/cuda/nvcc.vim
+++ b/ale_linters/cuda/nvcc.vim
@@ -8,7 +8,6 @@ function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
" Unused: use ale#util#nul_file
" let l:output_file = ale#util#Tempname() . '.ii'
" call ale#engine#ManageFile(a:buffer, l:output_file)
-
return '%e -cuda'
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
@@ -23,7 +22,6 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
-
let l:item = {
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
diff --git a/ale_linters/dafny/dafny.vim b/ale_linters/dafny/dafny.vim
index 8bbf1b13..b5b90675 100644
--- a/ale_linters/dafny/dafny.vim
+++ b/ale_linters/dafny/dafny.vim
@@ -13,6 +13,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
\ })
endfor
+
return l:output
endfunction
diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim
index 7772afbd..dc0f5b9e 100644
--- a/ale_linters/dockerfile/hadolint.vim
+++ b/ale_linters/dockerfile/hadolint.vim
@@ -82,9 +82,11 @@ endfunction
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
+
if l:command is# 'docker'
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
endif
+
return 'hadolint -'
endfunction
diff --git a/ale_linters/elixir/mix.vim b/ale_linters/elixir/mix.vim
index 1a95e37f..4552ace5 100644
--- a/ale_linters/elixir/mix.vim
+++ b/ale_linters/elixir/mix.vim
@@ -10,7 +10,6 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
"
" TODO: Warning format
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
-
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
let l:output = []
@@ -32,9 +31,11 @@ endfunction
function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
+
if !empty(l:mix_file)
return fnamemodify(l:mix_file, ':p:h')
endif
+
return '.'
endfunction
diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim
index 2d6febdd..a44449f1 100644
--- a/ale_linters/go/gobuild.vim
+++ b/ale_linters/go/gobuild.vim
@@ -21,7 +21,6 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort
" 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:5:2: expected declaration, found 'STRING' "log"
-
" go test returns relative paths so use tail of filename as part of pattern matcher
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$'
diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim
index 59fea499..84c23236 100644
--- a/ale_linters/go/govet.vim
+++ b/ale_linters/go/govet.vim
@@ -8,6 +8,7 @@ call ale#Set('go_govet_options', '')
function! ale_linters#go#govet#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_govet_options')
+
return ale#path#BufferCdString(a:buffer) . ' go vet .'
\ . (!empty(l:options) ? ' ' . l:options : '')
endfunction
diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim
index cab8bc24..4ec29091 100644
--- a/ale_linters/html/tidy.vim
+++ b/ale_linters/html/tidy.vim
@@ -25,6 +25,7 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
" On macOS, old tidy (released on 31 Oct 2006) is installed. It does not
" consider HTML5 so we should avoid it.
let l:executable = ale#Var(a:buffer, 'html_tidy_executable')
+
if has('mac') && l:executable is# 'tidy' && exists('*exepath')
\ && exepath(l:executable) is# '/usr/bin/tidy'
return ''
@@ -40,7 +41,6 @@ endfunction
function! ale_linters#html#tidy#Handle(buffer, lines) abort
" Matches patterns lines like the following:
" line 7 column 5 - Warning: missing </title> before </head>
-
let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$'
let l:output = []
diff --git a/ale_linters/idris/idris.vim b/ale_linters/idris/idris.vim
index b3275b40..feac0f10 100644
--- a/ale_linters/idris/idris.vim
+++ b/ale_linters/idris/idris.vim
@@ -12,7 +12,7 @@ endfunction
function! ale_linters#idris#idris#Handle(buffer, lines) abort
" This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat
-
+ "
" Look for lines like the following:
" foo.idr:2:6:When checking right hand side of main with expected type
" bar.idr:11:11-13:
@@ -30,6 +30,7 @@ function! ale_linters#idris#idris#Handle(buffer, lines) abort
else
let l:corrected_lines[-1] .= l:line
endif
+
let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g')
endif
endfor
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index 76445c18..63dcdd94 100644
--- a/ale_linters/java/javac.vim
+++ b/ale_linters/java/javac.vim
@@ -16,6 +16,7 @@ function! ale_linters#java#javac#GetImportPaths(buffer) abort
endif
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
+
if !empty(l:classpath_command)
return l:classpath_command
endif
@@ -90,7 +91,6 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
"
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
" Main.java:16: error: ';' expected
-
let l:directory = expand('#' . a:buffer . ':p:h')
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$'
let l:col_pattern = '\v^(\s*\^)$'
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
index f335e83c..5d1a0c63 100644
--- a/ale_linters/java/javalsp.vim
+++ b/ale_linters/java/javalsp.vim
@@ -9,6 +9,7 @@ endfunction
function! ale_linters#java#javalsp#Command(buffer) abort
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
+
return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
endfunction
diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim
index d555184e..cdb289c7 100755
--- a/ale_linters/javascript/flow.vim
+++ b/ale_linters/javascript/flow.vim
@@ -91,7 +91,6 @@ function! s:GetDetails(error) abort
let l:detail = ''
for l:extra_error in a:error.extra
-
if has_key(l:extra_error, 'message')
for l:extra_message in l:extra_error.message
let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr)
@@ -105,7 +104,6 @@ function! s:GetDetails(error) abort
endfor
endfor
endif
-
endfor
return l:detail
@@ -161,7 +159,6 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
endif
call add(l:output, l:errorToAdd)
-
endfor
return l:output
diff --git a/ale_linters/json/jsonlint.vim b/ale_linters/json/jsonlint.vim
index 75f47088..f01553d6 100644
--- a/ale_linters/json/jsonlint.vim
+++ b/ale_linters/json/jsonlint.vim
@@ -3,7 +3,6 @@
function! ale_linters#json#jsonlint#Handle(buffer, lines) abort
" Matches patterns like the following:
" line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'.
-
let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$'
let l:output = []
diff --git a/ale_linters/kotlin/kotlinc.vim b/ale_linters/kotlin/kotlinc.vim
index 00f94be5..4a993986 100644
--- a/ale_linters/kotlin/kotlinc.vim
+++ b/ale_linters/kotlin/kotlinc.vim
@@ -17,12 +17,14 @@ function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
return ''
else
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
+
if !empty(l:pom_path) && executable('mvn')
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
\ . 'mvn dependency:build-classpath'
endif
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
+
if !empty(l:classpath_command)
return l:classpath_command
endif
@@ -78,12 +80,13 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
endif
let l:fname = ''
+
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# ''
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
else
" Find the src directory for files in this project.
-
let l:project_root = ale#gradle#FindProjectRoot(a:buffer)
+
if !empty(l:project_root)
let l:src_dir = l:project_root
else
@@ -93,6 +96,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
let l:fname .= expand(l:src_dir, 1) . ' '
endif
+
let l:fname .= ale#Escape(expand('#' . a:buffer . ':p'))
let l:command .= l:kotlinc_opts . ' ' . l:fname
@@ -124,6 +128,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
if l:buf_abspath isnot# l:curbuf_abspath
continue
endif
+
let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E'
call add(l:output, {
diff --git a/ale_linters/make/checkmake.vim b/ale_linters/make/checkmake.vim
index 63c35db3..5ebdf91e 100644
--- a/ale_linters/make/checkmake.vim
+++ b/ale_linters/make/checkmake.vim
@@ -13,6 +13,7 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort
\ 'text': l:match[3],
\})
endfor
+
return l:output
endfunction
diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim
index 88dfb9dd..4f8d48fa 100644
--- a/ale_linters/markdown/remark_lint.vim
+++ b/ale_linters/markdown/remark_lint.vim
@@ -24,10 +24,12 @@ function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
\ 'type': l:match[6] is# 'error' ? 'E' : 'W',
\ 'text': l:match[7],
\}
+
if l:match[3] isnot# ''
let l:item.end_lnum = l:match[4] + 0
let l:item.end_col = l:match[5] + 0
endif
+
call add(l:output, l:item)
endfor
diff --git a/ale_linters/objc/clangd.vim b/ale_linters/objc/clangd.vim
index 161d2cc7..f090e6ce 100644
--- a/ale_linters/objc/clangd.vim
+++ b/ale_linters/objc/clangd.vim
@@ -6,6 +6,7 @@ call ale#Set('objc_clangd_options', '')
function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
diff --git a/ale_linters/objcpp/clangd.vim b/ale_linters/objcpp/clangd.vim
index 7e06796f..a09753be 100644
--- a/ale_linters/objcpp/clangd.vim
+++ b/ale_linters/objcpp/clangd.vim
@@ -6,6 +6,7 @@ call ale#Set('objcpp_clangd_options', '')
function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index d1dcbc9c..03de77a5 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -19,6 +19,7 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
let l:basename = expand('#' . a:buffer . ':t')
let l:type = 'E'
+
if a:lines[-1] =~# 'syntax OK'
let l:type = 'W'
endif
diff --git a/ale_linters/puppet/languageserver.vim b/ale_linters/puppet/languageserver.vim
index a08b7653..a3060e65 100644
--- a/ale_linters/puppet/languageserver.vim
+++ b/ale_linters/puppet/languageserver.vim
@@ -8,6 +8,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
" there's no requirement to have it, so fall back to the other possible
" Puppet module directories
let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json')
+
if !empty(l:root_path)
return fnamemodify(l:root_path, ':h')
endif
@@ -17,6 +18,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
\ 'templates',
\]
let l:root_path = ale#path#FindNearestDirectory(a:buffer, l:test_path)
+
if !empty(l:root_path)
return fnamemodify(l:root_path, ':h:h')
endif
diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim
index d44bb517..0e37bdbd 100644
--- a/ale_linters/puppet/puppet.vim
+++ b/ale_linters/puppet/puppet.vim
@@ -8,7 +8,6 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
" Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5)
-
let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)'
let l:output = []
diff --git a/ale_linters/rst/rstcheck.vim b/ale_linters/rst/rstcheck.vim
index b660627f..8504738b 100644
--- a/ale_linters/rst/rstcheck.vim
+++ b/ale_linters/rst/rstcheck.vim
@@ -8,6 +8,7 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$'
let l:dir = expand('#' . a:buffer . ':p:h')
let l:output = []
+
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
diff --git a/ale_linters/ruby/solargraph.vim b/ale_linters/ruby/solargraph.vim
index a53bcaa3..2aad3af6 100644
--- a/ale_linters/ruby/solargraph.vim
+++ b/ale_linters/ruby/solargraph.vim
@@ -7,6 +7,7 @@ call ale#Set('ruby_solargraph_port', '7658')
function! ale_linters#ruby#solargraph#GetAddress(buffer) abort
let l:host = ale#Var(a:buffer, 'ruby_solargraph_host')
let l:port = ale#Var(a:buffer, 'ruby_solargraph_port')
+
return l:host . ':' . l:port
endfunction
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim
index e6c3870a..5aefe72c 100644
--- a/ale_linters/rust/cargo.vim
+++ b/ale_linters/rust/cargo.vim
@@ -42,6 +42,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
\ && ale#semver#GTE(l:version, [0, 22, 0])
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
+
if !empty(l:include_features)
let l:include_features = ' --features ' . ale#Escape(l:include_features)
endif
@@ -59,6 +60,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
endif
let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior')
+
if l:default_feature_behavior is# 'all'
let l:include_features = ''
let l:default_feature = ' --all-features'
diff --git a/ale_linters/scala/sbtserver.vim b/ale_linters/scala/sbtserver.vim
index d75c38ca..694241d7 100644
--- a/ale_linters/scala/sbtserver.vim
+++ b/ale_linters/scala/sbtserver.vim
@@ -6,15 +6,19 @@ call ale#Set('scala_sbtserver_project_root', '')
function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort
let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root')
+
if l:project_root is? ''
let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endif
+
return l:project_root
endfunction
function! ale_linters#scala#sbtserver#GetAddress(buffer) abort
let l:address = ale#Var(a:buffer, 'scala_sbtserver_address')
+
return l:address
endfunction
diff --git a/ale_linters/scala/scalastyle.vim b/ale_linters/scala/scalastyle.vim
index 3232d70b..42228cf6 100644
--- a/ale_linters/scala/scalastyle.vim
+++ b/ale_linters/scala/scalastyle.vim
@@ -53,12 +53,14 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
\ 'scalastyle_config.xml',
\ 'scalastyle-config.xml'
\]
+
for l:config in l:potential_configs
let l:scalastyle_config = ale#path#ResolveLocalPath(
\ a:buffer,
\ l:config,
\ ''
\)
+
if !empty(l:scalastyle_config)
break
endif
diff --git a/ale_linters/sml/smlnj_cm.vim b/ale_linters/sml/smlnj_cm.vim
index 7a482307..bfa4bc05 100644
--- a/ale_linters/sml/smlnj_cm.vim
+++ b/ale_linters/sml/smlnj_cm.vim
@@ -3,6 +3,7 @@
function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort
let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer)
+
return 'sml -m ' . l:cmfile . ' < /dev/null'
endfunction
diff --git a/ale_linters/solidity/solhint.vim b/ale_linters/solidity/solhint.vim
index 519fd49d..8ea33e07 100644
--- a/ale_linters/solidity/solhint.vim
+++ b/ale_linters/solidity/solhint.vim
@@ -4,7 +4,6 @@
function! ale_linters#solidity#solhint#Handle(buffer, lines) abort
" Matches patterns like the following:
" /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars)
-
let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$'
let l:output = []
diff --git a/ale_linters/tcl/nagelfar.vim b/ale_linters/tcl/nagelfar.vim
index 183ea9e7..05fe581b 100644
--- a/ale_linters/tcl/nagelfar.vim
+++ b/ale_linters/tcl/nagelfar.vim
@@ -15,7 +15,6 @@ function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort
" Line 5: W Found constant "bepa" which is also a variable.
" Line 13: E Wrong number of arguments (3) to "set"
" Line 93: N Close brace not aligned with line 90 (4 0)
-
let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$'
let l:output = []
diff --git a/ale_linters/terraform/tflint.vim b/ale_linters/terraform/tflint.vim
index b8e9c96d..0d77835a 100644
--- a/ale_linters/terraform/tflint.vim
+++ b/ale_linters/terraform/tflint.vim
@@ -40,6 +40,7 @@ function! ale_linters#terraform#tflint#GetCommand(buffer) abort
endif
let l:opts = ale#Var(a:buffer, 'terraform_tflint_options')
+
if !empty(l:opts)
let l:cmd .= ' ' . l:opts
endif
diff --git a/ale_linters/tex/lacheck.vim b/ale_linters/tex/lacheck.vim
index 38135b85..5e5a94f1 100644
--- a/ale_linters/tex/lacheck.vim
+++ b/ale_linters/tex/lacheck.vim
@@ -8,7 +8,6 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
"
" "book.tex", line 37: possible unwanted space at "{"
" "book.tex", line 38: missing `\ ' after "etc."
-
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
let l:output = []
diff --git a/ale_linters/thrift/thrift.vim b/ale_linters/thrift/thrift.vim
index ac1f69fc..396a2355 100644
--- a/ale_linters/thrift/thrift.vim
+++ b/ale_linters/thrift/thrift.vim
@@ -42,12 +42,14 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort
let l:line = a:lines[l:index]
let l:match = matchlist(l:line, l:pattern)
+
if empty(l:match)
let l:index += 1
continue
endif
let l:severity = l:match[1]
+
if l:severity is# 'WARNING'
let l:type = 'W'
else
@@ -57,6 +59,7 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort
" If our text looks like "(last token was ';')", the *next* line
" should contain a more descriptive error message.
let l:text = l:match[4]
+
if l:text =~# '\(last token was .*\)'
let l:index += 1
let l:text = get(a:lines, l:index, 'Unknown error ' . l:text)
diff --git a/ale_linters/vim/ale_custom_linting_rules.vim b/ale_linters/vim/ale_custom_linting_rules.vim
index f4e111ee..3da44206 100644
--- a/ale_linters/vim/ale_custom_linting_rules.vim
+++ b/ale_linters/vim/ale_custom_linting_rules.vim
@@ -25,7 +25,13 @@ endfunction
function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort
let l:dir = s:GetALEProjectDir(a:buffer)
- return ale#path#CdString(l:dir) . '%e .'
+ let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
+ let l:temp_file = l:temp_dir . '/example.vim'
+
+ let l:lines = getbufline(a:buffer, 1, '$')
+ call ale#util#Writefile(a:buffer, l:lines, l:temp_file)
+
+ return ale#path#CdString(l:dir) . '%e ' . ale#Escape(l:temp_dir)
endfunction
function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort
@@ -34,15 +40,17 @@ function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+) (.+)$'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- let l:filename = ale#path#GetAbsPath(l:dir, l:match[1])
-
- if bufnr(l:filename) is a:buffer
- call add(l:output, {
- \ 'lnum': l:match[2],
- \ 'text': l:match[3],
- \ 'type': 'W',
- \})
+ " Ignore trailing whitespace errors if we've turned them off.
+ if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
+ \&& l:match[3] is# 'Trailing whitespace'
+ continue
endif
+
+ call add(l:output, {
+ \ 'lnum': l:match[2],
+ \ 'text': l:match[3],
+ \ 'type': 'W',
+ \})
endfor
return l:output
@@ -53,5 +61,5 @@ call ale#linter#Define('vim', {
\ 'executable_callback': 'ale_linters#vim#ale_custom_linting_rules#GetExecutable',
\ 'command_callback': 'ale_linters#vim#ale_custom_linting_rules#GetCommand',
\ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle',
-\ 'lint_file': 1,
+\ 'read_buffer': 0,
\})
diff --git a/ale_linters/xml/xmllint.vim b/ale_linters/xml/xmllint.vim
index a0f97c3a..59f43d16 100644
--- a/ale_linters/xml/xmllint.vim
+++ b/ale_linters/xml/xmllint.vim
@@ -25,9 +25,9 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
-
" Parse error/warning lines
let l:match_message = matchlist(l:line, l:pattern_message)
+
if !empty(l:match_message)
let l:line = l:match_message[2] + 0
let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E'
@@ -44,13 +44,13 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort
" Parse column position
let l:match_column_token = matchlist(l:line, l:pattern_column_token)
+
if !empty(l:output) && !empty(l:match_column_token)
let l:previous = l:output[len(l:output) - 1]
let l:previous['col'] = len(l:match_column_token[0])
continue
endif
-
endfor
return l:output
diff --git a/ale_linters/yang/yang_lsp.vim b/ale_linters/yang/yang_lsp.vim
index a60e9113..45776f98 100644
--- a/ale_linters/yang/yang_lsp.vim
+++ b/ale_linters/yang/yang_lsp.vim
@@ -2,6 +2,7 @@ call ale#Set('yang_lsp_executable', 'yang-language-server')
function! ale_linters#yang#yang_lsp#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'yang.settings')
+
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction