Skip to content

Pre-commit Hooks#

Pre-commit hooks are tools used to enforce code quality and consistency by running checks or scripts before changes are committed.
These hooks help identify issues early, improving code hygiene.

Installation and Setup#

Install the package in your base environment.
💻 pip install pre-commit

Create a 📝 .pre-commit-config.yaml file in your repository root.
This file defines the hooks and configurations.

Usage#

To run the hooks manually, use:
💻 pre-commit run --all-files

Now, every time you commit changes, the pre-commit hooks will automatically
run the checks defined in your configuration file, ensuring code quality before committing.

Used Icons

🐙 GitHub | 💠 git | 📝 File | 💻 Command Line