ale
ale copied to clipboard
API Blueprint linter isn't catching end range of lint annotations
Information
Vim: VIM - Vi IMproved 8.1 (2018 May 17, compiled Jun 30 2018 05:20:13)
drafter v3.2.7 (current stable)
Ale: 04fbea6e
Current Filetype: apiblueprint
Available Linters: ['drafter']
What went wrong
The regex for detecting the end range of an annotation seems to not work in all cases. Using drafter with the included API Blueprint in steps to reproduce the output is:
$ drafter test.apib -ul
OK.
warning: (6) no identifier specified; line 8, column 11 - line 8, column 18
The warning starts on line 8, column 11 and ends on line 8 column 18. The regex in ale_linters/apiblueprint/drafter.vim has conditional support for the "end range" of the annotation however the statement if l:match[5] isnot# '' is false and thus isn't used. I've printed the contents of l:match and it is as follows:
[
'warning: (6) no identifier specified; line 8, column 11 - line 8, column 18',
'warning',
'no identifier specified',
'8',
'11',
'',
'',
'',
'',
''
]
Reproducing the bug
- Install drafter
- Open the following file (as apib):
# API Name
## GET /
+ Response 200 (application/json)
+ Attributes
+ message: Hello World
+ (array)
Expected result is that the contents of (array) is matched as the source of annotation. However only the ( character at the start is matched.