dockerfile_lint.vim 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "============================================================================
  2. "File: dockerfile_lint.vim
  3. "Description: Syntax checking plugin for syntastic.vim using dockerfile-lint
  4. " (https://github.com/projectatomic/dockerfile_lint).
  5. "Maintainer: Tim Carry <tim at pixelastic dot com>
  6. "License: This program is free software. It comes without any warranty,
  7. " to the extent permitted by applicable law. You can redistribute
  8. " it and/or modify it under the terms of the Do What The Fuck You
  9. " Want To Public License, Version 2, as published by Sam Hocevar.
  10. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  11. "
  12. "============================================================================
  13. if exists('g:loaded_syntastic_dockerfile_dockerfile_lint_checker')
  14. finish
  15. endif
  16. let g:loaded_syntastic_dockerfile_dockerfile_lint_checker = 1
  17. let s:save_cpo = &cpo
  18. set cpo&vim
  19. function! SyntaxCheckers_dockerfile_dockerfile_lint_GetLocList() dict
  20. let makeprg = self.makeprgBuild({
  21. \ 'args_after': '-j',
  22. \ 'fname_before': '-f' })
  23. let errorformat = '%t:%n:%l:%m'
  24. let loclist = SyntasticMake({
  25. \ 'makeprg': makeprg,
  26. \ 'errorformat': errorformat,
  27. \ 'preprocess': 'dockerfile_lint',
  28. \ 'defaults': {'bufnr': bufnr('')},
  29. \ 'returns': [0, 1] })
  30. for e in loclist
  31. if e['nr']
  32. let e['subtype'] = 'Style'
  33. endif
  34. call remove(e, 'nr')
  35. endfor
  36. return loclist
  37. endfunction
  38. call g:SyntasticRegistry.CreateAndRegisterChecker({
  39. \ 'filetype': 'dockerfile',
  40. \ 'name': 'dockerfile_lint'})
  41. let &cpo = s:save_cpo
  42. unlet s:save_cpo
  43. " vim: set sw=4 sts=4 et fdm=marker: