-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example config files to the docs #2312
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,26 @@ | |
#' 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. | ||
#' Here is an example of a `.lintr` file: | ||
#' | ||
#' ```dcf | ||
#' linters: linters_with_defaults( | ||
#' any_duplicated_linter(), | ||
#' any_is_na_linter(), | ||
#' backport_linter("oldrel-4", except = c("R_user_dir", "str2lang")), | ||
#' line_length_linter(120), | ||
#' missing_argument_linter(), | ||
#' unnecessary_concatenation_linter(allow_single_expression = FALSE), | ||
#' yoda_test_linter() | ||
#' ) | ||
#' exclusions: list( | ||
#' "inst/doc/creating_linters.R" = 1, | ||
#' "inst/example/bad.R", | ||
#' "tests/testthat/default_linter_testcode.R", | ||
#' "tests/testthat/dummy_packages" | ||
#' ) | ||
#' ``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not aligned to the opening fence. |
||
#' | ||
#' 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. | ||
|
@@ -20,6 +40,25 @@ | |
#" otherwise "abusing" the ability to evaluate generic R code. Other recursive key-value stores | ||
#' like YAML could work, but require new dependencies and are harder to parse | ||
#' both programmatically and visually. | ||
#' Here is an example of a `.lintr.R` file: | ||
#' | ||
#' ```r | ||
#' linters <- linters_with_defaults( | ||
#' any_duplicated_linter(), | ||
#' any_is_na_linter(), | ||
#' backport_linter("oldrel-4", except = c("R_user_dir", "str2lang")), | ||
#' line_length_linter(120), | ||
#' missing_argument_linter(), | ||
#' unnecessary_concatenation_linter(allow_single_expression = FALSE), | ||
#' yoda_test_linter() | ||
#' ) | ||
#' exclusions <- list( | ||
#' "inst/doc/creating_linters.R" = 1, | ||
#' "inst/example/bad.R", | ||
#' "tests/testthat/default_linter_testcode.R", | ||
#' "tests/testthat/dummy_packages" | ||
#' ) | ||
#' ``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
#' @param filename Source file to be linted. | ||
read_settings <- function(filename) { | ||
reset_settings() | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
120L
?