summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-17 00:17:59 +0100
committerw0rp <devw0rp@gmail.com>2017-07-17 00:17:59 +0100
commit23ea62d40a0661755672a8ab0707507c58019bf0 (patch)
tree282483c682d40aaa750e2eb3fb7ba7d8decb2f88 /ale_linters/cpp
parent3352a6c9df427204bcbffba78fdf65906d3966d0 (diff)
downloadale-23ea62d40a0661755672a8ab0707507c58019bf0.zip
#711 - Make the cpplint executable configurable
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/cpplint.vim17
1 files changed, 12 insertions, 5 deletions
diff --git a/ale_linters/cpp/cpplint.vim b/ale_linters/cpp/cpplint.vim
index 205c7468..346ac815 100644
--- a/ale_linters/cpp/cpplint.vim
+++ b/ale_linters/cpp/cpplint.vim
@@ -1,18 +1,25 @@
" Author: Dawid Kurek https://github.com/dawikur
" Description: cpplint for cpp files
-if !exists('g:ale_cpp_cpplint_options')
- let g:ale_cpp_cpplint_options = ''
-endif
+call ale#Set('cpp_cpplint_executable', 'cpplint')
+call ale#Set('cpp_cpplint_options', '')
+
+function! ale_linters#cpp#cpplint#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'cpp_cpplint_executable')
+endfunction
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
- return 'cpplint ' . ale#Var(a:buffer, 'cpp_cpplint_options') . ' %s'
+ let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
+
+ return ale#Escape(ale_linters#cpp#cpplint#GetExecutable(a:buffer))
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %s'
endfunction
call ale#linter#Define('cpp', {
\ 'name': 'cpplint',
\ 'output_stream': 'stderr',
-\ 'executable': 'cpplint',
+\ 'executable_callback': 'ale_linters#cpp#cpplint#GetExecutable',
\ 'command_callback': 'ale_linters#cpp#cpplint#GetCommand',
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
\ 'lint_file': 1,