summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-03-29 00:56:39 +0100
committerw0rp <devw0rp@gmail.com>2017-03-29 00:56:39 +0100
commit2a88b60ff1ef5a4e9e73dc0d3be9f8ac51ec1309 (patch)
tree16f02c0765ba7ce341c5a591dd5e5f635181b32e /ale_linters
parent8e71f233da6c45c03c216b7fab2919d1c512c6dc (diff)
downloadale-2a88b60ff1ef5a4e9e73dc0d3be9f8ac51ec1309.zip
Fix #260 automatically set .csslintrc files from ancestor directories
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/css/csslint.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/ale_linters/css/csslint.vim b/ale_linters/css/csslint.vim
index 39176ce3..6b0956ee 100644
--- a/ale_linters/css/csslint.vim
+++ b/ale_linters/css/csslint.vim
@@ -1,9 +1,18 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: This file adds support for checking CSS code with csslint.
+function! ale_linters#css#csslint#GetCommand(buffer) abort
+ let l:csslintrc = ale#util#FindNearestFile(a:buffer, '.csslintrc')
+ let l:config_option = !empty(l:csslintrc)
+ \ ? '--config=' . fnameescape(l:csslintrc)
+ \ : ''
+
+ return 'csslint --format=compact ' . l:config_option . ' %t'
+endfunction
+
call ale#linter#Define('css', {
\ 'name': 'csslint',
\ 'executable': 'csslint',
-\ 'command': 'csslint --format=compact %t',
+\ 'command_callback': 'ale_linters#css#csslint#GetCommand',
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
\})