From 70f83c01ba1b060eb3ee7ac6ace09e26dd8803a9 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:15:07 +0200 Subject: [PATCH 1/4] Apply repo-review rule RF003 RF003: src directory doesn't need to be specified anymore (0.6+) Ruff now (0.6+) looks in the src directory by default. The src setting doesn't need to be specified if it's just set to `["src"]`. --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b97ad293..5cb0b6b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,6 @@ dynamic = [ [tool.ruff] fix = true -src = ["src"] extend-exclude = [ "noxfile.py", "docs/*" From b5fdceec83d609592b23df376fe7a143de997bc0 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:20:23 +0200 Subject: [PATCH 2/4] Ignore lint rules conflicting with the formatter https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules Also enable flake8-implicit-str-concat (ISC) rules, they are quite useful. Unfortunately, ISC001 and ISC002 are not fully compatible with the formatter. Run them manually from time to time... --- pyproject.toml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5cb0b6b4..28ccbde8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,10 +40,21 @@ select = [ "F", "W", "I", + "ISC", "D", ] ignore = [ - "D105", "D203", "D213", "E501" + "D105", + "D203", + "D213", + # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules + "W191", + "E111", + "E114", + "E117", + "ISC001", + "ISC002", + "E501", ] [tool.ruff.lint.per-file-ignores] From a7021bfffefbda4ec5851c2a0cce89c554c791a2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:38:22 +0200 Subject: [PATCH 3/4] Apply repo-review rule MY103 MY103: MyPy warn unreachable Must have `warn_unreachable` (true/false) to pass this check. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 28ccbde8..c67818d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ exclude_lines = [ [tool.mypy] files = "src,tools" strict = true +warn_unreachable = true enable_error_code = [ "ignore-without-code", "redundant-expr", From 3d47afba75f7786add71db1e15806adf804a90db Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:40:17 +0200 Subject: [PATCH 4/4] Consistent versions in pre-comit config file Follow the style of the pre-commit doc itself: https://pre-commit.com/#2-add-a-pre-commit-configuration --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3bfe680c..8a4c6aba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.11.2" + rev: v1.11.2 hooks: - id: mypy additional_dependencies: @@ -8,7 +8,7 @@ repos: exclude: docs/.*|tests/.*|noxfile.py - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.6.0" + rev: v4.6.0 hooks: - id: check-builtin-literals - id: check-added-large-files @@ -21,7 +21,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/adamchainz/blacken-docs - rev: "1.18.0" + rev: 1.18.0 hooks: - id: blacken-docs