Package 'styler.quote'

Title: Third-party Style Guide For 'quote' Style
Description: Styles code according to the 'quote' style using 'styler'.
Authors: Christopher T. Kenny [aut, cre]
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-09-27 03:28:16 UTC
Source: https://github.com/christopherkenny/styler.quote

Help Index


The quote style

Description

Style code according to the quote style guide. For more details and docs, see the styler::tidyverse_style().

Usage

quote_style(
  scope = "tokens",
  strict = TRUE,
  indent_by = 2,
  start_comments_with_one_space = FALSE,
  reindention = tidyverse_reindention(),
  math_token_spacing = tidyverse_math_token_spacing()
)

Arguments

scope

The extent of manipulation. Can range from "none" (least invasive) to "tokens" (most invasive). See 'Details'. This argument is a string or a vector of class AsIs.

strict

A logical value indicating whether a set of strict or not so strict transformer functions should be returned. Compare the functions returned with or without strict = TRUE. For example, strict = TRUE means force one space e.g. after "," and one line break e.g. after a closing curly brace. strict = FALSE means to set spaces and line breaks to one if there is none and leave the code untouched otherwise. See 'Examples'.

indent_by

How many spaces of indention should be inserted after operators such as '('.

start_comments_with_one_space

Whether or not comments should start with only one space (see start_comments_with_space()).

reindention

A list of parameters for regex re-indention, most conveniently constructed using specify_reindention().

math_token_spacing

A list of parameters that define spacing around math token, conveniently constructed using specify_math_token_spacing().

Examples

style_text('call( 1)', scope = 'spaces')

Like styler::style_dir(), but style defaulting to quote_style

Description

See styler::style_dir() for details, examples and more.

Usage

style_dir(
  path = ".",
  ...,
  style = quote_style,
  transformers = style(...),
  filetype = c("R", "Rprofile"),
  recursive = TRUE,
  exclude_files = NULL,
  exclude_dirs = c("packrat", "renv"),
  include_roxygen_examples = TRUE,
  base_indention = 0,
  dry = "off"
)

Arguments

path

Path to a directory with files to transform.

...

Arguments passed on to the style function, see tidyverse_style() for the default argument.

style

A function that creates a style guide to use, by default tidyverse_style. Not used further except to construct the argument transformers. See style_guides() for details.

transformers

A set of transformer functions. This argument is most conveniently constructed via the style argument and .... See 'Examples'.

filetype

Vector of file extensions indicating which file types should be styled. Case is ignored, and the . is optional, e.g. c(".R", ".Rmd"), or c("r", "rmd"). Supported values (after standardization) are: "r", "rprofile", "rmd", "rmarkdown", "rnw", "qmd". Rmarkdown is treated as Rmd.

recursive

A logical value indicating whether or not files in sub directories of path should be styled as well.

exclude_files

Character vector with paths to files that should be excluded from styling.

exclude_dirs

Character vector with directories to exclude (recursively).

include_roxygen_examples

Whether or not to style code in roxygen examples.

base_indention

Integer scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a base_indention spaces before the code in the case multi-line strings are present. See 'Examples'.

dry

To indicate whether styler should run in dry mode, i.e. refrain from writing back to files ."on" and "fail" both don't write back, the latter returns an error if the input code is not identical to the result of styling. "off", the default, writes back if the input and output of styling are not identical.


Like styler::style_file(), but style defaulting to quote_style

Description

See styler::style_file() for details, examples and more.

Usage

style_file(
  path,
  ...,
  style = quote_style,
  transformers = style(...),
  include_roxygen_examples = TRUE,
  base_indention = 0,
  dry = "off"
)

Arguments

path

A character vector with paths to files to style. Supported extensions: .R, .Rmd, .Rmarkdown, .qmd and .Rnw.

...

Arguments passed on to the style function, see tidyverse_style() for the default argument.

style

A function that creates a style guide to use, by default tidyverse_style. Not used further except to construct the argument transformers. See style_guides() for details.

transformers

A set of transformer functions. This argument is most conveniently constructed via the style argument and .... See 'Examples'.

include_roxygen_examples

Whether or not to style code in roxygen examples.

base_indention

Integer scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a base_indention spaces before the code in the case multi-line strings are present. See 'Examples'.

dry

To indicate whether styler should run in dry mode, i.e. refrain from writing back to files ."on" and "fail" both don't write back, the latter returns an error if the input code is not identical to the result of styling. "off", the default, writes back if the input and output of styling are not identical.


Like styler::style_pkg(), but style defaulting to quote_style

Description

See styler::style_pkg() for details, examples and more.

Usage

style_pkg(
  pkg = ".",
  ...,
  style = quote_style,
  transformers = style(...),
  filetype = c("R", "Rprofile"),
  exclude_files = "R/RcppExports.R",
  exclude_dirs = c("packrat", "renv"),
  include_roxygen_examples = TRUE,
  base_indention = 0,
  dry = "off"
)

Arguments

pkg

Path to a (subdirectory of an) R package.

...

Arguments passed on to the style function, see tidyverse_style() for the default argument.

style

A function that creates a style guide to use, by default tidyverse_style. Not used further except to construct the argument transformers. See style_guides() for details.

transformers

A set of transformer functions. This argument is most conveniently constructed via the style argument and .... See 'Examples'.

filetype

Vector of file extensions indicating which file types should be styled. Case is ignored, and the . is optional, e.g. c(".R", ".Rmd"), or c("r", "rmd"). Supported values (after standardization) are: "r", "rprofile", "rmd", "rmarkdown", "rnw", "qmd". Rmarkdown is treated as Rmd.

exclude_files

Character vector with paths to files that should be excluded from styling.

exclude_dirs

Character vector with directories to exclude (recursively). Note that the default values were set for consistency with style_dir() and as these directories are anyways not styled.

include_roxygen_examples

Whether or not to style code in roxygen examples.

base_indention

Integer scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a base_indention spaces before the code in the case multi-line strings are present. See 'Examples'.

dry

To indicate whether styler should run in dry mode, i.e. refrain from writing back to files ."on" and "fail" both don't write back, the latter returns an error if the input code is not identical to the result of styling. "off", the default, writes back if the input and output of styling are not identical.


Like styler::style_text(), but style defaulting to quote_style

Description

See styler::style_text() for details, examples and more.

Usage

style_text(
  text,
  ...,
  style = quote_style,
  transformers = style(...),
  include_roxygen_examples = TRUE,
  base_indention = 0
)

Arguments

text

A character vector with text to style.

...

Arguments passed on to the style function, see tidyverse_style() for the default argument.

style

A function that creates a style guide to use, by default tidyverse_style. Not used further except to construct the argument transformers. See style_guides() for details.

transformers

A set of transformer functions. This argument is most conveniently constructed via the style argument and .... See 'Examples'.

include_roxygen_examples

Whether or not to style code in roxygen examples.

base_indention

Integer scalar indicating by how many spaces the whole output text should be indented. Note that this is not the same as splitting by line and add a base_indention spaces before the code in the case multi-line strings are present. See 'Examples'.