mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-01 12:56:57 +08:00
Improve pyrex cython linter.
Like many other linters, use variables for the executable and options used by the linter. By default, the linter now report every warnings as errors with `--warning-errors`. Also add include directory and set working directory to file directory.
This commit is contained in:
committed by
Nicolas Pauss
parent
620951b6d3
commit
bedd30ee11
@@ -1,10 +1,27 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Author: w0rp <devw0rp@gmail.com>,
|
||||
" Nicolas Pauss <https://github.com/nicopauss>
|
||||
" Description: cython syntax checking for cython files.
|
||||
|
||||
call ale#Set('pyrex_cython_executable', 'cython')
|
||||
call ale#Set('pyrex_cython_options', '--warning-extra --warning-errors')
|
||||
|
||||
function! ale_linters#pyrex#cython#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'pyrex_cython_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#pyrex#cython#GetCommand(buffer) abort
|
||||
let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
|
||||
return ale#Escape(ale_linters#pyrex#cython#GetExecutable(a:buffer))
|
||||
\ . ' --working ' . l:local_dir . ' --include-dir ' . l:local_dir
|
||||
\ . ' ' . ale#Var(a:buffer, 'pyrex_cython_options')
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('pyrex', {
|
||||
\ 'name': 'cython',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cython',
|
||||
\ 'command': 'cython --warning-extra -o ' . g:ale#util#nul_file . ' %t',
|
||||
\ 'executable_callback': 'ale_linters#pyrex#cython#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#pyrex#cython#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
Reference in New Issue
Block a user