summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-02-04 11:38:05 +0000
committerGitHub <noreply@github.com>2018-02-04 11:38:05 +0000
commit31e0f48d62fdc5e9b3c4a0da1fc51ed94d9b335b (patch)
treef4e0696df1c4bd02bdb9cdd61ff071d939720572 /ale_linters
parent7c4decf804388a670cdbcec076472627cfb585ce (diff)
parentb13f290390ba62180f731fef6cea58d6fef8bc3e (diff)
downloadale-31e0f48d62fdc5e9b3c4a0da1fc51ed94d9b335b.zip
Merge pull request #1326 from michaelquinn32/patch-1
Call lintr library before linting
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/r/lintr.vim12
1 files changed, 8 insertions, 4 deletions
diff --git a/ale_linters/r/lintr.vim b/ale_linters/r/lintr.vim
index 86b591c2..e1639051 100644
--- a/ale_linters/r/lintr.vim
+++ b/ale_linters/r/lintr.vim
@@ -1,14 +1,18 @@
" 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()')
+let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()')
" A reasonable alternative default:
-" \ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults(object_usage_linter = NULL)')
+" get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)')
function! ale_linters#r#lintr#GetCommand(buffer) abort
+ let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));'
+ \ . 'lint(cache = FALSE, commandArgs(TRUE),'
+ \ . ale#Var(a:buffer, 'r_lintr_options') . ')'
+
return ale#path#BufferCdString(a:buffer)
- \ . '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'))
+ \ . 'Rscript -e '
+ \ . ale#Escape(l:cmd_string) . ' %t'
endfunction
call ale#linter#Define('r', {