Skip to content

check_lintr how to deal with renv folder in some arbitray subfolder #118

@hansvancalster

Description

@hansvancalster

Problem:

check_lintr() calls https://github.com/inbo/checklist/blob/3413f5fec507f8039063f7573fabc0e1bc20adab/R/check_lintr.R#L21C16-L21C16
which forces the function to use the hard coded linter options which are delivered with the checklist package. These lintr options include exclusion of lintr checks for folders renv and packrat directly beneath the root of the project.

We have a git version controlled repository (created with checklist::create_project) where we want renv package management only for code belonging to a specific analysis pipeline created with the targets package. We would therefore need a way to tell checklist::check_lintr() to exclude that renv folder, which is in our case in a subfolder like so: source/targets/pipeline1/renv.

Possible solutions?

  • delete the line where check_lintr() calls https://github.com/inbo/checklist/blob/3413f5fec507f8039063f7573fabc0e1bc20adab/R/check_lintr.R#L21C16-L21C16? This option is already in our Rprofile.site. In that way, we can set a project specific .lintr config file ourselves and add the renv folder paths to the exclusions list
  • keep the line, but execute it conditionally based on an the value of an extra argument to check_lintr to use the checklist .lintr config file or not
  • add extra lines of code to search for any renv or packrat folders and exclude them all by passing them to the exclusions argument of lintr::lint_dir(..., exclusions = list("source/targets/pipeline1/renv)) (which is called by checklist::check_dir()).

I think the last approach is the best for this particular problem.

tagging @EmmaCartuyvels1 and @wlangera so they can follow along.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions