All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>,
2 " Fenner Macrae <fmacrae.dev@gmail.com>,
3 " ourigen <https://github.com/ourigen>
4 " Description: This file adds support for checking R code with lintr.
6 let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()')
7 " A reasonable alternative default:
8 " get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)')
11 let g:ale_r_lintr_lint_package = get(g:, 'ale_r_lintr_lint_package', 0)
13 function! ale_linters#r#lintr#GetCommand(buffer) abort
14 if ale#Var(a:buffer, 'r_lintr_lint_package')
15 let l:lint_cmd = 'lint_package(cache = FALSE, linters = '
16 \ . ale#Var(a:buffer, 'r_lintr_options') . ')'
18 let l:lint_cmd = 'lint(cache = FALSE, commandArgs(TRUE), '
19 \ . ale#Var(a:buffer, 'r_lintr_options') . ')'
22 let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));'
25 return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) . ' %t'
28 call ale#linter#Define('r', {
30 \ 'executable': 'Rscript',
32 \ 'command': function('ale_linters#r#lintr#GetCommand'),
33 \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
34 \ 'output_stream': 'both',