Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run sass-lint from the target's directory #1573

Merged
merged 1 commit into from May 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions ale_linters/sass/sasslint.vim
@@ -1,8 +1,18 @@
" Author: KabbAmine - https://github.com/KabbAmine
" Author: KabbAmine - https://github.com/KabbAmine, 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', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
\ 'command': 'sass-lint -v -q -f compact %t',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't work on Windows. Look at how other linters use BufferCdString. grep for it.

\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
14 changes: 12 additions & 2 deletions ale_linters/scss/sasslint.vim
@@ -1,8 +1,18 @@
" Author: KabbAmine - https://github.com/KabbAmine
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
" <ben@falconers.me.uk>

function! ale_linters#scss#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v'
\ . ' -q'
\ . ' -f compact'
\ . ' %t'
endfunction

call ale#linter#Define('scss', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
\ 'command': 'sass-lint -v -q -f compact %t',
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})
17 changes: 17 additions & 0 deletions test/command_callback/test_sasslint_command_callback.vader
@@ -0,0 +1,17 @@
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(''))