DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Python Syntax and Style Check in vim


Pylint

Pylint is a static Python syntax and style checker. It works well with vim's generic syntax checker front-end syntastic.

Install it with pip install pylint. Remove it with pip uninstall pylint.

Or download pylint-1.0.0.tar.gz from it's old website. Unzip it, and run sudo python setup.py install.

Not use apt-get, the version is old.

# apt-get install pylint      // install pylint 0.25.1, so uninstall it
# apt-get purge pylint
# apt-get purge python-logilab-astng
# apt-get purge python-logilab-common

Now you can use pylint --version and pylint <module>.py to check your source code.

syntastic

Syntastic is a generic syntax checker front-end of vim.

Install it:

cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git

See docs: :h syntastic

:SyntasticInfo
Syntastic: active mode enabled
Syntastic version: 3.4.0-69
Info for filetype: python
Available checker(s): pylint python
Currently enabled checker(s): python pylint

You can see pylint is recognized as a checker. Now you can check with pylint:

:SyntasticCheck


Published

May 22, 2014

Last Updated

May 22, 2014

Category

Tech

Tags

  • check 1
  • python 136
  • syntastic 2
  • vim 92

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor