Where can the .lintr config file be located?

1.8k Views Asked by At

The R package lintr checks files for "lint" (errors or style violations). It can be configured with a .lintr file. Where can that file be located? I was hoping to put it at the top of my git repo, but that doesn't seem to be working when I run in RStudio.

Note: the RStudio project is below the top level of the git repo. Perhaps that means lintr in RStudio won't look in parent directories? What's the right thing to do then? Soft-link it into the project directory?

EDIT: To reproduce:

  • create a project in RStudio from a directory called proj1
  • make a file foo.R with a lint violation: a=1
  • run lintr::lint('foo.R') in the RStudio console to see the lint errors
  • make a .lintr in proj1 that turns off the lintr: exclusions: ('foo.R')
  • run lintr::lint('foo.R') in the RStudio console to see the error goes away
  • move .lintr one directory up (outside of the project, but in a parent directory)
  • run lintr::lint('foo.R') in the RStudio console to see the lint problems returned

EDIT 2: I ended up soft-linking the top-level .lintr in every directory where I need it.

FYI my lintr version is 1.0.3 and R version is 3.5.2.

0

There are 0 best solutions below