diff --git a/README.markdown b/README.markdown index 004d307e..aa5d842f 100644 --- a/README.markdown +++ b/README.markdown @@ -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, diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index 7ce90a86..a7ec48a9 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -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 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4529af52..77fb7c31 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -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 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 64816709..069ae97e 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -30,6 +30,7 @@ let s:_DEFAULT_CHECKERS = { \ 'd': ['dmd'], \ 'dart': ['dartanalyzer'], \ 'docbk': ['xmllint'], + \ 'dockerfile': ['dockerfile_lint'], \ 'dustjs': ['swiffer'], \ 'elixir': [], \ 'erlang': ['escript'], diff --git a/syntax_checkers/dockerfile/dockerfile-lint.vim b/syntax_checkers/dockerfile/dockerfile_lint.vim similarity index 74% rename from syntax_checkers/dockerfile/dockerfile-lint.vim rename to syntax_checkers/dockerfile/dockerfile_lint.vim index ac92ba85..3a5b7694 100644 --- a/syntax_checkers/dockerfile/dockerfile-lint.vim +++ b/syntax_checkers/dockerfile/dockerfile_lint.vim @@ -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 "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({