Checker markdown/remark_lint: cleanup.
This commit is contained in:
parent
8e7a30b028
commit
c779dbb607
@ -388,6 +388,49 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#remark_lint(errors) abort " {{{2
|
||||
let out = []
|
||||
let fname = expand('%', 1)
|
||||
|
||||
for err in a:errors
|
||||
if err =~# '\m^\f\+$'
|
||||
let fname = err
|
||||
|
||||
elseif err =~# '\v^\s+\d+:\d+\s+%(warning|error)\s.*remark-lint$'
|
||||
let parts = matchlist(err, '\v^\s+(\d+):(\d+)\s+([ew])\S+\s+(.{-})\s+(\S+)\s+remark-lint$')
|
||||
if len(parts) >6
|
||||
let line = str2nr(parts[1])
|
||||
let col = str2nr(parts[2])
|
||||
let type = parts[3]
|
||||
let message = parts[4] . ' [' . parts[5] . ']'
|
||||
call add(out, join([fname, type, line, col, message], ':'))
|
||||
else
|
||||
call syntastic#log#warn('checker markdown/remark_lint: unrecognized error item ' . string(err))
|
||||
endif
|
||||
|
||||
elseif err =~# '\v^\s+\d+:\d+-\d+:\d+\s+%(warning|error)\s.*remark-lint$'
|
||||
let parts = matchlist(err, '\v^\s+(\d+):(\d+)-(\d+):(\d+)\s+([ew])\S+\s+(.{-})\s+(\S+)\s+remark-lint$')
|
||||
if len(parts) >8
|
||||
let line1 = str2nr(parts[1])
|
||||
let col1 = str2nr(parts[2])
|
||||
let line2 = str2nr(parts[3])
|
||||
let col2 = str2nr(parts[4]) - 1
|
||||
let type = parts[5]
|
||||
let message = parts[6] . ' [' . parts[7] . ']'
|
||||
if line1 == line2
|
||||
call add(out, join([fname, type, line1, col1, col2, message], ':'))
|
||||
else
|
||||
call add(out, join([fname, type, line1, col1, message], ':'))
|
||||
endif
|
||||
else
|
||||
call syntastic#log#warn('checker markdown/remark_lint: unrecognized error item ' . string(err))
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#scss_lint(errors) abort " {{{2
|
||||
let errs = join(a:errors, '')
|
||||
if errs ==# ''
|
||||
|
@ -4090,7 +4090,8 @@ The following checkers are available for Markdown (filetype "markdown"):
|
||||
|
||||
1. Markdown lint tool.......|syntastic-markdown-mdl|
|
||||
2. proselint................|syntastic-markdown-proselint|
|
||||
3. textlint.................|syntastic-markdown-textlint|
|
||||
3. remark-lint..............|syntastic-markdown-remark_lint|
|
||||
4. textlint.................|syntastic-markdown-textlint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. Markdown lint tool *syntastic-markdown-mdl*
|
||||
@ -4148,7 +4149,29 @@ See also: |syntastic-asciidoc-proselint|, |syntastic-help-proselint|,
|
||||
|syntastic-text-proselint|, |syntastic-xhtml-proselint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3. textlint *syntastic-markdown-textlint*
|
||||
3. remark-lint *syntastic-markdown-remark_lint*
|
||||
|
||||
Name: remark_lint
|
||||
Maintainer: Tim Carry <tim@pixelastic.com>
|
||||
|
||||
"remark-lint" is a code style linter for Markdown files. See the project's
|
||||
page at GitHub for details:
|
||||
|
||||
https://github.com/remarkjs/remark-lint
|
||||
|
||||
Note~
|
||||
|
||||
Syntastic can't check whether "remark-lint" is installed properly beyond the
|
||||
existence of an executable named "remark". Please make sure "remark-lint" is
|
||||
installed and working properly before attempting to use it with syntastic.
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4. textlint *syntastic-markdown-textlint*
|
||||
|
||||
Name: textlint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.9.0-9'
|
||||
let g:_SYNTASTIC_VERSION = '3.9.0-14'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -20,18 +20,27 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_markdown_remark_lint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\'args_before': '--quiet --no-stdout --no-color' })
|
||||
let makeprg = self.makeprgBuild({ 'args_before': '--quiet --no-stdout --no-color' })
|
||||
|
||||
let errorformat =
|
||||
\ '%\s%#%l:%c%\s%#%tarning %m remark-lint,' .
|
||||
\ '%\s%#%l:%c-%.%#%\s%#%tarning %m remark-lint'
|
||||
\ '%f:%t:%l:%c:%n:%m,' .
|
||||
\ '%f:%t:%l:%c:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')},
|
||||
\ 'preprocess': 'remark_lint',
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0] })
|
||||
|
||||
for e in loclist
|
||||
if get(e, 'col', 0) && get(e, 'nr', 0)
|
||||
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c'
|
||||
let e['nr'] = 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
Loading…
Reference in New Issue
Block a user