Skip to content

Commit

Permalink
Document default settings (#1648)
Browse files Browse the repository at this point in the history
* get started

* Document default settings

Closes #823

* fix grammar

* pass a vector of element names instead
  • Loading branch information
IndrajeetPatil authored Oct 9, 2022
1 parent 854b2c7 commit 16e8576
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ get_encoding_from_dcf <- function(file) {
)

if (!is.null(encodings)) {
# Produces a warning in R <= 3.5 if encodings is NULL
# Produces a warning in R <= 3.5 if encoding is NULL
encodings <- encodings[!is.na(encodings)]
}
if (length(encodings) > 0L) {
Expand Down
34 changes: 34 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,40 @@ default_undesirable_operators <- all_undesirable_operators[names(all_undesirable
)]

#' Default lintr settings
#'
#' @description
#' The default settings consist of
#'
#' - `linters`: a list of default linters (see [default_linters()])
#' - `encoding`: the character encoding assumed for the file
#' - `exclude`: pattern used to exclude a line of code
#' - `exclude_start`, `exclude_end`: patterns used to mark start and end of the code block to exclude
#' - `exclude_linter`, `exclude_linter_sep`: patterns used to exclude linters
#' - `exclusions`:a list of files to exclude
#' - `cache_directory`: location of cache directory
#' - `comment_token`: a GitHub token character
#' - `comment_bot`: decides if lintr comment bot on GitHub can comment on commits
#' - `error_on_lint`: decides if error should be produced when any lints are found
#'
#' @examples
#' # available settings
#' names(default_settings)
#'
#' # linters included by default
#' names(default_settings$linters)
#'
#' # default values for a few of the other settings
#' default_settings[c(
#' "encoding",
#' "exclude",
#' "exclude_start",
#' "exclude_end",
#' "exclude_linter",
#' "exclude_linter_sep",
#' "exclusions",
#' "error_on_lint"
#' )]
#'
#' @seealso [read_settings()], [default_linters]
#' @export
default_settings <- NULL
Expand Down
34 changes: 33 additions & 1 deletion man/default_settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16e8576

Please sign in to comment.