Skip to content

feat: add pre-commit #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.1.2
hooks:
- id: flake8
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,17 @@ user.save()
```

8. You can now access the /admin page.

## Setup pre-commit

PyLadiescon-portal uses a tool called [pre-commit](https://pre-commit.com/) to enforce coding standard and styles. To enable pre-commit, run:

```
pre-commit install
```

### Pre-commit automatically runs during the commit

With pre-commit installed as a git hook for verifying commits, the pre-commit hooks configured in `.pre-commit-config.yaml` for PyLadiescon-portal must all pass before the commit is successful. If there are any issues found with the commit, this will cause your commit to fail. Where possible, pre-commit will make the changes needed to correct the problems it has found.

You can then re-add any files that were modified as a result of the pre-commit checks, and re-commit the change.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pytest-django==4.8.0
pytest==8.3.5
pytest-cov==6.1.1
coverage==7.7.0
pre_commit==4.2.0