Skip to content
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

[WIP] Add pre commit #23

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name: Unit Tests
on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]

test:
runs-on: ubuntu-latest

Expand Down
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
files: ".*\\.py"
- id: check-added-large-files
- repo: https://github.com/wemake-services/dotenv-linter
rev: 0.3.0 # Use the ref you want to point at
hooks:
- id: dotenv-linter
files: ".env.example"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

# You can add your own hooks too.
# - repo: local
# hooks:
# - id: my_hook
# name: Some custom hook
# entry: ./.local_precommit_hooks/my_own_hook.sh
# language: script
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ macOS and Linux: `source venv/bin/activate`
Run `tox`
# How to run the unit tests
- Navigate to the project's root directory and run `python -m pytest`

# Using pre-commit for commit checks

```
pip install pre-commit
pre-commit install
```
Loading