selectLinters: List of linters to check INWT style conventions

View source: R/02_checkStyle.R

selectLintersR Documentation

List of linters to check INWT style conventions

Description

Used in checkStyle.

If you want to customize the set of tested linters, you can

  • Specify the file type ("script" or "pkgFuns") to add linters

  • exclude particular linters to the default linter set via excludeLinters

  • add linters via addLinters

excludeLinters is evaluated in the end, i.e., it affects all linters included by default, file type, or addLinters.

Usage

selectLinters(type = NULL, excludeLinters = list(), addLinters = list())

Arguments

type

character: Type of the file ("script", "pkgFuns", or NULL)

excludeLinters

character vector: Names of linters to be excluded

addLinters

list: Named list of linter functions to be added

Details

The following linters are always included:

  • function_argument_linter,

  • assignment_linter,

  • commas_linter,

  • double_space_linter,

  • infix_spaces_linter,

  • undesirable_operator_linter,

  • line_length_linter,

  • whitespace_linter,

  • object_length_linter,

  • options_linter,

  • spaces_left_parentheses_linter,

  • trailing_blank_lines_linter,

  • trailing_whitespaces_linter,

The following linters are only included if type = "pkgFuns":

  • setwd_linter,

  • source_linter

The following linters are only included if type = "script":

  • (currently empty)

Value

Named list of linter functions

Examples

selectLinters(type = "script",
            excludeLinters = c("object_length_linter", "function_argument_linter"),
            addLinters = list(setwd_l = setwd_linter,
                              source_l = source_linter))

# Code listing tested linters:
linterNames <- sort(names(selectLinters()))
packages <- unlist(lapply(linterNames,
                          function(name) {
                            erg <- help.search(name)
                            erg$matches$Package
                          }))
# nolint start
cat("#' \\itemize{\n#'",
    paste0("  \\item\\code{\\link[", packages, "]{", linterNames, "}}",
           collapse = ",\n#' "), "\n#' }")
# nolint end


INWT/INWTUtils documentation built on May 22, 2024, 4:45 p.m.