3 # Asynchronous pylint utility call
4 # Maintainer: Sergey Matveev <stargrave@stargrave.org>
5 # License: GNU General Public License version 3 of the License or later
7 # This plugin allows you to asynchronously call pylint.
9 # * Press <F6> to start pylint on current file
10 # * Press <S-F6> to open quickfix window with messages from pylint
11 # * All lines with corresponding pylint existing warning will be highlighted
12 # * If no warning and errors occurred, "pylint is clean" message will be shown
13 # * If existing quickfix window is found, then it won't be overwritten.
14 # Start pylint manually (<F6>) to force its filling
16 export def Status(): string
17 if exists("b:pylint_job") && job_status(b:pylint_job) == "run" | return "LN" | endif
21 def Qffill(ch: channel)
23 while ch_status(ch) == "buffered"
24 msgs = add(msgs, ch_read(ch))
29 export def Finish(ch: channel)
30 var errorformat_bak = &errorformat
31 set errorformat=%f:%l:\ [%t]%m,%f:%l:%m
33 &errorformat = errorformat_bak
36 for item in getqflist()
37 if item.lnum == 0 | continue | endif
38 execute(":sign place " .. id ..
39 " name=LN line=" .. item.lnum .. " buffer=" .. item.bufnr)
44 echohl MoreMsg | echomsg "pylint is clean" | echohl None
50 if exists("b:pylint_job") && job_status(b:pylint_job) == "run"
56 "--format=%(path)s:%(row)d: [%(code)s] %(text)s",
57 "--max-line-length=90",
60 b:pylint_job = job_start(cmdline,
61 {"in_mode": "nl", "err_io": "null", "close_cb": "python#lint#Finish"})