diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim index 501db0b1..480e6058 100644 --- a/ale_linters/python/flake8.vim +++ b/ale_linters/python/flake8.vim @@ -94,7 +94,8 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, - \ 'text': l:code . ': ' . l:match[4], + \ 'text': l:match[4], + \ 'code': l:code, \ 'type': 'W', \} diff --git a/test/handler/test_flake8_handler.vader b/test/handler/test_flake8_handler.vader index 0d6d65fc..d8cb51b3 100644 --- a/test/handler/test_flake8_handler.vader +++ b/test/handler/test_flake8_handler.vader @@ -11,21 +11,24 @@ Execute(The flake8 handler should handle basic warnings and syntax errors): \ 'lnum': 6, \ 'col': 6, \ 'type': 'E', - \ 'text': 'E111: indentation is not a multiple of four', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', \ 'sub_type': 'style', \ }, \ { \ 'lnum': 7, \ 'col': 6, \ 'type': 'W', - \ 'text': 'W123: some warning', + \ 'text': 'some warning', + \ 'code': 'W123', \ 'sub_type': 'style', \ }, \ { \ 'lnum': 8, \ 'col': 3, \ 'type': 'E', - \ 'text': 'E999: SyntaxError: invalid syntax', + \ 'text': 'SyntaxError: invalid syntax', + \ 'code': 'E999', \ }, \ ], \ ale_linters#python#flake8#Handle(1, [ @@ -42,35 +45,40 @@ Execute(The flake8 handler should set end column indexes should be set for certa \ 'col': 1, \ 'type': 'E', \ 'end_col': 3, - \ 'text': 'F821: undefined name ''foo''', + \ 'text': 'undefined name ''foo''', + \ 'code': 'F821', \ }, \ { \ 'lnum': 28, \ 'col': 5, \ 'type': 'E', \ 'end_col': 9, - \ 'text': 'F405: hello may be undefined, or defined from star imports: x', + \ 'text': 'hello may be undefined, or defined from star imports: x', + \ 'code': 'F405', \ }, \ { \ 'lnum': 104, \ 'col': 5, \ 'type': 'E', \ 'end_col': 12, - \ 'text': 'F999: ''continue'' not properly in loop', + \ 'text': '''continue'' not properly in loop', + \ 'code': 'F999', \ }, \ { \ 'lnum': 106, \ 'col': 5, \ 'type': 'E', \ 'end_col': 9, - \ 'text': 'F999: ''break'' outside loop', + \ 'text': '''break'' outside loop', + \ 'code': 'F999', \ }, \ { \ 'lnum': 109, \ 'col': 5, \ 'type': 'E', \ 'end_col': 8, - \ 'text': 'F841: local variable ''test'' is assigned to but never used', + \ 'text': 'local variable ''test'' is assigned to but never used', + \ 'code': 'F841', \ }, \ ], \ ale_linters#python#flake8#Handle(1, [ @@ -125,7 +133,8 @@ Execute (The flake8 handler should handle names with spaces): \ 'lnum': 6, \ 'col': 6, \ 'type': 'E', - \ 'text': 'E111: indentation is not a multiple of four', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', \ 'sub_type': 'style', \ }, \ ],