aboutsummaryrefslogtreecommitdiff
path: root/runtime/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/compiler')
-rw-r--r--runtime/compiler/cppcheck.vim18
-rw-r--r--runtime/compiler/maven.vim40
-rw-r--r--runtime/compiler/mypy.vim19
-rw-r--r--runtime/compiler/pylint.vim25
-rw-r--r--runtime/compiler/ruff.vim19
5 files changed, 103 insertions, 18 deletions
diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim
index ed7c46e90f..4df12d1714 100644
--- a/runtime/compiler/cppcheck.vim
+++ b/runtime/compiler/cppcheck.vim
@@ -1,15 +1,15 @@
" vim compiler file
" Compiler: cppcheck (C++ static checker)
" Maintainer: Vincent B. (twinside@free.fr)
-" Last Change: 2024 Oct 4 by @Konfekt
+" Last Change: 2024 Nov 08 by @Konfekt
-if exists("cppcheck")
- finish
-endif
+if exists("current_compiler") | finish | endif
let current_compiler = "cppcheck"
let s:cpo_save = &cpo
-set cpo-=C
+set cpo&vim
+
+let s:slash = has('win32')? '\' : '/'
if !exists('g:c_cppcheck_params')
let g:c_cppcheck_params = '--verbose --force --inline-suppr'
@@ -20,12 +20,12 @@ endif
let &l:makeprg = 'cppcheck --quiet'
\ ..' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"'
- \ ..' '..get(b:, 'c_cppcheck_params',
- \ g:c_cppcheck_params..' '..(&filetype ==# 'cpp' ? ' --language=c++' : ''))
+ \ ..' '..get(b:, 'c_cppcheck_params', get(g:, 'c_cppcheck_params', (&filetype ==# 'cpp' ? ' --language=c++' : '')))
\ ..' '..get(b:, 'c_cppcheck_includes', get(g:, 'c_cppcheck_includes',
\ (filereadable('compile_commands.json') ? '--project=compile_commands.json' :
- \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I'))))
-silent CompilerSet makeprg
+ \ (!empty(glob('*'..s:slash..'compile_commands.json', 1, 1)) ? '--project='..glob('*'..s:slash..'compile_commands.json', 1, 1)[0] :
+ \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I')))))
+exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "')
CompilerSet errorformat=
\%f:%l:%c:\ %tarning:\ %m,
diff --git a/runtime/compiler/maven.vim b/runtime/compiler/maven.vim
new file mode 100644
index 0000000000..ef8d8a6fb2
--- /dev/null
+++ b/runtime/compiler/maven.vim
@@ -0,0 +1,40 @@
+" Vim compiler file
+" Compiler: Maven
+" Maintainer: D. Ben Knoble <ben.knoble+vim@gmail.com>
+" Maintainer: Konfekt
+" Original Source: https://github.com/JalaiAmitahl/maven-compiler.vim/blob/master/compiler/mvn.vim
+" (Copyright Dan Taylor, distributed under the same terms as LICENSE)
+" Original Source: https://github.com/mikelue/vim-maven-plugin/blob/master/compiler/maven.vim
+" (distributed under same terms as LICENSE per
+" https://github.com/mikelue/vim-maven-plugin/issues/13)
+" Last Change: 2024 Nov 12
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "maven"
+
+CompilerSet makeprg=mvn\ --batch-mode
+
+" Error message for POM
+CompilerSet errorformat=[FATAL]\ Non-parseable\ POM\ %f:\ %m%\\s%\\+@%.%#line\ %l\\,\ column\ %c%.%#,
+CompilerSet errorformat+=[%tRROR]\ Malformed\ POM\ %f:\ %m%\\s%\\+@%.%#line\ %l\\,\ column\ %c%.%#
+
+" Java related build messages
+CompilerSet errorformat+=[%tARNING]\ %f:[%l\\,%c]\ %m
+CompilerSet errorformat+=[%tRROR]\ %f:[%l\\,%c]\ %m
+CompilerSet errorformat+=%A[%t%[A-Z]%#]\ %f:[%l\\,%c]\ %m,%Z
+CompilerSet errorformat+=%A%f:[%l\\,%c]\ %m,%Z
+
+" jUnit related build messages
+CompilerSet errorformat+=%+E\ \ %#test%m,%Z
+CompilerSet errorformat+=%+E[ERROR]\ Please\ refer\ to\ %f\ for\ the\ individual\ test\ results.
+" Message from JUnit 5(5.3.X), TestNG(6.14.X), JMockit(1.43), and AssertJ(3.11.X)
+CompilerSet errorformat+=%+E%>[ERROR]\ %.%\\+Time\ elapsed:%.%\\+<<<\ FAILURE!,
+CompilerSet errorformat+=%+E%>[ERROR]\ %.%\\+Time\ elapsed:%.%\\+<<<\ ERROR!,
+CompilerSet errorformat+=%+Z%\\s%#at\ %f(%\\f%\\+:%l),
+CompilerSet errorformat+=%+C%.%#
+
+" Misc message removal
+CompilerSet errorformat+=%-G[INFO]\ %.%#,
+CompilerSet errorformat+=%-G[debug]\ %.%#
diff --git a/runtime/compiler/mypy.vim b/runtime/compiler/mypy.vim
new file mode 100644
index 0000000000..891488626a
--- /dev/null
+++ b/runtime/compiler/mypy.vim
@@ -0,0 +1,19 @@
+" Vim compiler file
+" Compiler: Mypy (Python static checker)
+" Maintainer: @Konfekt
+" Last Change: 2024 Nov 07
+
+if exists("current_compiler") | finish | endif
+let current_compiler = "mypy"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=mypy
+let &l:makeprg = 'mypy --show-column-numbers '
+ \ ..get(b:, 'mypy_makeprg_params', get(g:, 'mypy_makeprg_params', '--strict --ignore-missing-imports'))
+exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "')
+CompilerSet errorformat=%f:%l:%c:\ %t%*[^:]:\ %m
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim
index 14e9696dbb..4c9c23e125 100644
--- a/runtime/compiler/pylint.vim
+++ b/runtime/compiler/pylint.vim
@@ -1,13 +1,20 @@
" Vim compiler file
-" Compiler: Pylint for Python
-" Maintainer: Daniel Moch <daniel@danielmoch.com>
-" Last Change: 2016 May 20
-" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition)
-
-if exists("current_compiler")
- finish
-endif
+" Compiler: Pylint for Python
+" Maintainer: Daniel Moch <daniel@danielmoch.com>
+" Last Change: 2024 Nov 07 by The Vim Project (added params variable)
+
+if exists("current_compiler") | finish | endif
let current_compiler = "pylint"
-CompilerSet makeprg=pylint\ --output-format=text\ --msg-template=\"{path}:{line}:{column}:{C}:\ [{symbol}]\ {msg}\"\ --reports=no
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=ruff
+let &l:makeprg = 'pylint ' .
+ \ '--output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no ' .
+ \ get(b:, "pylint_makeprg_params", get(g:, "pylint_makeprg_params", '--jobs=0'))
+exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "')
CompilerSet errorformat=%A%f:%l:%c:%t:\ %m,%A%f:%l:\ %m,%A%f:(%l):\ %m,%-Z%p^%.%#,%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/ruff.vim b/runtime/compiler/ruff.vim
new file mode 100644
index 0000000000..11a69740d8
--- /dev/null
+++ b/runtime/compiler/ruff.vim
@@ -0,0 +1,19 @@
+" Vim compiler file
+" Compiler: Ruff (Python linter)
+" Maintainer: @pbnj-dragon
+" Last Change: 2024 Nov 07
+
+if exists("current_compiler") | finish | endif
+let current_compiler = "ruff"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=ruff
+let &l:makeprg= 'ruff check --output-format=concise '
+ \ ..get(b:, 'ruff_makeprg_params', get(g:, 'ruff_makeprg_params', '--preview'))
+exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "')
+CompilerSet errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,%f:%l:%c\ -\ %m,%f:
+
+let &cpo = s:cpo_save
+unlet s:cpo_save