From 3d3f800f68264c3733627bbd435ba0aee2733cf1 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 18 Nov 2021 16:11:13 +0300 Subject: [PATCH] pylsp seems to cover all linting needs --- vim/.vim/autoload/python/lint.vim | 94 ------------------------------- vim/.vim/ftplugin/python/lint.vim | 6 -- 2 files changed, 100 deletions(-) delete mode 100644 vim/.vim/autoload/python/lint.vim delete mode 100644 vim/.vim/ftplugin/python/lint.vim diff --git a/vim/.vim/autoload/python/lint.vim b/vim/.vim/autoload/python/lint.vim deleted file mode 100644 index ecd8a32..0000000 --- a/vim/.vim/autoload/python/lint.vim +++ /dev/null @@ -1,94 +0,0 @@ -" Asynchronous pylint utility call -" Maintainer: Sergey Matveev -" License: GNU General Public License version 3 of the License or later -" -" This plugin allows you to asynchronously call pylint. -" -" * Press to start pylint on current file -" * Press to open quickfix window with messages from pylint -" * All lines with corresponding pylint existing warning will be highlighted -" * If no warning and errors occurred, "pylint is clean" message will be shown -" * If existing quickfix window is found, then it won't be overwritten. -" Start pylint manually () to force its filling -" * After Python file is saved, pylint is automatically started - -function! python#lint#status() - if exists("b:pylint_job") && job_status(b:pylint_job) == "run" | return "LN" | endif - return "" -endfunction - -function! s:qffill(ch) abort - let msgs = [] - while ch_status(a:ch) == 'buffered' - let msgs = add(msgs, ch_read(a:ch)) - endwhile - cgetexpr msgs -endfunction - -sign define LN text=LN texthl=Error - -function! python#lint#finish(ch) abort - let l:errorformat_bak = &errorformat - set errorformat=%f:%l:\ [%t]%m,%f:%l:%m - call s:qffill(a:ch) - let &errorformat=l:errorformat_bak - sign unplace * - let l:id = 2 - for item in getqflist() - if item.lnum == 0 | continue | endif - execute(':sign place '.l:id.' name=LN line='.l:item.lnum.' buffer='.l:item.bufnr) - let l:id = l:id + 2 - endfor - redraw! - if l:id == 2 - echohl MoreMsg | echomsg "pylint is clean" | echohl None - cclose - endif -endfunction - -function! python#lint#start() abort - if exists("g:pylint_disable") || - \ (exists("b:pylint_job") && - \ job_status(b:pylint_job) == "run") - return - endif - let ignores = [ - \"locally-disabled", - \"no-init", - \"no-self-use", - \"too-few-public-methods", - \"missing-docstring", - \"too-many-instance-attributes", - \"invalid-name", - \"too-many-arguments", - \"too-many-locals", - \"too-many-public-methods", - \"no-value-for-parameter", - \] - let linter = get(g:, "pylint_linter", "flake8") - if linter == "flake8" - let cmdline = [ - \"flake8", - \"--ignore=E501", - \"--format=%(path)s:%(row)d: [%(code)s] %(text)s", - \"--max-line-length=90", - \expand("%p") - \] - elseif linter == "pylint" - let cmdline = [ - \"pylint", - \"--jobs=4", - \"--reports=n", - \"--msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}", - \"--disable=" . join(ignores, ","), - \"--persistent=n", - \"--score=no", - \expand("%p") - \] - else - echohl WarningMsg | echomsg "Unknown linter specified" | echohl None - return - endif - let b:pylint_job = job_start(cmdline, - \ {"in_mode": "nl", "err_io": "null", "close_cb": "python#lint#finish"}) -endfunction diff --git a/vim/.vim/ftplugin/python/lint.vim b/vim/.vim/ftplugin/python/lint.vim deleted file mode 100644 index 7f92218..0000000 --- a/vim/.vim/ftplugin/python/lint.vim +++ /dev/null @@ -1,6 +0,0 @@ -if exists("*python#lint#start") | finish | endif -let b:lint_status_func=function("python#lint#status") -sign define LN text=LN texthl=Error -map :unlet! g:pylint_disable:call python#lint#start() -map [17;2~ :redraw!:copen -autocmd BufWritePost *.py call python#lint#start() -- 2.44.0