-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Copy-pasting my comment from #3792 below. Since Ruff already supports Jupyter notebooks, and Quarto is a plaintext equivalent of notebooks, it should hopefully be (relatively) easy to add support. The holy grail would be if the VS Code extension can highlight linting errors in the code blocks in an open .qmd
file, but even just CLI support would be great to have as a start.
Chiming in here to ask if the development of this feature can also take Quarto (.qmd) into consideration. It's a great project aimed at providing a plaintext equivalent of Jupyter notebooks.
Hopefully, adding support shouldn't be too complicated because, like (vanilla) Markdown, .qmd files denote Python blocks explicitly, albeit with a slightly different syntax:
# This is a Markdown heading
This is regular text.
```{python}
#| echo: false
# This is a Python comment
print("Hello, Ruff!")
```
The #| echo: false
at the top is a Quarto-specific comment that controls its behaviour. See here. I don't imagine Ruff necessarily cares about specially formatted comments, though maybe it'll become relevant if you add formatting as a core functionality, a la #1904.
Unlike Markdown, and like Jupyter notebooks, Quarto documents "carry the context throughout the file" -- so adding support should hopefully just be a matter of treating the code blocks as a single Python script, while ignoring any Markdown outside of those blocks.