Add Jupyter Notebook usage with `pre-commit` in docs (#5666)

Similar to https://github.com/astral-sh/ruff-pre-commit/pull/45
This commit is contained in:
Dhruv Manilawala 2023-07-11 00:47:05 +05:30 committed by GitHub
parent 14f2158e5d
commit 93bfa239b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,17 @@ Or, to enable autofix:
args: [ --fix, --exit-non-zero-on-fix ] args: [ --fix, --exit-non-zero-on-fix ]
``` ```
Or, to run the hook on Jupyter Notebooks too:
```yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.277
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
```
Ruff's pre-commit hook should be placed after other formatting tools, such as Black and isort, Ruff's pre-commit hook should be placed after other formatting tools, such as Black and isort,
_unless_ you enable autofix, in which case, Ruff's pre-commit hook should run _before_ Black, isort, _unless_ you enable autofix, in which case, Ruff's pre-commit hook should run _before_ Black, isort,
and other formatting tools, as Ruff's autofix behavior can output code changes that require and other formatting tools, as Ruff's autofix behavior can output code changes that require