Skip to content

Commit

Permalink
feat: improved githooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Kowal committed Oct 18, 2024
1 parent d875a2e commit fca56d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
13 changes: 9 additions & 4 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,29 @@ echo "---------- Git hook: pre-commit ----------"

# Ruff (imports, lint, and format)
echo ""
echo ">>> [1/4] Running Ruff"
echo ">>> [1/5] Running Ruff"
ruff check --select I .
ruff check .
ruff format --check .

# Flake8 (lint)
echo ""
echo ">>> [2/4] Running Flake8"
echo ">>> [2/5] Running Flake8"
flake8 .

# MyPy (type checking)
echo ""
echo ">>> [3/4] Running MyPy"
echo ">>> [3/5] Running MyPy"
mypy .

# Pyright (type checking)
echo ""
echo ">>> [4/4] Running Pyright"
echo ">>> [4/5] Running Pyright"
pyright .

# Run tests
echo ""
echo ">>> [5/5] Running tests"
python -m unittest discover .

echo "------------------------------------------"
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ Run the following command to tell `git` to look for hooks in this folder:
git config core.hooksPath .githooks
```

### Linters
Pre-commit hooks will run `ruff`, `flake8`, `mypy`, `pyright`, and `unittest` on each commit.

In both the CI and githooks, we use both `ruff` and `flake8`.
This is mostly to ensure and test how both linters react to the pipe syntax
and better document in the [README.md](README.md)] the required setups.
### Linters

The same goes for `mypy`.
In both the CI and githooks, we use both `ruff` and `flake8`, and both `mypy` and `pyright`.
This is mostly to ensure that our implementation is compatible with the most common
linters and type checkers.

### CI/CD

We use GitHub actions to verify, build, and deploy the application. We currently have:

- [code_quality](.github/workflows/code_quality.yml): runs `ruff`, `flake8`, `mypy`, and `coverage` on Python 3.12
- [code_quality](.github/workflows/code_quality.yml): runs `ruff`, `flake8`, `mypy`, `pyright`, and `coverage` on Python 3.12
- [tests](.github/workflows/tests.yml): runs unittests on multiple Python versions (from 3.9 to 3.12)
- [update_deps](.github/workflows/update_deps.yml): updates the dependencies (as `dependabot` does not support `uv` yet)

0 comments on commit fca56d2

Please sign in to comment.