* [gentoo-commits] proj/gentoo-syntax:master commit in: /, syntax_checkers/ebuild/
@ 2022-02-21 18:15 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2022-02-21 18:15 UTC (permalink / raw
To: gentoo-commits
commit: 7e8691060c2a5a1aae36334cd6bc0c2c597e5521
Author: Anna “CyberTailor” <cyber <AT> sysrq <DOT> in>
AuthorDate: Fri Feb 18 18:07:26 2022 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Feb 21 18:15:00 2022 +0000
URL: https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=7e869106
pkgcheck: add new Syntastic checker
Signed-off-by: Anna Vyalkova <cyber+gentoo <AT> sysrq.in>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Makefile | 1 +
syntax_checkers/ebuild/pkgcheck.vim | 52 +++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/Makefile b/Makefile
index 8e170fd..87daee1 100644
--- a/Makefile
+++ b/Makefile
@@ -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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-21 18:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 18:15 [gentoo-commits] proj/gentoo-syntax:master commit in: /, syntax_checkers/ebuild/ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox