From 51a063be31e70046aaca767a02d25b0c5be9a692 Mon Sep 17 00:00:00 2001 From: w0rp Date: Fri, 25 May 2018 20:59:35 +0100 Subject: [PATCH] Move the sasslint handlers to one location --- ale_linters/sass/sasslint.vim | 15 +++------------ autoload/ale/handlers/sasslint.vim | 8 ++++++++ .../test_sasslint_command_callback.vader | 7 +------ 3 files changed, 12 insertions(+), 18 deletions(-) create mode 100644 autoload/ale/handlers/sasslint.vim diff --git a/ale_linters/sass/sasslint.vim b/ale_linters/sass/sasslint.vim index aaaa3d2d..4df56dfd 100644 --- a/ale_linters/sass/sasslint.vim +++ b/ale_linters/sass/sasslint.vim @@ -1,18 +1,9 @@ -" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer -" - -function! ale_linters#sass#sasslint#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape('sass-lint') - \ . ' -v' - \ . ' -q' - \ . ' -f compact' - \ . ' %t' -endfunction +" Author: KabbAmine - https://github.com/KabbAmine, +" Ben Falconer call ale#linter#Define('sass', { \ 'name': 'sasslint', \ 'executable': 'sass-lint', -\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand', +\ 'command_callback': 'ale#handlers#sasslint#GetCommand', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) diff --git a/autoload/ale/handlers/sasslint.vim b/autoload/ale/handlers/sasslint.vim new file mode 100644 index 00000000..399bf47c --- /dev/null +++ b/autoload/ale/handlers/sasslint.vim @@ -0,0 +1,8 @@ +" Author: KabbAmine - https://github.com/KabbAmine, +" Ben Falconer + +function! ale#handlers#sasslint#GetCommand(buffer) abort + return ale#path#BufferCdString(a:buffer) + \ . ale#Escape('sass-lint') + \ . ' -v -q -f compact %t' +endfunction diff --git a/test/command_callback/test_sasslint_command_callback.vader b/test/command_callback/test_sasslint_command_callback.vader index 81ce893b..1db7e5fb 100644 --- a/test/command_callback/test_sasslint_command_callback.vader +++ b/test/command_callback/test_sasslint_command_callback.vader @@ -1,17 +1,12 @@ Before: - runtime ale_linters/sass/sasslint.vim - call ale#test#SetDirectory('/testplugin/test/command_callback') call ale#test#SetFilename('test.sass') After: - Restore - call ale#test#RestoreDirectory() - call ale#linter#Reset() Execute(The default sasslint command should be correct): AssertEqual \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . ale#Escape('sass-lint') . ' -v -q -f compact %t', - \ ale_linters#sass#sasslint#GetCommand(bufnr('')) + \ ale#handlers#sasslint#GetCommand(bufnr(''))