diff --git a/R/settings.R b/R/settings.R index 942e44ca0..b9df6f9d2 100644 --- a/R/settings.R +++ b/R/settings.R @@ -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) { diff --git a/R/zzz.R b/R/zzz.R index a659a5d1b..fb382dccb 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -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 diff --git a/man/default_settings.Rd b/man/default_settings.Rd index 716c597ec..2ba416b22 100644 --- a/man/default_settings.Rd +++ b/man/default_settings.Rd @@ -11,7 +11,39 @@ An object of class \code{list} of length 12. default_settings } \description{ -Default lintr settings +The default settings consist of +\itemize{ +\item \code{linters}: a list of default linters (see \code{\link[=default_linters]{default_linters()}}) +\item \code{encoding}: the character encoding assumed for the file +\item \code{exclude}: pattern used to exclude a line of code +\item \code{exclude_start}, \code{exclude_end}: patterns used to mark start and end of the code block to exclude +\item \code{exclude_linter}, \code{exclude_linter_sep}: patterns used to exclude linters +\item \code{exclusions}:a list of files to exclude +\item \code{cache_directory}: location of cache directory +\item \code{comment_token}: a GitHub token character +\item \code{comment_bot}: decides if lintr comment bot on GitHub can comment on commits +\item \code{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{ \code{\link[=read_settings]{read_settings()}}, \link{default_linters}