blob: 62dfbcfd02299f8b9f3d10535978e8232a49df99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
.. _pre-commit-integration:
Pre-commit integration
======================
``pylint`` can be used as a `pre-commit <https://pre-commit.com>`_ hook.
Since ``pylint`` needs to import modules and dependencies to work correctly, the
hook only works with a local installation of ``pylint`` (in your environment).
If you installed ``pylint`` locally it can be added to ``.pre-commit-config.yaml``
as follows:
.. sourcecode:: yaml
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
]
You can use ``args`` to pass command line arguments as described in the :ref:`tutorial`.
A hook with more arguments could look something like this:
.. sourcecode:: yaml
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=pylintrc", # Link to your config file
"--load-plugins=pylint.extensions.docparams", # Load an extension
]
|