forked from aniani/vim
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: #16007 Signed-off-by: Konfekt <Konfekt@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
64a536d4fa
commit
6d9a145d71
19
runtime/compiler/mypy.vim
Normal file
19
runtime/compiler/mypy.vim
Normal file
@@ -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
|
@@ -1,13 +1,21 @@
|
||||
" 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)
|
||||
" 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
|
||||
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
|
||||
|
19
runtime/compiler/ruff.vim
Normal file
19
runtime/compiler/ruff.vim
Normal file
@@ -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
|
Reference in New Issue
Block a user