Learn R Programming

roger (version 1.5-1)

all_style: Validation Using All Style Linters

Description

Check the style of code using all available linters.

Usage

all_style(srcData, include, exclude, ...)

Value

A named list with the results of the linters.

Arguments

srcData

a list as returned by getSourceData.

include, exclude

character vector of linters to use or to omit, respectively. If both arguments are unspecified or NULL, all available linters are used.

...

further arguments passed to linters when appropriately named.

Details

The complete list of available style linters is as follows:

  • assignment_style

  • close_brace_style

  • close_bracket_style

  • close_parenthesis_style

  • commas_style

  • comments_style

  • left_parenthesis_style

  • line_length_style

  • nomagic_style

  • open_brace_style

  • open_brace_unique_style

  • open_bracket_style

  • open_parenthesis_style

  • ops_spaces_style

  • trailing_blank_lines_style

  • trailing_whitespace_style

  • unneeded_concatenation_style

Examples

Run this code
## Keep parse data in non interactive sessions.
if (!interactive())
    op <- options(keep.source = TRUE)

fil <- tempfile(fileext = ".R")
cat("x <- c(2, 3, 5)", "crossprod(2,", "x)",
    "a <- array(1:24, 2:4)", "a[1, , ]",
    file = fil, sep = "\n")

all_style(getSourceData(fil))
all_style(getSourceData(fil), include = c("commas", "nomagic"))
all_style(getSourceData(fil), include = c("commas", "nomagic"),
          ignore.also = 5)
all_style(getSourceData(fil), exclude = "nomagic")

Run the code above in your browser using DataLab