summaryrefslogtreecommitdiff
path: root/ale_linters/yaml/yamllint.vim
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-02-15 21:45:19 +0000
committerGitHub <noreply@github.com>2017-02-15 21:45:19 +0000
commitc49819e89203f1212946e298b9f930acae207cd0 (patch)
tree3fe1a9b32f3c25205f3c458c59f00664704cee5c /ale_linters/yaml/yamllint.vim
parentcb60a2c06e560fbf1e295119cd5c1ce72291494e (diff)
parent7ef1d485fedd3ea44e48fb44b494ff2698247d5d (diff)
downloadale-c49819e89203f1212946e298b9f930acae207cd0.zip
Merge pull request #345 from AlexMasterov/feature/yaml-yamllint-options
Add yamllint option to pass in more options
Diffstat (limited to 'ale_linters/yaml/yamllint.vim')
-rw-r--r--ale_linters/yaml/yamllint.vim20
1 files changed, 18 insertions, 2 deletions
diff --git a/ale_linters/yaml/yamllint.vim b/ale_linters/yaml/yamllint.vim
index 0a1ca7d0..236c3492 100644
--- a/ale_linters/yaml/yamllint.vim
+++ b/ale_linters/yaml/yamllint.vim
@@ -1,5 +1,21 @@
" Author: KabbAmine <amine.kabb@gmail.com>
+let g:ale_yaml_yamllint_executable =
+\ get(g:, 'ale_yaml_yamllint_executable', 'yamllint')
+
+let g:ale_yaml_yamllint_options =
+\ get(g:, 'ale_yaml_yamllint_options', '')
+
+function! ale_linters#yaml#yamllint#GetExecutable(buffer) abort
+ return g:ale_yaml_yamllint_executable
+endfunction
+
+function! ale_linters#yaml#yamllint#GetCommand(buffer) abort
+ return ale_linters#yaml_yamllint#GetExecutable(a:buffer)
+ \ . ' ' . g:ale_yaml_yamllint_options
+ \ . ' -f parsable %t'
+endfunction
+
function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort
" Matches patterns line the following:
" something.yaml:1:1: [warning] missing document start "---" (document-start)
@@ -36,7 +52,7 @@ endfunction
call ale#linter#Define('yaml', {
\ 'name': 'yamllint',
-\ 'executable': 'yamllint',
-\ 'command': 'yamllint -f parsable %t',
+\ 'executable_callback': 'ale_linters#yaml#yamllint#GetExecutable',
+\ 'command_callback': 'ale_linters#yaml#yamllint#GetCommand',
\ 'callback': 'ale_linters#yaml#yamllint#Handle',
\})