From f448dca87af5a377ea37a1202c57c6f4684cbac2 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Sun, 15 Sep 2024 07:55:24 -0400 Subject: [PATCH] Move most ruff exclusions out of .pre-commit-config.yaml This makes it easier to run 'ruff check' outside of the pre-commit hooks. --- .pre-commit-config.yaml | 11 ++--------- doc/data/ruff.toml | 15 ++++++++++----- pyproject.toml | 7 +++++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51db1e8761..8ba43e7e8e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,17 +21,10 @@ repos: hooks: - id: ruff args: ["--fix"] - exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/ + exclude: doc/data/messages - id: ruff name: ruff-doc files: doc/data/messages - exclude: | - (?x)^( - doc/data/messages/d/duplicate-argument-name/bad.py| - doc/data/messages/s/syntax-error/bad.py - )$ - - args: ["--config", "doc/data/ruff.toml"] - repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit rev: 0.1.2 hooks: @@ -49,7 +42,7 @@ repos: hooks: - id: black args: [--safe, --quiet] - exclude: *fixtures + exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/ - id: black name: black-doc args: [--safe, --quiet] diff --git a/doc/data/ruff.toml b/doc/data/ruff.toml index 8f18380cc2..2ad67f6753 100644 --- a/doc/data/ruff.toml +++ b/doc/data/ruff.toml @@ -2,14 +2,19 @@ # (Because of horizontal scrolling) line-length = 103 +extend-exclude = [ + "messages/d/duplicate-argument-name/bad.py", + "messages/s/syntax-error/bad.py", +] + [lint] ignore = [] select = ["E501", "I"] [lint.per-file-ignores] -"doc/data/messages/r/reimported/bad.py" = ["I"] -"doc/data/messages/w/wrong-import-order/bad.py" = ["I"] -"doc/data/messages/u/ungrouped-imports/bad.py" = ["I"] -"doc/data/messages/m/misplaced-future/bad.py" = ["I"] -"doc/data/messages/m/multiple-imports/bad.py" = ["I"] +"messages/m/misplaced-future/bad.py" = ["I"] +"messages/m/multiple-imports/bad.py" = ["I"] +"messages/r/reimported/bad.py" = ["I"] +"messages/u/ungrouped-imports/bad.py" = ["I"] +"messages/w/wrong-import-order/bad.py" = ["I"] diff --git a/pyproject.toml b/pyproject.toml index 6323d39460..b244f62e70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -145,6 +145,13 @@ module = [ # (for docstrings, strings and comments in particular). line-length = 115 +extend-exclude = [ + "tests/**/data/", + "tests/**/functional/", + "tests/input/", + "tests/regrtest_data/", +] + [tool.ruff.lint] select = [ "B", # bugbear