mirror of
https://github.com/dense-analysis/ale
synced 2024-12-27 16:42:19 +00:00
f4c5d29c64
This linter works by invoking the `thrift` compiler with the buffer contents and reporting any parser and code generation issues. The handler rolls its own output-matching loop because we have the (unfortunate) requirement of handling error output that spans multiple lines. Unit tests cover both the command callback and handler, and there is initial documentation for all of the option variables.
64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
Before:
|
|
runtime ale_linters/thrift/thrift.vim
|
|
|
|
After:
|
|
call ale#linter#Reset()
|
|
|
|
Execute(The thrift handler should handle basic warnings and errors):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 17,
|
|
\ 'col': 0,
|
|
\ 'type': 'W',
|
|
\ 'text': 'The "byte" type is a compatibility alias for "i8". Use i8" to emphasize the signedness of this type.',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 20,
|
|
\ 'col': 0,
|
|
\ 'type': 'W',
|
|
\ 'text': 'Could not find include file include.thrift',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 83,
|
|
\ 'col': 0,
|
|
\ 'type': 'E',
|
|
\ 'text': 'Enum FOO is already defined!',
|
|
\ },
|
|
\ ],
|
|
\ ale_linters#thrift#thrift#Handle(1, [
|
|
\ '[WARNING:/path/filename.thrift:17] The "byte" type is a compatibility alias for "i8". Use i8" to emphasize the signedness of this type.',
|
|
\ '[WARNING:/path/filename.thrift:20] Could not find include file include.thrift',
|
|
\ '[FAILURE:/path/filename.thrift:83] Enum FOO is already defined!',
|
|
\ ])
|
|
|
|
Execute(The thrift handler should handle multiline errors):
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 75,
|
|
\ 'col': 0,
|
|
\ 'type': 'E',
|
|
\ 'text': 'This integer is too big: "11111111114213213453243"',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 76,
|
|
\ 'col': 0,
|
|
\ 'type': 'E',
|
|
\ 'text': 'Implicit field keys are deprecated and not allowed with -strict',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 77,
|
|
\ 'col': 0,
|
|
\ 'type': 'E',
|
|
\ 'text': "Unknown error (last token was ';')",
|
|
\ },
|
|
\ ],
|
|
\ ale_linters#thrift#thrift#Handle(1, [
|
|
\ "[ERROR:/path/filename.thrift:75] (last token was '11111111114213213453243')",
|
|
\ 'This integer is too big: "11111111114213213453243"',
|
|
\ "[ERROR:/path/filename.thrift:76] (last token was ';')",
|
|
\ 'Implicit field keys are deprecated and not allowed with -strict',
|
|
\ "[ERROR:/path/filename.thrift:77] (last token was ';')",
|
|
\ ])
|