Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
Expand All @@ -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: []
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"] },
]
```

Expand Down