Skip to content
Draft
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: 7 additions & 7 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MPL-2.0

name: |
(CI) Pre-commit
(CI) prek
permissions:
contents: read
pull-requests: write
Expand All @@ -19,7 +19,7 @@ on:


jobs:
pre-commit:
prek:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -31,12 +31,12 @@ jobs:
- name: Install Poetry
if: ${{ hashFiles('.pre-commit-config.yaml') != '' }}
run: pipx install --python python${{ inputs.python-version }} poetry
- name: Install pre-commit
- name: Install prek
if: ${{ hashFiles('.pre-commit-config.yaml') != '' }}
run: |
pip install pre-commit
pre-commit install
- name: Run pre-commit
pip install prek
prek install
- name: Run prek
if: ${{ hashFiles('.pre-commit-config.yaml') != '' }}
shell: bash
run: pre-commit run -a
run: prek run -a
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# SPDX-License-Identifier: MPL-2.0

# This pre-commit config can be installed by running
# 'pip install pre-commit'.
# 'pre-commit install'.
# This prek config can be installed by running
# 'pip install prek'.
# 'prek install'.
repos:
- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
rev: v0.9.0
Expand All @@ -18,7 +18,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.1
rev: v0.15.6
hooks:
# Run the linter.
- id: ruff
Expand All @@ -36,14 +36,14 @@ repos:

# Check commit messages for conventional commits formatting.
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.3.0
rev: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
# Fix common spelling mistakes
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
exclude: "pyproject.toml|poetry.lock|docs/theoretical_documentation/model.md|docs/examples/"
Expand All @@ -57,7 +57,7 @@ repos:

# Linter for markdown files.
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
rev: v0.48.0
hooks:
- id: markdownlint
args: ["--ignore", "docs/theoretical_documentation/model.md"]
14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ the following for details on how to contribute:
- for contributions to the documentation page, make sure you install
the correct dependencies using `poetry install --with docs`, too.
4. Activate the poetry shell: `poetry shell`.
5. Set up pre-commit hooks: `pre-commit install`. Every time you commit, this
5. Set up prek hooks: `prek install`. Every time you commit, this
will run hooks to ensure your code is properly formatted.
6. Make a new branch from `main`
- If your branch will be related to a Jira ticket (which we recommend), you
Expand All @@ -57,13 +57,15 @@ the following for details on how to contribute:

### During development

To check if `pre-commit` was properly installed, run `pre-commit run -a`. You
To check if `prek` was properly installed, run `prek run -a`. You
should see the following:

```bash
$ pre-commit run -a
ruff.....................................................................Passed
ruff-format..............................................................Passed
$ prek run -a
pre-commit-update........................................................Passed
reuse lint...............................................................Passed
ruff (legacy alias)......................................................Passed
ruff format..............................................................Passed
mypy.....................................................................Passed
codespell................................................................Passed
Poetry check.............................................................Passed
Expand Down Expand Up @@ -159,7 +161,7 @@ changes in the squashed commit, which is also fine.

So, in short:

1. Run `pre-commit -a` locally.
1. Run `prek -a` locally.
2. Run `pytest` locally.
3. Check your local commit messages before pushing.
4. `git push`
Expand Down
125 changes: 25 additions & 100 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ pytest = "^9.0.2"
ruff = "^0.15.1"
mypy = "^1.18.0"
pytest-cov = "^7.0.0"
pre-commit = "^4.1.0"
codespell = "^2.4.1"
ipython = "^9.3.0"
isort = "^7.0.0"
mutmut = "^3.3.1"
prek = "^0.3.5"

[tool.poetry.group.docs]
optional = true
Expand Down
Loading