From 27f3a2002c50dbe4d0be486201bf63446cf95838 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 17 Oct 2024 22:02:20 +0200 Subject: vim-patch:5e48e97: runtime(compiler): check for compile_commands in build dirs for cppcheck closes: vim/vim#15889 https://github.com/vim/vim/commit/5e48e97e4231e95385e07470a7e5659ff59bd0d7 Co-authored-by: Konfekt --- runtime/compiler/cppcheck.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim index ed7c46e90f..20c906f412 100644 --- a/runtime/compiler/cppcheck.vim +++ b/runtime/compiler/cppcheck.vim @@ -1,7 +1,7 @@ " vim compiler file " Compiler: cppcheck (C++ static checker) " Maintainer: Vincent B. (twinside@free.fr) -" Last Change: 2024 Oct 4 by @Konfekt +" Last Change: 2024 oct 17 by @Konfekt if exists("cppcheck") finish @@ -11,6 +11,8 @@ let current_compiler = "cppcheck" let s:cpo_save = &cpo set cpo-=C +let s:slash = has('win32')? '\' : '/' + if !exists('g:c_cppcheck_params') let g:c_cppcheck_params = '--verbose --force --inline-suppr' \ ..' '..'--enable=warning,style,performance,portability,information,missingInclude' @@ -20,11 +22,11 @@ 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')))) + \ (!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'))))) silent CompilerSet makeprg CompilerSet errorformat= -- cgit From 32566dc1c3e85e9743f25b6e6a622f63646b5b4f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Nov 2024 08:23:55 +0800 Subject: vim-patch:3780c11: runtime(compiler): fix typo in cppcheck compiler plugin closes: vim/vim#16002 https://github.com/vim/vim/commit/3780c11267415ff57f261fcd3e1dea0c2c9d8dd0 Co-authored-by: Enno --- runtime/compiler/cppcheck.vim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim index 20c906f412..d6fc0d6873 100644 --- a/runtime/compiler/cppcheck.vim +++ b/runtime/compiler/cppcheck.vim @@ -1,15 +1,13 @@ " vim compiler file " Compiler: cppcheck (C++ static checker) " Maintainer: Vincent B. (twinside@free.fr) -" Last Change: 2024 oct 17 by @Konfekt +" Last Change: 2024 Oct 17 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')? '\' : '/' -- cgit From b4c5e743ac66bd288017d769e06751cf9cda9a18 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Nov 2024 08:43:43 +0800 Subject: vim-patch:6d9a145: runtime(compiler): add mypy and ruff compiler; update pylint linter mypy and ruff come from https://github.com/Konfekt/vim-compilers/tree/master/compiler and the former was added by @pbnj-dragon closes: vim/vim#16007 https://github.com/vim/vim/commit/6d9a145d719857fe461d045adf3b61ec4b4bb53f Co-authored-by: Konfekt --- runtime/compiler/mypy.vim | 19 +++++++++++++++++++ runtime/compiler/pylint.vim | 26 +++++++++++++++++--------- runtime/compiler/ruff.vim | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 runtime/compiler/mypy.vim create mode 100644 runtime/compiler/ruff.vim (limited to 'runtime/compiler') 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..59408b4750 100644 --- a/runtime/compiler/pylint.vim +++ b/runtime/compiler/pylint.vim @@ -1,13 +1,21 @@ " Vim compiler file -" Compiler: Pylint for Python -" Maintainer: Daniel Moch -" 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 +" 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", + \ (executable('getconf') ? '--jobs='..systemlist('getconf _NPROCESSORS_ONLN')[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 -- cgit From c914ecf4c930f247123ec40ffc4b59461cd1a1f2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Nov 2024 08:45:06 +0800 Subject: vim-patch:0f60fbf: runtime(compiler): improve cppcheck Properly escape the values for makeprg according to the :set rules closes: vim/vim#16014 https://github.com/vim/vim/commit/0f60fbf6796b72111184a6734b702a93f8f8944b Co-authored-by: Konfekt --- runtime/compiler/cppcheck.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim index d6fc0d6873..4df12d1714 100644 --- a/runtime/compiler/cppcheck.vim +++ b/runtime/compiler/cppcheck.vim @@ -1,7 +1,7 @@ " vim compiler file " Compiler: cppcheck (C++ static checker) " Maintainer: Vincent B. (twinside@free.fr) -" Last Change: 2024 Oct 17 by @Konfekt +" Last Change: 2024 Nov 08 by @Konfekt if exists("current_compiler") | finish | endif let current_compiler = "cppcheck" @@ -25,7 +25,7 @@ let &l:makeprg = 'cppcheck --quiet' \ (filereadable('compile_commands.json') ? '--project=compile_commands.json' : \ (!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'))))) -silent CompilerSet makeprg +exe 'CompilerSet makeprg='..escape(&l:makeprg, ' "') CompilerSet errorformat= \%f:%l:%c:\ %tarning:\ %m, -- cgit From eaf5ae6cc69a97e58365b409554783be9dd21385 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 13 Nov 2024 16:00:35 +0800 Subject: vim-patch:210c49b: runtime(compiler): update pylint linter (#31191) closes: vim/vim#16039 https://github.com/vim/vim/commit/210c49bbe8b2edf15fd4fbbc089ec128e4c9c0c9 Co-authored-by: Konfekt --- runtime/compiler/pylint.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim index 59408b4750..4c9c23e125 100644 --- a/runtime/compiler/pylint.vim +++ b/runtime/compiler/pylint.vim @@ -12,8 +12,7 @@ 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", - \ (executable('getconf') ? '--jobs='..systemlist('getconf _NPROCESSORS_ONLN')[0] : ''))) + \ 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%.%# -- cgit From 40dee8a2dcba996badaa6182eb34fde1694f92a3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 13 Nov 2024 20:28:20 +0100 Subject: vim-patch:c4208da: runtime(compiler): include a Java Maven compiler plugin @Konfekt suggested adding this [1]; I confirmed that both source repositories have permissive licenses [2], [3] that permit copying the code (at least where the compiler scripts are concerned). [1]: https://github.com/benknoble/Dotfiles/commit/570b1006fd794b0b9f5434b4fed4c2d785fcb05c [2]: https://github.com/JalaiAmitahl/maven-compiler.vim [3]: https://github.com/mikelue/vim-maven-plugin/issues/13 closes: vim/vim#16041 https://github.com/vim/vim/commit/c4208da0f4e59925f5e5828ed7725e22fd118e47 Co-authored-by: D. Ben Knoble --- runtime/compiler/maven.vim | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 runtime/compiler/maven.vim (limited to 'runtime/compiler') 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 +" 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]\ %.%# -- cgit