Fixed parsing of pydocstyle errors
ale#Escape function seems to prepend and append ' to the file name, which are not present in the pydocstyle output. Having the parsing regexp match the file name was overkill anyway, since there is an obvious 1:1 correspondence between the buffer number and the (potential) errors reported by pydocstyle.
This commit is contained in:
parent
a50e049e74
commit
86af4be0d0
2 changed files with 4 additions and 5 deletions
|
@ -33,8 +33,7 @@ function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
|
||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
" mydir/myfile.py:33 in public function `myfunction`:
|
" mydir/myfile.py:33 in public function `myfunction`:
|
||||||
" DXXX: Error description
|
" DXXX: Error description
|
||||||
let l:fname = ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
|
let l:line1_pattern = '\v^.*:\s*(\d+)\s+.*$'
|
||||||
let l:line1_pattern = '\v^' . l:fname . ':\s*(\d+)\s+.*$'
|
|
||||||
let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
|
let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ Execute(Basic pydocstyle warnings should be handled):
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#python#pydocstyle#Handle(bufnr(''), [
|
\ ale_linters#python#pydocstyle#Handle(bufnr(''), [
|
||||||
\ 'Checking file ' . fnamemodify(bufname(bufnr('')), ':p') . '.',
|
\ 'Checking file ' . fnamemodify(bufname(bufnr('')), ':p') . '.',
|
||||||
\ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':1 at module level:',
|
\ './mydir/myfile.py:1 at module level:',
|
||||||
\ ' D100: Missing docstring in public module',
|
\ ' D100: Missing docstring in public module',
|
||||||
\ '',
|
\ '',
|
||||||
\ ' All modules should normally have docstrings. [...] all functions and',
|
\ ' All modules should normally have docstrings. [...] all functions and',
|
||||||
|
@ -80,7 +80,7 @@ Execute(Basic pydocstyle warnings should be handled):
|
||||||
\ ' 1: # 2: 3: s 4: a 5: m 6: p 7: l ...',
|
\ ' 1: # 2: 3: s 4: a 5: m 6: p 7: l ...',
|
||||||
\ '',
|
\ '',
|
||||||
\ '',
|
\ '',
|
||||||
\ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:',
|
\ 'C:\mydir\myfile.py:4 in public function `main`:',
|
||||||
\ ' D205: 1 blank line required between summary line and description (found 0)',
|
\ ' D205: 1 blank line required between summary line and description (found 0)',
|
||||||
\ '',
|
\ '',
|
||||||
\ ' Multi-line docstrings consist of a summary line just like a one-line',
|
\ ' Multi-line docstrings consist of a summary line just like a one-line',
|
||||||
|
@ -92,7 +92,7 @@ Execute(Basic pydocstyle warnings should be handled):
|
||||||
\ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...',
|
\ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...',
|
||||||
\ '',
|
\ '',
|
||||||
\ '',
|
\ '',
|
||||||
\ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:',
|
\ 'myfile.py:4 in public function `main`:',
|
||||||
\ ' D400: First line should end with a period (not ''e'')',
|
\ ' D400: First line should end with a period (not ''e'')',
|
||||||
\ '',
|
\ '',
|
||||||
\ ' The [first line of a] docstring is a phrase ending in a period.',
|
\ ' The [first line of a] docstring is a phrase ending in a period.',
|
||||||
|
|
Reference in a new issue