Python with flycheck + pylint in emacs

Table of Contents

flycheck and pylint

Pylint use Python's PEP8 style to format the python code. And with h the Flycheck emacs extension, pylint’s output will be shown right inside your emacs buffers.

Requirements:

  • emacs version 24 or newer.

install flycheck and pylint

sudo apt-get install pylint
# use emacs’ package manager install it
M-x package-install RET flycheck

configure emacs

(defun flycheck-python-setup ()
  (flycheck-mode))
(add-hook 'python-mode-hook #'flycheck-python-setup)

configure pylint

pylint --generate-rcfile >.pylintrc

Disable whatever warnings and errors you want by adding the appropriate codes to the “disable=” line in your .pylintrc file. Full list is here.

Examples:

disable= C0326, W0621, C0111, C0103, W0702, W0703, C0321, W0511, W0102, R0913,
         R0914, R0915, R0912, R0902, R0903, C0303, C0302, C0325, W0401

Author: Shi Shougang

Created: 2015-03-05 Thu 23:19

Emacs 24.3.1 (Org mode 8.2.10)

Validate