Allow lintr to consider .Renviron settings. Fix #3391 (#3727)

* Fix lintr.vim to consider Renviron

* Update test_lintr.vader to match lintr.vim fix

* Update credits

Co-authored-by: ourigen <ourigen [at] pm.me>
This commit is contained in:
ourigen
2021-05-25 00:30:42 +00:00
committed by GitHub
parent 93f80ea767
commit 6ef5bf308c
3 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>, " Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>,
" Fenner Macrae <fmacrae.dev@gmail.com> " Fenner Macrae <fmacrae.dev@gmail.com>,
" ourigen <https://github.com/ourigen>
" Description: This file adds support for checking R code with lintr. " Description: This file adds support for checking R code with lintr.
let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()') let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()')
@@ -21,7 +22,7 @@ function! ale_linters#r#lintr#GetCommand(buffer) abort
let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));'
\ . l:lint_cmd \ . l:lint_cmd
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) . ' %t' return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) . ' %t'
endfunction endfunction
call ale#linter#Define('r', { call ale#linter#Define('r', {

View File

@@ -1,5 +1,5 @@
" Author: Ricardo Liang <ricardoliang@gmail.com> " Author: Ricardo Liang <ricardoliang@gmail.com>
" Author: ourigen <ourigen [at] pm.me> " Author: ourigen <https://github.com/ourigen>
" Description: Texlab language server (Rust rewrite) " Description: Texlab language server (Rust rewrite)
call ale#Set('tex_texlab_executable', 'texlab') call ale#Set('tex_texlab_executable', 'texlab')

View File

@@ -7,7 +7,7 @@ After:
Execute(The default lintr command should be correct): Execute(The default lintr command should be correct):
AssertLinterCwd '%s:h' AssertLinterCwd '%s:h'
AssertLinter 'Rscript', AssertLinter 'Rscript',
\ 'Rscript --vanilla -e ' \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint(cache = FALSE, commandArgs(TRUE), ' \ . 'lint(cache = FALSE, commandArgs(TRUE), '
\ . 'with_defaults())') \ . 'with_defaults())')
@@ -17,7 +17,7 @@ Execute(The lintr options should be configurable):
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)' let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
AssertLinter 'Rscript', AssertLinter 'Rscript',
\ 'Rscript --vanilla -e ' \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint(cache = FALSE, commandArgs(TRUE), ' \ . 'lint(cache = FALSE, commandArgs(TRUE), '
\ . 'with_defaults(object_usage_linter = NULL))') \ . 'with_defaults(object_usage_linter = NULL))')
@@ -27,7 +27,7 @@ Execute(If the lint_package flag is set, lintr::lint_package should be called):
let b:ale_r_lintr_lint_package = 1 let b:ale_r_lintr_lint_package = 1
AssertLinter 'Rscript', AssertLinter 'Rscript',
\ 'Rscript --vanilla -e ' \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint_package(cache = FALSE, ' \ . 'lint_package(cache = FALSE, '
\ . 'linters = with_defaults())') \ . 'linters = with_defaults())')