Improve the thriftcheck handler pattern (#3893)

More recent versions of thriftcheck use a more compliant GCC-style
output format which includes a space before the "severity" group.
This matches similar tools, like shellcheck.

This change adjusts the handler's pattern to parse this format in a
backwards-compatible way (even though backwards compatibility isn't
critical long-term as thriftcheck itself is close to its 1.0 release).
This commit is contained in:
Jon Parise 2021-09-08 05:48:48 -07:00 committed by GitHub
parent 42aadf6a26
commit c5c58f5bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -13,9 +13,9 @@ endfunction
function! ale_linters#thrift#thriftcheck#Handle(buffer, lines) abort function! ale_linters#thrift#thriftcheck#Handle(buffer, lines) abort
" Matches lines like the following: " Matches lines like the following:
" "
" file.thrift:1:1:error: "py" namespace must match "^idl\\." (namespace.pattern) " file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern)
" file.thrift:3:5:warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit) " file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):(\l+): (.*) \((.*)\)$' let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ?([^:]+): (.+) \(([^\)]+)\)$'
let l:output = [] let l:output = []

View File

@ -23,6 +23,6 @@ Execute(The thriftcheck handler should handle basic warnings and errors):
\ }, \ },
\ ], \ ],
\ ale_linters#thrift#thriftcheck#Handle(1, [ \ ale_linters#thrift#thriftcheck#Handle(1, [
\ 'file.thrift:1:1:error: "py" namespace must match "^idl\\." (namespace.pattern)', \ 'file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern)',
\ 'file.thrift:3:5:warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)', \ 'file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)',
\ ]) \ ])