diff options
author | Anna “CyberTailor” <cyber@sysrq.in> | 2022-02-18 23:07:26 +0500 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-02-21 19:15:00 +0100 |
commit | 7e8691060c2a5a1aae36334cd6bc0c2c597e5521 (patch) | |
tree | f46640b7f26670575e09a5b0b7bbf9a4007cd318 | |
parent | syntax/gentoo-make-conf: add ALLOW_TEST (diff) | |
download | gentoo-syntax-7e8691060c2a5a1aae36334cd6bc0c2c597e5521.tar.gz gentoo-syntax-7e8691060c2a5a1aae36334cd6bc0c2c597e5521.tar.bz2 gentoo-syntax-7e8691060c2a5a1aae36334cd6bc0c2c597e5521.zip |
pkgcheck: add new Syntastic checker
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | syntax_checkers/ebuild/pkgcheck.vim | 52 |
2 files changed, 53 insertions, 0 deletions
@@ -13,6 +13,7 @@ files = $(wildcard \ indent/* \ plugin/* \ syntax/* \ + syntax_checkers/* \ ) scripts: ${files} diff --git a/syntax_checkers/ebuild/pkgcheck.vim b/syntax_checkers/ebuild/pkgcheck.vim new file mode 100644 index 0000000..f8c1b4e --- /dev/null +++ b/syntax_checkers/ebuild/pkgcheck.vim @@ -0,0 +1,52 @@ +" Syntax checking plugin for syntastic +" Language: Gentoo Ebuilds/Eclasses +" Author: Anna Vyalkova <cyber+gentoo@sysrq.in> +" Copyright: Copyright (c) 2022 Anna Vyalkova +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax checker for ebuilds and eclasses powered by pkgcheck. +" Requires vim 7.0.175 or later. +" + +if exists('g:loaded_syntastic_ebuild_pkgcheck_checker') + finish +endif +let g:loaded_syntastic_ebuild_pkgcheck_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_ebuild_pkgcheck_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args_before': 'scan', + \ 'args': '-R FormatReporter', + \ 'args_after': '--format "{lineno}:{level}:{name}: {desc}"' }) + + let errorformat = + \ '%l:%tnfo:%m,' . ':%tnfo:%m,' . + \ '%W%l:style:%m,' . '%W:style:%m,' . + \ '%l:%tarning:%m,' . ':%tarning:%m,' . + \ '%l:%trror:%m,' . ':%trror:%m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr(''), 'type': 'E', 'text': 'Syntax error'}, + \ 'returns': [0, 1] }) + + for e in loclist + if e['valid'] && e['lnum'] == 0 + let e['lnum'] = str2nr(matchstr(e['text'], '\m\<lines\? \zs\d\+\ze')) + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ebuild', + \ 'name': 'pkgcheck', + \ 'exec': 'pkgcheck'}) + +let &cpo = s:save_cpo +unlet s:save_cpo |