From 93bfa239b71bc7e53a3ffc65764231811dc7a34d Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Tue, 11 Jul 2023 00:47:05 +0530 Subject: [PATCH] Add Jupyter Notebook usage with `pre-commit` in docs (#5666) Similar to https://github.com/astral-sh/ruff-pre-commit/pull/45 --- docs/usage.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/usage.md b/docs/usage.md index 1a84c8eddd..2e1d4d77d2 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -38,6 +38,17 @@ Or, to enable autofix: 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, _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