lintr icon indicating copy to clipboard operation
lintr copied to clipboard

library_call_linter() should exempt header boilerplate in Rmd

Open MichaelChirico opened this issue 2 years ago • 0 comments

Originally posted by @MichaelChirico in https://github.com/r-lib/lintr/pull/2152#discussion_r1323530530

It's very common to start an Rmd vignette with an include=FALSE header setting up metadata:

```{r setup, include=FALSE}
knitr::opts_chunk$set(...)
```

```{r first_visible_cell}
library(my.pkg)
```

But library_call_linter() lints this. The right approach is probably to exclude certain calls preceding the first library().

I've also wondered if commandArgs(TRUE) / options parsing must come after the library() calls.

MichaelChirico avatar Sep 12 '23 20:09 MichaelChirico