Dockerfile_lint checker: cleanup.
This commit is contained in:
parent
13456d5a71
commit
73dd785486
@ -54,10 +54,10 @@ compile their code or execute their script to find them.
|
||||
|
||||
At the time of this writing, syntastic has checking plugins for ActionScript,
|
||||
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM,
|
||||
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco,
|
||||
Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby,
|
||||
Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS,
|
||||
HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM
|
||||
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq,
|
||||
CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang,
|
||||
eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars,
|
||||
HSS, HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM
|
||||
intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C,
|
||||
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
|
||||
iOS property lists, Puppet, Python, QML, R, Racket, Relax NG, reStructuredText,
|
||||
|
@ -62,26 +62,38 @@ endfunction " }}}2
|
||||
function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
|
||||
let out = []
|
||||
let json = s:_decode_JSON(join(a:errors, ''))
|
||||
let data = json['error']['data'] + json['warn']['data'] + json['info']['data']
|
||||
|
||||
if type(json) == type({})
|
||||
for e in data
|
||||
let type = toupper(e['level'][0])
|
||||
let type = (type ==# 'I') ? 'W' : type
|
||||
let line = has_key(e, 'line') ? e['line'] : 1
|
||||
let message = e['message']
|
||||
if has_key(e, 'description') && e['description'] !=# 'None'
|
||||
let message = message . '. ' . e['description']
|
||||
endif
|
||||
try
|
||||
let data = json['error']['data'] + json['warn']['data'] + json['info']['data']
|
||||
for e in data
|
||||
let type = toupper(e['level'][0])
|
||||
if type ==# 'I'
|
||||
let type = 'W'
|
||||
let style = 1
|
||||
else
|
||||
let style = 0
|
||||
endif
|
||||
|
||||
let msg =
|
||||
\ type . ':' .
|
||||
\ line . ':' .
|
||||
\ message
|
||||
call add(out, msg)
|
||||
endfor
|
||||
let line = get(e, 'line', 1)
|
||||
let message = e['message']
|
||||
if has_key(e, 'description') && e['description'] !=# 'None'
|
||||
let message = message . '. ' . e['description']
|
||||
endif
|
||||
|
||||
let msg =
|
||||
\ type . ':' .
|
||||
\ style . ':' .
|
||||
\ line . ':' .
|
||||
\ message
|
||||
call add(out, msg)
|
||||
endfor
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
|
||||
let out = []
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile-lint: unrecognized error format')
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-37'
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-39'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -30,6 +30,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'd': ['dmd'],
|
||||
\ 'dart': ['dartanalyzer'],
|
||||
\ 'docbk': ['xmllint'],
|
||||
\ 'dockerfile': ['dockerfile_lint'],
|
||||
\ 'dustjs': ['swiffer'],
|
||||
\ 'elixir': [],
|
||||
\ 'erlang': ['escript'],
|
||||
|
@ -1,6 +1,6 @@
|
||||
"============================================================================
|
||||
"File: dockerfile_lint.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim using `dockerfile-lint`
|
||||
"Description: Syntax checking plugin for syntastic.vim using dockerfile-lint
|
||||
" (https://github.com/projectatomic/dockerfile-lint).
|
||||
"Maintainer: Tim Carry <tim at pixelastic dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
@ -10,7 +10,7 @@
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
|
||||
if exists('g:loaded_syntastic_dockerfile_dockerfile_lint_checker')
|
||||
finish
|
||||
endif
|
||||
@ -21,15 +21,26 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_dockerfile_dockerfile_lint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '--json -f' })
|
||||
\ 'args_after': '-j',
|
||||
\ 'fname_before': '-f' })
|
||||
|
||||
let errorformat = '%t:%l:%m'
|
||||
let errorformat = '%t:%n:%l:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'dockerfile_lint',
|
||||
\ 'defaults': {'bufnr': bufnr('')},
|
||||
\ 'preprocess': 'dockerfile_lint' })
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
if e['nr']
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
call remove(e, 'nr')
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
Loading…
Reference in New Issue
Block a user