Add psalm linter for PHP (#1893)

This commit is contained in:
Richard Marmorstein
2018-09-27 11:48:47 -04:00
committed by w0rp
parent 58ceb21cbc
commit 947360f714
6 changed files with 77 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
Before:
call ale#assert#SetUpLinterTest('php', 'psalm')
After:
call ale#assert#TearDownLinterTest()
Execute(Custom executables should be used for the executable and command):
let g:ale_php_psalm_executable = 'psalm_test'
AssertLinter 'psalm_test',
\ ale#Escape('psalm_test') . ' --diff --output-format=emacs %s'

View File

@@ -0,0 +1,24 @@
Before:
runtime ale_linters/php/psalm.vim
After:
call ale#linter#Reset()
Execute(The php static analyzer handler should parse errors from psalm):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'type': 'W',
\ 'text': 'somewarning',
\ },
\ {
\ 'lnum': 11,
\ 'type': 'E',
\ 'text': 'someerror',
\ },
\ ],
\ ale_linters#php#psalm#Handle(347, [
\ "/file:1:3:warning - somewarning",
\ "/file:11:33:error - someerror",
\ ])