-
Notifications
You must be signed in to change notification settings - Fork 1
Integrate code linting to your workflow
Swati Jaiswal edited this page Aug 28, 2019
·
1 revision
Install pylint
pip install pylint
Run a pylint test after you have finished writing code before commiting
pylint <project_dir_name>
e.g. pylint scraper
Fix error if are reported by pylint and push the code.
Add the following block of code in your .vimrc.
set errorformat=%f:%l:\ %m
autocmd FileType python setlocal makeprg=pylint\ --reports=n\ --msg-template=\"{path}:{line}:\ {msg_id}\ {symbol},\ {obj}\ {msg}\"\ %:p
autocmd BufWritePost *.py silent! make | redraw!
autocmd QuickFixCmdPost [^l]* cwindow
Now pylint will automatically run everytime you save the file in vim with :w
and you will see the pylint output in a vertically split window just below your code.