summaryrefslogtreecommitdiff
path: root/ale_linters/r/lintr.vim
blob: 94bdd297337b9faeaf6aad9c8bc205f3fe4468df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
" Description: This file adds support for checking R code with lintr.

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'
endfunction

call ale#linter#Define('r', {
\   'name': 'lintr',
\   'executable': 'Rscript',
\   'command_callback': 'ale_linters#r#lintr#GetCommand',
\   'callback': 'ale#handlers#gcc#HandleGCCFormat',
\   'output_stream': 'both',
\})