File: pre-commit.rst

package info (click to toggle)
prospector 1.10.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,436 kB
  • sloc: python: 4,200; makefile: 180
file content (56 lines) | stat: -rw-r--r-- 1,581 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
Pre-commit Hook
===============

If you'd like Prospector to be run automatically when making changes to files in your Git
repository, you can install `pre-commit`_ and add the following
text to your repositories' ``.pre-commit-config.yaml``::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0 # The version of Prospector to use, if not 'master' for latest
        hooks:
        -   id: prospector

.. _pre-commit: https://pre-commit.com/

Commandline Arguments
---------------------

Some controls for prospector, especially surrounding how the output is displayed, are not
:doc:`configurable from a profile <profiles>`, only from the commandline.

To add command-line arguments to the pre-commit hook config file::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0
        hooks:
        -   id: prospector
            args:
            - --summary-only


Optional Tools
--------------

By default the configuration will only install :doc:`the base supported tools <supported_tools>` and not optional tools.

If you also use optional tools, for example bandit or mypy, then you can add
them to the hook configuration like so::

    repos:
    -   repo: https://github.com/PyCQA/prospector
        rev: 1.10.0
        hooks:
        -   id: prospector
            additional_dependencies:
            - ".[with-mypy,with-bandit]"
          - args: [
            '--with-tool=mypy',
            '--with-tool=bandit',
            ]


This is equivalent to running::

    pip install prospector[with-bandit,with-mypy]