Added pre-commit git hooks into the project

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
Carlo Costino
2023-11-22 10:42:57 -05:00
parent 40de352f9e
commit d2891042b4
3 changed files with 30 additions and 0 deletions

13
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,13 @@
# 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: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: check-merge-conflict
- id: check-toml

View File

@@ -316,6 +316,22 @@ This will run the local development web server and make the admin site
available at http://localhost:6012; remember to make sure that the Notify.gov
API is running as well!
## Git Hooks
We're using [`pre-commit`](https://pre-commit.com/) to manage hooks in order to
automate common tasks or easily-missed cleanup. It's installed as part of
`make bootstrap` and is limited to this project's virtualenv.
To run the hooks in advance of a `git` operation, use
`poetry run pre-commit run`. For running across the whole codebase (useful after
adding a new hook), use `poetry run pre-commit run --all-files`.
The configuration is stored in `.pre-commit-config.yaml`. In that config, there
are links to the repos from which the hooks are pulled, so hop through there if
ou want a detailed description of what each one is doing.
We do not maintain any hooks in this repository.
## Python Dependency Management
We're using [`Poetry`](https://python-poetry.org/) for managing our Python

View File

@@ -53,6 +53,7 @@ isort = "^5.12.0"
jinja2-cli = {version = "==0.8.2", extras = ["yaml"]}
moto = "^4.2"
pip-audit = "*"
pre-commit = "^3.5.0"
pytest = "^7.4.3"
pytest-env = "^1.1.1"
pytest-mock = "^3.12.0"