summaryrefslogtreecommitdiff
path: root/autoload/ale/engine.vim
diff options
context:
space:
mode:
authorcos <cos>2022-02-07 22:57:17 +0100
committercos <cos>2023-03-08 08:35:53 +0100
commit029cb550395bf73b549f9ba916746ef305bad493 (patch)
tree99cda2206cde7c40f17be8b62ebd9411bddd7bd5 /autoload/ale/engine.vim
parent16f5a1915b88ea50d809fc9d722f5b2b553f55b0 (diff)
downloadale-029cb550395bf73b549f9ba916746ef305bad493.zip
wip: Add error on lint execution failure
Reports errors on failure to execute linters if `ale_error_on_lint_fail` is set. Bug: It appears the end_lnum is ignored. The scope for an error like this one should likely be the entire file. Please comment at https://github.com/dense-analysis/ale/issues/4060 if having any thoughts at all about this suggested change.
Diffstat (limited to 'autoload/ale/engine.vim')
-rw-r--r--autoload/ale/engine.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 185d54db..2720e901 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -553,6 +553,18 @@ function! s:AddProblemsFromOtherBuffers(buffer, linters) abort
endif
endfunction
+function! s:AddLinterError(buffer, linter) abort
+ let l:output = []
+ call add(l:output, {
+ \ 'lnum': 1,
+ \ 'end_lnum': ale#util#GetLineCount(a:buffer),
+ \ 'text': 'Linter failure (' . a:linter . ')',
+ \ 'detail': 'Failed to execute ' . a:linter,
+ \ 'type': 'E'}
+ \ )
+ call ale#other_source#ShowResults(bufnr(''), 'ale-vim', l:output)
+endfunction
+
function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort
if ale#command#IsDeferred(a:executable)
let a:executable.result_callback = {
@@ -597,6 +609,10 @@ function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort
\}
return s:RunJob(l:command, l:options)
+ else
+ if ale#Var(a:buffer, 'error_on_lint_fail')
+ call s:AddLinterError(a:buffer, a:executable)
+ endif
endif
return 0