dense-analysis / dense-analysis/ale

API Blueprint linter isn't catching end range of lint annotations

Open
#1,749 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

## 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:

```shell
$ 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

1. Install drafter
2. Open the following file (as apib):

```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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.