Added hack linter for php (#239)
* added hack linter * updated docs for hack (hh_client) * naming
This commit is contained in:
parent
ed43b17201
commit
5a0c3fd01e
@ -72,7 +72,7 @@ name. That seems to be the fairest way to arrange this table.
|
||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-ocaml-merlin` for configuration instructions
|
||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||
| PHP | [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) |
|
||||
| PHP | [hack](http://hacklang.org/), [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) |
|
||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||
| Python | [flake8](http://flake8.pycqa.org/en/latest/), [pylint](https://www.pylint.org/) |
|
||||
|
37
ale_linters/php/hack.vim
Normal file
37
ale_linters/php/hack.vim
Normal file
@ -0,0 +1,37 @@
|
||||
" Author: Zefei Xuan <https://github.com/zefei>
|
||||
" Description: Hack type checking (http://hacklang.org/)
|
||||
|
||||
function! ale_linters#php#hack#Handle(buffer, lines)
|
||||
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\),\(\d\+\): \(.\+])\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
if a:buffer != bufnr(l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
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',
|
||||
\})
|
@ -84,7 +84,7 @@ The following languages and tools are supported.
|
||||
* MATLAB: 'mlint'
|
||||
* OCaml: 'merlin' (see |ale-linter-integration-ocaml-merlin|)
|
||||
* Perl: 'perl' (-c flag), 'perlcritic'
|
||||
* PHP: 'php' (-l flag), 'phpcs'
|
||||
* PHP: 'hack', 'php' (-l flag), 'phpcs'
|
||||
* Pug: 'pug-lint'
|
||||
* Puppet: 'puppet', 'puppet-lint'
|
||||
* Python: 'flake8', 'pylint'
|
||||
|
Loading…
Reference in New Issue
Block a user