Checker d/dscanner: cleanup.
This commit is contained in:
parent
c6f83efdd3
commit
75180daad7
@ -98,6 +98,35 @@ function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#dscanner(errors) abort " {{{2
|
||||
let idx = 0
|
||||
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
|
||||
let idx += 1
|
||||
endwhile
|
||||
let errs = s:_decode_JSON(join(a:errors[idx :], ''))
|
||||
|
||||
let out = []
|
||||
if type(errs) == type({}) && has_key(errs, 'issues') && type(errs['issues']) == type([])
|
||||
for issue in errs['issues']
|
||||
try
|
||||
call add(out,
|
||||
\ issue['fileName'] . ':' .
|
||||
\ issue['line'] . ':' .
|
||||
\ issue['column'] . ':' .
|
||||
\ issue['message'] . ' [' . issue['key'] . ']')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker d/dscanner: unrecognized error item ' . string(issue))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker d/dscanner: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#flow(errors) abort " {{{2
|
||||
let idx = 0
|
||||
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
|
||||
@ -424,21 +453,6 @@ function! syntastic#preprocess#validator(errors) abort " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#dscanner(errors) abort " {{{2
|
||||
let startIndex = index(a:errors, '{')
|
||||
let data = join(a:errors[startIndex:], '')
|
||||
let errs = s:_decode_JSON(data)
|
||||
|
||||
let out = []
|
||||
let issues = errs['issues']
|
||||
for issue in issues
|
||||
let msg = issue['fileName'] . ':' . issue['line'] . ':'
|
||||
\ . issue['column'] . ':' . issue['message']
|
||||
call add(out, msg)
|
||||
endfor
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#vint(errors) abort " {{{2
|
||||
let errs = s:_decode_JSON(join(a:errors, ''))
|
||||
|
||||
|
@ -1755,7 +1755,7 @@ SYNTAX CHECKERS FOR D *syntastic-checkers-d*
|
||||
The following checkers are available for D (filetype "d"):
|
||||
|
||||
1. DMD......................|syntastic-d-dmd|
|
||||
1. D-Scanner................|syntastic-d-dscanner|
|
||||
2. D-Scanner................|syntastic-d-dscanner|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. DMD *syntastic-d-dmd*
|
||||
@ -1841,8 +1841,8 @@ executable.
|
||||
Name: dscanner
|
||||
Maintainer: ANtlord
|
||||
|
||||
"D-Scanner" is a tool for analyzing D source code (https://dlang.org/).
|
||||
See the manual for more information:
|
||||
"D-Scanner" is a tool for analyzing D source code (https://dlang.org/). See
|
||||
the project's page at GitHub for more information:
|
||||
|
||||
https://github.com/Hackerpilot/Dscanner
|
||||
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-33'
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-34'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -1,7 +1,12 @@
|
||||
"============================================================================
|
||||
"File: dscanner.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: ANtlord
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
@ -10,40 +15,27 @@ if exists('g:loaded_syntastic_d_dscanner_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_d_dscanner_checker = 1
|
||||
|
||||
if !exists('g:syntastic_d_dscanner_sort')
|
||||
let g:syntastic_d_dscanner_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_d_dscanner_IsAvailable() dict
|
||||
let exec_file = self.getExec()
|
||||
let is_exec = executable(exec_file)
|
||||
if !is_exec
|
||||
call self.log('Syntastic: D-Scanner executable file not found.')
|
||||
endif
|
||||
return is_exec
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_d_dscanner_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '--report',
|
||||
\ 'tail': '2>/dev/null',
|
||||
\ 'args_after': '' })
|
||||
\ 'args_after': '--report',
|
||||
\ 'tail': '2>' . syntastic#util#DevNull() })
|
||||
|
||||
let errorformat = '%f:%l:%c:%m'
|
||||
let loclist = SyntasticMake({
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'dscanner'})
|
||||
return loclist
|
||||
\ 'preprocess': 'dscanner',
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'd',
|
||||
\ 'name': 'dscanner',
|
||||
\ 'exec': 'dscanner' })
|
||||
\ 'name': 'dscanner' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
Loading…
Reference in New Issue
Block a user