6. 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’
repos: - repo: https://github.com/PyCQA/prospector rev: 1.7.5 # The version of Prospector to use, if not 'master' for latest hooks: - id: prospector
Some controls for prospector, especially surrounding how the output is displayed, are not configurable from a profile, 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.7.5 hooks: - id: prospector args: - --summary-only
By default the configuration will only install the base 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.7.5 hooks: - id: prospector additional_dependencies: - ".[with_mypy,with_bandit]"
This is equivalent to running:
pip install prospector[with_bandit,with_mypy]