A tool to run formatting checks before committing.

See pre-commit.com/.

Install

Install with pip directly, or add to requirements.txt.

$ pip install pre-commit

Configure

Create .pre-commit.config.yaml in your repo.

Install in your repo for each commit.

$ pre-commit install

Or if you want commits to be quicker and rather check on a push, install on pre-push instead:

$ pre-commit install --hook-type pre-push

Usage

$ pre-commit run --all-files
$ # OR
$ pre-commit run --files PATH PATH PATH

Verbose output:

$ pre-commit run --verbose