From aca66a54a5876eb9979e004742be6a8863c5cdf8 Mon Sep 17 00:00:00 2001 From: Payton Swick Date: Wed, 18 Oct 2017 19:07:29 -0400 Subject: Include sniff code in message --- ale_linters/php/phpcs.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim index ddaf171e..399fbd23 100644 --- a/ale_linters/php/phpcs.vim +++ b/ale_linters/php/phpcs.vim @@ -29,11 +29,12 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort " Matches against lines like the following: " " /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) - let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) \(\(.\+\)\)$' + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:text = l:match[4] + let l:code = l:match[5] + let l:text = l:match[4] . ' (' . l:code . ')' let l:type = l:match[3] call add(l:output, { -- cgit v1.2.3 From 40f5e541984f7520aab6f627620ed4823ab8943b Mon Sep 17 00:00:00 2001 From: Payton Swick Date: Thu, 26 Oct 2017 12:20:53 -0400 Subject: Add test for phpcs error code --- test/test_phpcs_include_code.vader | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/test_phpcs_include_code.vader diff --git a/test/test_phpcs_include_code.vader b/test/test_phpcs_include_code.vader new file mode 100644 index 00000000..1cff1916 --- /dev/null +++ b/test/test_phpcs_include_code.vader @@ -0,0 +1,7 @@ +Execute(errors should include code): + AssertEqual + \ [{'lnum': 18, 'col': 3, 'type': 'E', 'text': 'Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)'}], + \ ale_linters#php#phpcs#Handle(bufnr(''), [ + \ '/path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)', + \ ]) + -- cgit v1.2.3