From 219dacffaa79ec8af2ff62e92eac3788e48afa49 Mon Sep 17 00:00:00 2001 From: Konrad Rudolph Date: Thu, 3 Nov 2022 23:07:22 +0100 Subject: [PATCH] Document changes --- NEWS.md | 3 +++ vignettes/lintr.Rmd | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c12a0f0021..b189a74521 100644 --- a/NEWS.md +++ b/NEWS.md @@ -74,6 +74,9 @@ * Added check for `.lintr` configuration file in the `.github/linters` project sub folder. This is to improve compatibility with Super-Linter(#1746, @tonyk7440) +* The {lintr} configuration file is now searched in the system's user configuration path; the lintr config filename can + also be configured explicitly by setting the environment variable `R_LINTR_LINTER_FILE` (#460, @klmr) + ### New linters * `unnecessary_lambda_linter()`: detect unnecessary lambdas (anonymous functions), e.g. diff --git a/vignettes/lintr.Rmd b/vignettes/lintr.Rmd index c28726ad4c..77bc1a2ba9 100644 --- a/vignettes/lintr.Rmd +++ b/vignettes/lintr.Rmd @@ -91,11 +91,12 @@ exclusions: list( More generally, `lintr` searches for a settings file according to following prioritized list. The first one found, if any, will be used. -1. If `options(lintr.linter_file)` is an absolute path, this file will be used. The default for this option is `".lintr"`. +1. If `options(lintr.linter_file)` is an absolute path, this file will be used. The default for this option is `".lintr"` or the value of the environment variable `R_LINTR_LINTER_FILE`, if set. 2. A linter file (that is a file named like `lintr.linter_file`) in the currently searched directory, i.e. the directory of the file passed to `lint()`. When run from `lint_package()`, this directory can differ for each linted file. 3. A linter file in a parent directory of the currently-searched directory, starting from the deepest path, moving upwards one level at a time. 4. A linter file in the user's `HOME` directory. 5. A linter file in the `.github/linters` child directory of the currently-search directory. +6. A linter file called `config` in the user's configuration path (given by `tools::R_user_dir("lintr", which = "config")`). If no linter file is found, only default settings take effect (see [defaults](#defaults)).