2017-09-03 18:29:12 -04:00
|
|
|
Before:
|
|
|
|
Save g:ale_r_lintr_options
|
|
|
|
|
|
|
|
unlet! g:ale_r_lintr_options
|
|
|
|
unlet! b:ale_r_lintr_options
|
|
|
|
|
|
|
|
runtime ale_linters/r/lintr.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_r_lintr_options
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The default lintr command should be correct):
|
|
|
|
AssertEqual
|
|
|
|
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
|
|
|
\ . 'Rscript -e '
|
2018-01-31 21:06:35 -05:00
|
|
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
2018-02-05 12:54:15 -05:00
|
|
|
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
2018-01-31 21:06:35 -05:00
|
|
|
\ . 'with_defaults())')
|
|
|
|
\ . ' %t',
|
2017-09-03 18:29:12 -04:00
|
|
|
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The lintr options should be configurable):
|
2018-01-31 21:06:35 -05:00
|
|
|
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
|
2017-09-03 18:29:12 -04:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
|
|
|
\ . 'Rscript -e '
|
2018-01-31 21:06:35 -05:00
|
|
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
2018-02-05 12:54:15 -05:00
|
|
|
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
2018-01-31 21:06:35 -05:00
|
|
|
\ . 'with_defaults(object_usage_linter = NULL))')
|
|
|
|
\ . ' %t',
|
2017-09-03 18:29:12 -04:00
|
|
|
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|
2018-02-04 13:57:52 -05:00
|
|
|
|
|
|
|
Execute(If the lint_package flag is set, lintr::lint_package should be called):
|
|
|
|
let b:ale_r_lintr_lint_package = 1
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
|
|
|
\ . 'Rscript -e '
|
|
|
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
2018-02-05 12:54:15 -05:00
|
|
|
\ . 'lint_package(cache = FALSE, '
|
|
|
|
\ . 'linters = with_defaults())')
|
2018-02-04 13:57:52 -05:00
|
|
|
\ . ' %t',
|
|
|
|
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|