allow options to be set for `lintr`

This commit is contained in:
Alex Axthelm 2017-08-15 14:37:38 -04:00 committed by w0rp
parent 29ffd5134f
commit b60a7224ab
1 changed files with 6 additions and 1 deletions

View File

@ -1,9 +1,14 @@
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
" Description: This file adds support for checking R code with lintr.
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)')
function! ale_linters#r#lintr#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE), linters = lintr::with_defaults(object_usage_linter = NULL))') . ' %t'
\ . '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'))
endfunction
call ale#linter#Define('r', {