Move the sasslint handlers to one location

This commit is contained in:
w0rp 2018-05-25 20:59:35 +01:00
parent 8d49da1f1c
commit 51a063be31
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
3 changed files with 12 additions and 18 deletions

View File

@ -1,18 +1,9 @@
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer " Author: KabbAmine - https://github.com/KabbAmine,
" <ben@falconers.me.uk> " Ben Falconer <ben@falconers.me.uk>
function! ale_linters#sass#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v'
\ . ' -q'
\ . ' -f compact'
\ . ' %t'
endfunction
call ale#linter#Define('sass', { call ale#linter#Define('sass', {
\ 'name': 'sasslint', \ 'name': 'sasslint',
\ 'executable': 'sass-lint', \ 'executable': 'sass-lint',
\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand', \ 'command_callback': 'ale#handlers#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\}) \})

View File

@ -0,0 +1,8 @@
" Author: KabbAmine - https://github.com/KabbAmine,
" Ben Falconer <ben@falconers.me.uk>
function! ale#handlers#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v -q -f compact %t'
endfunction

View File

@ -1,17 +1,12 @@
Before: Before:
runtime ale_linters/sass/sasslint.vim
call ale#test#SetDirectory('/testplugin/test/command_callback') call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('test.sass') call ale#test#SetFilename('test.sass')
After: After:
Restore
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The default sasslint command should be correct): Execute(The default sasslint command should be correct):
AssertEqual AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('sass-lint') . ' -v -q -f compact %t', \ . ale#Escape('sass-lint') . ' -v -q -f compact %t',
\ ale_linters#sass#sasslint#GetCommand(bufnr('')) \ ale#handlers#sasslint#GetCommand(bufnr(''))