quarto-dev / quarto-dev/quarto-cli
[lint] Inform users when setup chunk is present in unexpected location
@cscheid is already working on this.
Since Sep 9, 2025.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
When interactively executing chunks within the RStudio IDE, RStudio will also look for and execute a chunk with the label "setup". The intention here is to better facilitate interactive analysis, where the setup chunk might be responsible for loading required packages, loading datasets, and other similar operations. (For motivation -- this session state might be lost after a session restart, or in other scenarios, so we wanted a light-weight way to get the user back to the "ready" state.)
However, RStudio doesn't currently verify that the setup chunk is the first chunk in the document, and so this can lead to an unexpected user experience wherein the chunk called setup, regardless where it lives in the document, gets executed before any other chunk in the document is run.
This seems like a potential candidate for the Quarto linter? That is, it might be worth verifying -- If there is an R chunk called "setup", it should be the first chunk in the document.
See also:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.