msherry / flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck
GNU General Public License v3.0
63 stars 23 forks source link

MELPA MELPA

flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck

Copyright Marc Sherry msherry@gmail.com

This package provides a way to run multiple syntax checkers on Python code, in parallel. The list of supported checkers includes:

This is an alternative way of running multiple Python syntax checkers in Flycheck that doesn't depend on Flycheck's chaining mechanism.

Flycheck is opinionated about what checkers should be run, and chaining is difficult to get right (e.g. see https://github.com/flycheck/flycheck/issues/836, https://github.com/flycheck/flycheck/issues/1300). This package assumes that the user knows what they want, and can configure their checkers accordingly -- if they want to run both flake8 and pylint, that's fine.

This also allows us to run multiple syntax checkers in parallel, rather than sequentially.

Quick start

Installation via MELPA is easiest:

M-x package-install <RET> flycheck-pycheckers <RET>

Then, in your init.el:

(global-flycheck-mode 1)
(with-eval-after-load 'flycheck
  (add-hook 'flycheck-mode-hook #'flycheck-pycheckers-setup))

Start editing a Python file!

For more details on using Flycheck in general, please see http://www.flycheck.org/en/latest/user/quickstart.html. The error list (viewable with flycheck-list-errors, bound to C-c ! l by default) shows a unified view of all errors found by all checkers, with line and column information where available.

flycheck-list-errors

flycheck-pycheckers can run over any Python file right away, without needing to set up virtual environments or driver scripts. You will simply need to ensure that the checkers you want to run (pep8, mypy, flake8, etc.) are installed somewhere on your PATH where Emacs can find them.

flycheck-example-movie

Alternatives:

Configuration options

You can use this package without needing to get into these details at first -- they are intended for power users and those needing more customization.

There are a number of options that can be customized via customize-variable, which all start with flycheck-pycheckers-. These include:

Additionally, a .pycheckers file may be created in a directory to control options for every file under this directory. These files may be logically combined, so a project may have one set of options that may be selectively overridden in a specific subdirectory.

Example .pycheckers file:

[DEFAULT]
max_line_length = 120
mypy_config_file = ci/mypy.ini

Variables that can be set in the configuration file include the following. Note that these are implemented as modifying the values received by argparse in the pycheckers.py script, so running bin/pycheckers.py --help is a good way to find other options that may be specified.


Converted from flycheck-pycheckers.el by el2markdown.