summaryrefslogtreecommitdiff
path: root/ale_linters/hack
diff options
context:
space:
mode:
authorFred Emmott <fe@fb.com>2018-08-02 11:44:17 -0700
committerFred Emmott <fe@fb.com>2018-08-02 11:44:17 -0700
commite6bd4373f9e5e875ee075c4bc416adfccbe2e89e (patch)
tree683847c31b3d1fa25a35c96a49288c07b360c44b /ale_linters/hack
parent5ff4e27e17bf44611a5993898df37b6a0e16f5e6 (diff)
downloadale-e6bd4373f9e5e875ee075c4bc416adfccbe2e89e.zip
coding style
Diffstat (limited to 'ale_linters/hack')
-rw-r--r--ale_linters/hack/hack.vim2
-rw-r--r--ale_linters/hack/hhast.vim7
2 files changed, 9 insertions, 0 deletions
diff --git a/ale_linters/hack/hack.vim b/ale_linters/hack/hack.vim
index 0253767a..03c384a7 100644
--- a/ale_linters/hack/hack.vim
+++ b/ale_linters/hack/hack.vim
@@ -5,6 +5,7 @@ call ale#Set('hack_hhclient_executable', 'hh_client')
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
+
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
endfunction
@@ -15,6 +16,7 @@ endfunction
function! ale_linters#hack#hack#GetCommand(buffer) abort
let l:executable = ale_linters#hack#hack#GetExecutable(a:buffer)
+
return ale#Escape(l:executable).' lsp --from vim-ale'
endfunction
diff --git a/ale_linters/hack/hhast.vim b/ale_linters/hack/hhast.vim
index 8ff5a962..61649b71 100644
--- a/ale_linters/hack/hhast.vim
+++ b/ale_linters/hack/hhast.vim
@@ -5,10 +5,13 @@ call ale#Set('hack_hhast_executable', 'vendor/bin/hhast-lint')
function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
let l:root = ale_linters#hack#hack#GetProjectRoot(a:buffer)
+
if empty(l:root)
return ''
endif
+
let l:hhast_config = findfile('hhast-lint.json', l:root)
+
return !empty(l:hhast_config) ? l:root : ''
endfunction
@@ -16,15 +19,19 @@ function! ale_linters#hack#hhast#GetExecutable(buffer) abort
let l:root = ale_linters#hack#hhast#GetProjectRoot(a:buffer)
let l:relative = ale#Var(a:buffer, 'hack_hhast_executable')
let l:absolute = findfile(l:relative, l:root)
+
return !empty(l:absolute) ? l:absolute : ''
endfunction
function! ale_linters#hack#hhast#GetCommand(buffer) abort
let l:executable = ale_linters#hack#hhast#GetExecutable(a:buffer)
+
return ale#Escape(l:executable).' --mode lsp --from vim-ale'
endfunction
+function !
+
call ale#linter#Define('hack', {
\ 'name': 'hhast',
\ 'lsp': 'stdio',