pre-commit
A framework for managing and maintaining multi-language pre-commit hooks.
Installation
pip install pre-commit
pre-commit sample-config > .pre-commit-config.yaml
pre-commit install
Configuration
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
Supported Hooks
Integration with Formatter
-
black
The uncompromising Python code formatter. -
js-beautify
Beautifier for javascript. -
prettier
Prettier is an opinionated code formatter.
Integration with Linter
-
flake8
flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code. -
stylelint
A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. -
eslint
Find and fix problems in your JavaScript code. -
commitlint
Lint commit messages.