Support markdownlint rules with multiple slashes

This commit is contained in:
Sebastian Blask 2020-07-31 11:14:57 +12:00
parent 275b5248e5
commit fbfeae0587
2 changed files with 15 additions and 1 deletions

View file

@ -2,7 +2,7 @@
" Description: Adds support for markdownlint " Description: Adds support for markdownlint
function! ale#handlers#markdownlint#Handle(buffer, lines) abort function! ale#handlers#markdownlint#Handle(buffer, lines) abort
let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-]\+\) \(.*\)$' let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$'
let l:output=[] let l:output=[]
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)

View file

@ -75,3 +75,17 @@ Execute(The Markdownlint handler should parse post v0.22.0 output with column co
\ ale#handlers#markdownlint#Handle(0, [ \ ale#handlers#markdownlint#Handle(0, [
\ 'README.md:10:20 MD013/line-length Line length [Expected: 80; Actual: 114]' \ 'README.md:10:20 MD013/line-length Line length [Expected: 80; Actual: 114]'
\ ]) \ ])
Execute(The Markdownlint handler should parse output with multiple slashes in rule name correctly):
AssertEqual
\ [
\ {
\ 'lnum': 10,
\ 'code': 'MD022/blanks-around-headings/blanks-around-headers',
\ 'text': 'Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "### something"]',
\ 'type': 'W'
\ }
\ ],
\ ale#handlers#markdownlint#Handle(0, [
\ 'README.md:10 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "### something"]'
\ ])