diff --git a/docs/configuration.md b/docs/configuration.md index 6fe954c38f..68de7de259 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -219,6 +219,28 @@ extend-include = ["*.ipynb"] This will prompt Ruff to discover Jupyter Notebook (`.ipynb`) files in any specified directories, then lint and format them accordingly. +If you'd prefer to either only lint or only format Jupyter Notebook files, you can use the +section specific `exclude` option to do so. For example, the following would only lint Jupyter +Notebook files and not format them: + +```toml +[tool.ruff] +extend-include = ["*.ipynb"] + +[tool.ruff.format] +exclude = ["*.ipynb"] +``` + +And, conversely, the following would only format Jupyter Notebook files and not lint them: + +```toml +[tool.ruff] +extend-include = ["*.ipynb"] + +[tool.ruff.lint] +exclude = ["*.ipynb"] +``` + Alternatively, pass the notebook file(s) to `ruff` on the command-line directly. For example, `ruff check /path/to/notebook.ipynb` will always lint `notebook.ipynb`. Similarly, `ruff format /path/to/notebook.ipynb` will always format `notebook.ipynb`.