read_settings: Read lintr settings

View source: R/settings.R

read_settingsR Documentation

Read lintr settings

Description

Lintr searches for settings for a given source file in the following order:

  1. options defined as linter.setting.

  2. linter_file in the same directory

  3. linter_file in the project directory

  4. linter_file in the user home directory

  5. default_settings()

Usage

read_settings(filename)

Arguments

filename

source file to be linted

Details

The default linter_file name is .lintr but it can be changed with option lintr.linter_file or the environment variable R_LINTR_LINTER_FILE This file is a DCF file, see base::read.dcf() for details. Experimentally, we also support keeping the config in a plain R file. By default we look for a file named '.lintr.R' (in the same directories where we search for '.lintr'). We are still deciding the future of config support in lintr, so user feedback is welcome. The advantage of R is that it maps more closely to how the configs are actually stored, whereas the DCF approach requires somewhat awkward formatting of parseable R code within valid DCF key-value pairs. The main disadvantage of the R file is it might be too flexible, with users tempted to write configs with side effects causing hard-to-detect bugs or like YAML could work, but require new dependencies and are harder to parse both programmatically and visually.


lintr documentation built on May 29, 2024, 11:31 a.m.