File tree 1 file changed +22
-0
lines changed 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,28 @@ extend-include = ["*.ipynb"]
219
219
This will prompt Ruff to discover Jupyter Notebook (` .ipynb ` ) files in any specified
220
220
directories, then lint and format them accordingly.
221
221
222
+ If you'd prefer to either only lint or only format Jupyter Notebook files, you can use the
223
+ section specific ` exclude ` option to do so. For example, the following would only lint Jupyter
224
+ Notebook files and not format them:
225
+
226
+ ``` toml
227
+ [tool .ruff ]
228
+ extend-include = [" *.ipynb" ]
229
+
230
+ [tool .ruff .format ]
231
+ exclude = [" *.ipynb" ]
232
+ ```
233
+
234
+ And, conversely, the following would only format Jupyter Notebook files and not lint them:
235
+
236
+ ``` toml
237
+ [tool .ruff ]
238
+ extend-include = [" *.ipynb" ]
239
+
240
+ [tool .ruff .lint ]
241
+ exclude = [" *.ipynb" ]
242
+ ```
243
+
222
244
Alternatively, pass the notebook file(s) to ` ruff ` on the command-line directly. For example,
223
245
` ruff check /path/to/notebook.ipynb ` will always lint ` notebook.ipynb ` . Similarly,
224
246
` ruff format /path/to/notebook.ipynb ` will always format ` notebook.ipynb ` .
You can’t perform that action at this time.
0 commit comments