2017-07-03 17:34:22 -04:00
|
|
|
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
|
|
|
|
" Description: This file adds support for checking R code with lintr.
|
|
|
|
|
2017-08-15 14:37:38 -04:00
|
|
|
let g:ale_r_lintr_options =
|
|
|
|
\ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults()')
|
|
|
|
" A reasonable alternative default:
|
|
|
|
" \ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults(object_usage_linter = NULL)')
|
|
|
|
|
2017-07-03 17:34:22 -04:00
|
|
|
function! ale_linters#r#lintr#GetCommand(buffer) abort
|
|
|
|
return ale#path#BufferCdString(a:buffer)
|
2017-08-15 14:37:38 -04:00
|
|
|
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE)[1], eval(parse(text = commandArgs(TRUE)[2])))') . ' %t' . ' ' . ale#Escape(ale#Var(a:buffer, 'r_lintr_options'))
|
2017-07-03 17:34:22 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('r', {
|
|
|
|
\ 'name': 'lintr',
|
|
|
|
\ 'executable': 'Rscript',
|
|
|
|
\ 'command_callback': 'ale_linters#r#lintr#GetCommand',
|
|
|
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
|
|
|
\ 'output_stream': 'both',
|
|
|
|
\})
|