2017-05-17 19:19:34 +00:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/php/php.vim
|
|
|
|
|
2017-11-15 17:21:17 +00:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-03-01 23:26:03 +00:00
|
|
|
Given (Some invalid lines of PHP):
|
|
|
|
[foo;]
|
|
|
|
class Foo { / }
|
|
|
|
$foo)
|
|
|
|
['foo' 'bar']
|
2017-04-12 21:59:12 +00:00
|
|
|
function count() {}
|
2017-03-01 23:26:03 +00:00
|
|
|
|
2017-05-17 19:19:34 +00:00
|
|
|
Execute(The php handler should calculate column numbers):
|
2017-02-15 22:59:18 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
2017-03-01 23:26:03 +00:00
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 5,
|
2017-05-17 19:28:29 +00:00
|
|
|
\ 'end_col': 5,
|
2017-02-15 22:59:18 +00:00
|
|
|
\ 'text': "syntax error, unexpected ';', expecting ']'",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-03-01 23:26:03 +00:00
|
|
|
\ 'lnum': 2,
|
|
|
|
\ 'col': 13,
|
2017-05-17 19:28:29 +00:00
|
|
|
\ 'end_col': 13,
|
2017-02-15 22:59:18 +00:00
|
|
|
\ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-03-01 23:26:03 +00:00
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 5,
|
2017-05-17 19:28:29 +00:00
|
|
|
\ 'end_col': 5,
|
2017-02-15 22:59:18 +00:00
|
|
|
\ 'text': "syntax error, unexpected ')'",
|
|
|
|
\ },
|
2017-02-17 23:51:33 +00:00
|
|
|
\ {
|
2017-03-01 23:26:03 +00:00
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 8,
|
2017-05-17 19:28:29 +00:00
|
|
|
\ 'end_col': 12,
|
2017-03-01 23:26:03 +00:00
|
|
|
\ 'text': "syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']'",
|
2017-02-17 23:51:33 +00:00
|
|
|
\ },
|
2017-05-17 19:19:34 +00:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
|
|
|
\ "This line should be ignored completely",
|
|
|
|
\ "Parse error: syntax error, unexpected ';', expecting ']' in - on line 1",
|
|
|
|
\ "Parse error: syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST) in - on line 2",
|
|
|
|
\ "Parse error: syntax error, unexpected ')' in - on line 3",
|
|
|
|
\ "Parse error: syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in - on line 4",
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute (The php handler should ignore lines starting with 'PHP Parse error'):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
|
|
|
\ "PHP Parse error: syntax error, This line should be ignored completely in - on line 1",
|
|
|
|
\ ])
|
|
|
|
|
2017-12-13 21:23:18 +00:00
|
|
|
Execute (The php handler should handle lines containing 'Standard input code'):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 47,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "Invalid numeric literal",
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
|
|
|
\ "Parse error: Invalid numeric literal in Standard input code on line 47",
|
|
|
|
\ ])
|
2017-05-17 19:19:34 +00:00
|
|
|
Execute (The php handler should parse lines without column indication):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
2017-02-17 23:51:33 +00:00
|
|
|
\ {
|
2017-04-12 21:59:12 +00:00
|
|
|
\ 'lnum': 5,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "Cannot redeclare count()",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-02-17 23:51:33 +00:00
|
|
|
\ 'lnum': 21,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "syntax error, unexpected end of file",
|
|
|
|
\ },
|
2017-03-01 23:26:03 +00:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 47,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "Invalid numeric literal",
|
|
|
|
\ },
|
2017-02-15 22:59:18 +00:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
2017-05-17 19:19:34 +00:00
|
|
|
\ "This line should be ignored completely",
|
2017-05-08 20:17:54 +00:00
|
|
|
\ "Fatal error: Cannot redeclare count() in - on line 5",
|
2017-05-17 19:19:34 +00:00
|
|
|
\ "Parse error: syntax error, unexpected end of file in - on line 21",
|
|
|
|
\ "Parse error: Invalid numeric literal in - on line 47",
|
2017-02-15 22:59:18 +00:00
|
|
|
\ ])
|