summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/elm/make.vim4
-rw-r--r--ale_linters/llvm/llc.vim35
-rw-r--r--ale_linters/php/phpstan.vim7
-rw-r--r--ale_linters/sh/shellcheck.vim2
4 files changed, 45 insertions, 3 deletions
diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim
index 4038e3b4..3783b5e3 100644
--- a/ale_linters/elm/make.vim
+++ b/ale_linters/elm/make.vim
@@ -71,11 +71,11 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
" The elm-make compiler, at the time of this writing, uses '/dev/null' as
" a sort of flag to tell the compiler not to generate an output file,
- " which is why this is hard coded here.
+ " which is why this is hard coded here. It does not use NUL on Windows.
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
let l:elm_cmd = ale#Escape(l:elm_exe)
\ . ' --report=json'
- \ . ' --output=' . ale#Escape(g:ale#util#nul_file)
+ \ . ' --output=/dev/null'
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
endfunction
diff --git a/ale_linters/llvm/llc.vim b/ale_linters/llvm/llc.vim
new file mode 100644
index 00000000..0a4903eb
--- /dev/null
+++ b/ale_linters/llvm/llc.vim
@@ -0,0 +1,35 @@
+" Author: rhysd <https://rhysd.github.io>
+" Description: Support for checking LLVM IR with llc
+
+call ale#Set('llvm_llc_executable', 'llc')
+
+function! ale_linters#llvm#llc#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'llvm_llc_executable')
+endfunction
+
+function! ale_linters#llvm#llc#GetCommand(buffer) abort
+ return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer))
+ \ . ' -filetype=null -o='
+ \ . ale#Escape(g:ale#util#nul_file)
+endfunction
+
+function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
+ " Handle '{path}: {file}:{line}:{col}: error: {message}' format
+ let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$'
+ let l:matches = ale#util#GetMatches(a:lines, l:pattern)
+
+ return map(l:matches, "{
+ \ 'lnum': str2nr(v:val[1]),
+ \ 'col': str2nr(v:val[2]),
+ \ 'text': v:val[3],
+ \ 'type': 'E',
+ \}")
+endfunction
+
+call ale#linter#Define('llvm', {
+\ 'name': 'llc',
+\ 'executable_callback': 'ale_linters#llvm#llc#GetExecutable',
+\ 'output_stream': 'stderr',
+\ 'command_callback': 'ale_linters#llvm#llc#GetCommand',
+\ 'callback': 'ale_linters#llvm#llc#HandleErrors',
+\})
diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim
index b99e4f58..24762086 100644
--- a/ale_linters/php/phpstan.vim
+++ b/ale_linters/php/phpstan.vim
@@ -4,6 +4,7 @@
" Set to change the ruleset
let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan')
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
+let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'php_phpstan_executable')
@@ -12,10 +13,16 @@ endfunction
function! ale_linters#php#phpstan#GetCommand(buffer) abort
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
+ let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
+ let l:configuration_option = !empty(l:configuration)
+ \ ? ' -c ' . l:configuration
+ \ : ''
+
return ale#Escape(l:executable)
\ . ' analyze -l'
\ . ale#Var(a:buffer, 'php_phpstan_level')
\ . ' --errorFormat raw'
+ \ . l:configuration_option
\ . ' %s'
endfunction
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index 004656b5..b47ba19f 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -2,7 +2,7 @@
" Description: This file adds support for using the shellcheck linter with
" shell scripts.
-" This global variable can be set with a string of comma-seperated error
+" This global variable can be set with a string of comma-separated error
" codes to exclude from shellcheck. For example:
"
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'