summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-02-09 18:44:52 +0000
committerGitHub <noreply@github.com>2017-02-09 18:44:52 +0000
commit943fe9b4b0faa2d011694cea113b0ef44713a586 (patch)
tree3ce5818b08fa4c0ae0263e37cc67a9e679190335
parentf67cf170707646df7321bcd113cf256206242de7 (diff)
parent69ce8502a47348f0638a56fbcd87490a63b097de (diff)
downloadale-943fe9b4b0faa2d011694cea113b0ef44713a586.zip
Merge pull request #295 from metakirby5/pr/coffeelint-local
Add support for locally installed coffee and coffeelint
-rw-r--r--ale_linters/coffee/coffee.vim17
-rw-r--r--ale_linters/coffee/coffeelint.vim17
2 files changed, 30 insertions, 4 deletions
diff --git a/ale_linters/coffee/coffee.vim b/ale_linters/coffee/coffee.vim
index 243fec6b..ac9ef79e 100644
--- a/ale_linters/coffee/coffee.vim
+++ b/ale_linters/coffee/coffee.vim
@@ -1,10 +1,23 @@
" Author: KabbAmine - https://github.com/KabbAmine
" Description: Coffee for checking coffee files
+function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
+ return ale#util#ResolveLocalPath(
+ \ a:buffer,
+ \ 'node_modules/.bin/coffee',
+ \ 'coffee'
+ \)
+endfunction
+
+function! ale_linters#coffee#coffee#GetCommand(buffer) abort
+ return ale_linters#coffee#coffee#GetExecutable(a:buffer)
+ \ . ' -cp -s'
+endfunction
+
call ale#linter#Define('coffee', {
\ 'name': 'coffee',
-\ 'executable': 'coffee',
-\ 'command': 'coffee -cp -s',
+\ 'executable_callback': 'ale_linters#coffee#coffee#GetExecutable',
+\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand',
\ 'output_stream': 'stderr',
\ 'callback': 'ale#handlers#HandleGCCFormat',
\})
diff --git a/ale_linters/coffee/coffeelint.vim b/ale_linters/coffee/coffeelint.vim
index 96b8c59d..8b1c713e 100644
--- a/ale_linters/coffee/coffeelint.vim
+++ b/ale_linters/coffee/coffeelint.vim
@@ -1,6 +1,19 @@
" Author: Prashanth Chandra https://github.com/prashcr
" Description: coffeelint linter for coffeescript files
+function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
+ return ale#util#ResolveLocalPath(
+ \ a:buffer,
+ \ 'node_modules/.bin/coffeelint',
+ \ 'coffeelint'
+ \)
+endfunction
+
+function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
+ return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
+ \ . ' --stdin --reporter csv'
+endfunction
+
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
" Matches patterns like the following:
"
@@ -40,7 +53,7 @@ endfunction
call ale#linter#Define('coffee', {
\ 'name': 'coffeelint',
-\ 'executable': 'coffeelint',
-\ 'command': 'coffeelint --stdin --reporter csv',
+\ 'executable_callback': 'ale_linters#coffee#coffeelint#GetExecutable',
+\ 'command_callback': 'ale_linters#coffee#coffeelint#GetCommand',
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
\})