New checker: d/dscanner.

This commit is contained in:
lantlord 2017-03-30 17:53:06 +03:00 committed by LCD 47
parent d7338f8a63
commit c6f83efdd3
4 changed files with 84 additions and 1 deletions

View File

@ -424,6 +424,21 @@ function! syntastic#preprocess#validator(errors) abort " {{{2
return out return out
endfunction " }}}2 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 function! syntastic#preprocess#vint(errors) abort " {{{2
let errs = s:_decode_JSON(join(a:errors, '')) let errs = s:_decode_JSON(join(a:errors, ''))

View File

@ -1755,6 +1755,7 @@ SYNTAX CHECKERS FOR D *syntastic-checkers-d*
The following checkers are available for D (filetype "d"): The following checkers are available for D (filetype "d"):
1. DMD......................|syntastic-d-dmd| 1. DMD......................|syntastic-d-dmd|
1. D-Scanner................|syntastic-d-dscanner|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1. DMD *syntastic-d-dmd* 1. DMD *syntastic-d-dmd*
@ -1834,6 +1835,22 @@ the usual 'g:syntastic_d_dmd_<option>' variables. The only exception is
'g:syntastic_d_dmd_exec', which can still be used to override the checker's 'g:syntastic_d_dmd_exec', which can still be used to override the checker's
executable. executable.
------------------------------------------------------------------------------
2. D-Scanner *syntastic-d-dscanner*
Name: dscanner
Maintainer: ANtlord
"D-Scanner" is a tool for analyzing D source code (https://dlang.org/).
See the manual for more information:
https://github.com/Hackerpilot/Dscanner
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
============================================================================== ==============================================================================
SYNTAX CHECKERS FOR DART *syntastic-checkers-dart* SYNTAX CHECKERS FOR DART *syntastic-checkers-dart*

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.8.0-34' let g:_SYNTASTIC_VERSION = '3.8.0-33'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -0,0 +1,51 @@
"============================================================================
"File: dscanner.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: ANtlord
"
"============================================================================
if exists('g:loaded_syntastic_d_dscanner_checker')
finish
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': '' })
let errorformat = '%f:%l:%c:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'dscanner'})
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'd',
\ 'name': 'dscanner',
\ 'exec': 'dscanner' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker: