From 63f7cce2daaa4ffa6660061b1a47a8573af7143b Mon Sep 17 00:00:00 2001 From: Max R Date: Mon, 16 Mar 2026 09:44:47 -0400 Subject: [PATCH] Add 'pyproject' to types_or for ruff checks --- .pre-commit-hooks.yaml | 4 ++-- README.md | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 4d17023..edbbf04 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,7 +3,7 @@ description: "Run 'ruff check' for extremely fast Python linting" entry: ruff check --force-exclude language: python - types_or: [python, pyi, jupyter] + types_or: [python, pyi, jupyter, pyproject] args: [] require_serial: true additional_dependencies: [] @@ -26,7 +26,7 @@ description: "Run 'ruff check' for extremely fast Python linting" entry: ruff check --force-exclude language: python - types_or: [python, pyi, jupyter] + types_or: [python, pyi, jupyter, pyproject] args: [] require_serial: true additional_dependencies: [] diff --git a/README.md b/README.md index 340ed21..1c08867 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ repos: - id: ruff-format ``` +By default, `ruff-check` applies to Python files, stub files, Jupyter Notebooks, and `pyproject.toml`. +`ruff-format` applies to Python files, stub files, and Jupyter Notebooks. + To avoid running on Jupyter Notebooks, remove `jupyter` from the list of allowed filetypes: ```yaml @@ -53,7 +56,7 @@ repos: hooks: # Run the linter. - id: ruff-check - types_or: [ python, pyi ] + types_or: [ python, pyi, pyproject ] args: [ --fix ] # Run the formatter. - id: ruff-format @@ -82,10 +85,10 @@ repo = "https://github.com/astral-sh/ruff-pre-commit" rev = "v0.15.0" # Ruff version. hooks = [ # Run the linter. - { id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi"] }, + { id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi", "jupyter", "pyproject"] }, # Run the formatter. - { id = "ruff-format", types_or = ["python", "pyi"] }, + { id = "ruff-format", types_or = ["python", "pyi", "jupyter"] }, ] ```