Skip to content

Commit

Permalink
Updated pre-commit config, fix ruff rules
Browse files Browse the repository at this point in the history
Use the same ruff version as for devenv, so results will be the same in
CI as locally.
Updated deprecated ruff options.
  • Loading branch information
kissgyorgy committed Nov 18, 2024
1 parent 9c58952 commit 2aa8a3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --all-extras
- name: Pre-commit checks
run: |
poetry run pre-commit run -a
poetry run -- pre-commit run --config .pre-commit-ci.yaml --all-files
- name: Test
run: |
poetry run pytest
8 changes: 3 additions & 5 deletions .pre-commit-config.yaml → .pre-commit-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ".*\\.md"
Expand All @@ -13,13 +13,11 @@ repos:
- id: check-added-large-files

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.2"
rev: "v0.7.3"
hooks:
- id: ruff
name: Check python (ruff)
args: [--show-source, --fix, --show-fixes, --exit-non-zero-on-fix]
- id: ruff-format
name: Format python (ruff)
args: [--config, pyproject.toml]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
Expand Down
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py311"

[tool.ruff.lint]
select = [
"C90", # mccabe
"C4", # flake8-comprehensions
Expand All @@ -56,13 +57,5 @@ ignore = [
"RUF012", # mutable-class-default: Wants to annotate things like `__mapper_args__` with `ClassVar`, producing noise
]

# Do not remove unused imports automatically in __init__.py files
ignore-init-module-imports = true

[tool.ruff.per-file-ignores]
"*/__init__.py" = [
"F401"
]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 5

0 comments on commit 2aa8a3f

Please sign in to comment.