#852 - Capture error codes for swaglint
This commit is contained in:
parent
d7a60ade77
commit
b16c82f2f1
2 changed files with 22 additions and 7 deletions
|
@ -27,6 +27,14 @@ function! ale_linters#yaml#swaglint#Handle(buffer, lines) abort
|
|||
\ 'text': l:match[4],
|
||||
\}
|
||||
|
||||
" Parse the code if it's there.
|
||||
let l:code_match = matchlist(l:obj.text, '\v^(.+) \(([^ (]+)\)$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:obj.text = l:code_match[1]
|
||||
let l:obj.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:obj)
|
||||
endfor
|
||||
|
||||
|
|
|
@ -10,43 +10,50 @@ Execute(The swaglint handler should parse lines correctly):
|
|||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'Missing required property: info (sway_object_missing_required_property)',
|
||||
\ 'text': 'Missing required property: info',
|
||||
\ 'code': 'sway_object_missing_required_property',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 6,
|
||||
\ 'col': 9,
|
||||
\ 'text': 'Not a valid response definition (sway_one_of_missing)',
|
||||
\ 'text': 'Not a valid response definition',
|
||||
\ 'code': 'sway_one_of_missing',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 7,
|
||||
\ 'col': 11,
|
||||
\ 'text': 'Missing required property: description (sway_object_missing_required_property)',
|
||||
\ 'text': 'Missing required property: description',
|
||||
\ 'code': 'sway_object_missing_required_property',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 7,
|
||||
\ 'col': 11,
|
||||
\ 'text': 'Missing required property: $ref (sway_object_missing_required_property)',
|
||||
\ 'text': 'Missing required property: $ref',
|
||||
\ 'code': 'sway_object_missing_required_property',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 10,
|
||||
\ 'text': 'Expected type string but found type integer (sway_invalid_type)',
|
||||
\ 'text': 'Expected type string but found type integer',
|
||||
\ 'code': 'sway_invalid_type',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 10,
|
||||
\ 'text': 'No enum match for: 2 (sway_enum_mismatch)',
|
||||
\ 'text': 'No enum match for: 2',
|
||||
\ 'code': 'sway_enum_mismatch',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 14,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'Definition is not used: #/definitions/Foo (sway_unused_definition)',
|
||||
\ 'text': 'Definition is not used: #/definitions/Foo',
|
||||
\ 'code': 'sway_unused_definition',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ ],
|
||||
|
|
Reference in a new issue