2017-01-04 17:07:21 +00:00
|
|
|
" Author: Zefei Xuan <https://github.com/zefei>
|
|
|
|
" Description: Hack type checking (http://hacklang.org/)
|
|
|
|
|
2017-01-22 14:54:57 +00:00
|
|
|
function! ale_linters#php#hack#Handle(buffer, lines) abort
|
2017-01-04 17:07:21 +00:00
|
|
|
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\),\(\d\+\): \(.\+])\)$'
|
|
|
|
let l:output = []
|
|
|
|
|
2017-04-17 23:35:53 +00:00
|
|
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
2017-01-04 17:07:21 +00:00
|
|
|
if a:buffer != bufnr(l:match[1])
|
2017-04-17 23:35:53 +00:00
|
|
|
continue
|
2017-01-04 17:07:21 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
call add(l:output, {
|
|
|
|
\ 'lnum': l:match[2] + 0,
|
|
|
|
\ 'col': l:match[3] + 0,
|
|
|
|
\ 'text': l:match[5],
|
|
|
|
\})
|
|
|
|
endfor
|
|
|
|
|
|
|
|
return l:output
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('php', {
|
|
|
|
\ 'name': 'hack',
|
|
|
|
\ 'executable': 'hh_client',
|
|
|
|
\ 'command': 'hh_client --retries 0 --retry-if-init false',
|
|
|
|
\ 'callback': 'ale_linters#php#hack#Handle',
|
|
|
|
\})
|