Skip to content
README.md 1.71 KiB
Newer Older
Dom Sekotill's avatar
Dom Sekotill committed
[![licence-badge]](/LICENCE.txt)


Pre-Commit Hook: Pylint
=======================

**An improved Pylint hook for [pre-commit][]**

Unlike the official Pylint pre-commit hook, this hook installs dependencies so that Pylint 
can analyse external calls properly and avoid warnings about missing modules.


Using with pre-commit
---------------------

Add the following to your `.pre-commit-config.yaml`:

    - repo: https://code.kodo.org.uk/dom/pre-commit-pylint
      rev: v2.6.0
      hooks:
      - id: pylint
        # args: [...]


Configuration
-------------

Configuration is done by adding arguments to the hook in `.pre-commit-config.yaml`.
Any arguments supported by [Pylint][pylint-cmdline] are allowed, along with a few others 
listed below.

##### `--extras=[EXTRA[,EXTRA...]]`

**Alias:** `-e`

**Argument:** A comma separated list of package extras to install.

**Description:** Extras are named groups of optional extra dependencies listed in 
a project's metadata and normally added to the packaging configuration.  If Pylint complains 
about being unable to find a module listed in an extras group, the group will need to be 
included here.


##### `--editable|--non-editable`

**Description:** Enable or disable editable mode install of the package in the Pylint 
environment.  This is only available to packages using *setuptools* and is enabled by 
default when `setup.py` is detected.  It may improve environment setup times.


---

[licence-badge]:
  https://img.shields.io/badge/licence-MPL--2.0-orange.svg
  "Licence: MPL-2.0"

[pre-commit]:
  https://pre-commit.com/
  "pre-commit documentation"

[pylint-cmdline]:
  http://pylint.pycqa.org/en/latest/user_guide/run.html#command-line-options
  "Pylint Command Line Options"