From 054a65481fe1235eabcf9e29683ff91d84139b7d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:16:47 +0200 Subject: [PATCH] Update Ruff and pre-commit --- .pre-commit-config.yaml | 10 +++++----- pyproject.toml | 9 ++++++--- src/norwegianblue/__init__.py | 1 + src/norwegianblue/_cache.py | 1 + tests/test_cache.py | 1 + tests/test_norwegianblue.py | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69afdef..e324534 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.2.1 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] + args: [--exit-non-zero-on-fix] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 + rev: 24.2.0 hooks: - id: black @@ -43,13 +43,13 @@ repos: # ] - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.5.3 + rev: 1.7.0 hooks: - id: pyproject-fmt additional_dependencies: [tox] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.15 + rev: v0.16 hooks: - id: validate-pyproject diff --git a/pyproject.toml b/pyproject.toml index 40a97c4..0abd341 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,19 +67,22 @@ version.source = "vcs" local_scheme = "no-local-version" [tool.ruff] -line-length = 88 +fix = true + +[tool.ruff.lint] select = [ + "C4", # flake8-comprehensions "E", # pycodestyle errors "EM", # flake8-errmsg "F", # pyflakes errors "I", # isort "ISC", # flake8-implicit-str-concat + "LOG", # flake8-logging "PGH", # pygrep-hooks "RUF100", # unused noqa (yesqa) "UP", # pyupgrade "W", # pycodestyle warnings "YTT", # flake8-2020 - # "LOG", # TODO: enable flake8-logging when it's not in preview anymore ] extend-ignore = [ "E203", # Whitespace before ':' @@ -88,7 +91,7 @@ extend-ignore = [ "E241", # Multiple spaces after ',' ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["norwegianblue"] required-imports = ["from __future__ import annotations"] diff --git a/src/norwegianblue/__init__.py b/src/norwegianblue/__init__.py index 63ecb95..1e70c9f 100644 --- a/src/norwegianblue/__init__.py +++ b/src/norwegianblue/__init__.py @@ -2,6 +2,7 @@ Python interface to endoflife.date API https://endoflife.date/docs/api/ """ + from __future__ import annotations import datetime as dt diff --git a/src/norwegianblue/_cache.py b/src/norwegianblue/_cache.py index b6f098c..56b72b6 100644 --- a/src/norwegianblue/_cache.py +++ b/src/norwegianblue/_cache.py @@ -1,6 +1,7 @@ """ Cache functions """ + from __future__ import annotations import datetime as dt diff --git a/tests/test_cache.py b/tests/test_cache.py index 9aa2f43..c0d2725 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -1,6 +1,7 @@ """ Unit tests for norwegianblue cache """ + from __future__ import annotations import tempfile diff --git a/tests/test_norwegianblue.py b/tests/test_norwegianblue.py index c5bdd96..368e2b3 100644 --- a/tests/test_norwegianblue.py +++ b/tests/test_norwegianblue.py @@ -1,6 +1,7 @@ """ Unit tests for norwegianblue """ + from __future__ import annotations import json