options_rfmt: Set or retrieve options relating to the 'rfmt' formatter.

Description Usage Arguments Options and default values Note

Description

Though they are specific to the rfmt code formatter, these functions mirror options and getOption in base R in their behavior.

Usage

1
2
3

Arguments

x

a character string naming an rfmt option.

default

value supplied if the specified option is not set (for compatibility; not particularly applicable in this instance, because all rfmt options are set).

...

named arguments used to set option values. See below for the available options. A single named list may also be provided.

Options and default values

backup

If TRUE, the formatter copies the source file fn to the file fn.bak. Default: TRUE.

margin0

The offset (from the left-most column) of the “soft” right margin (where the layout algorithm is encouraged to break lines). Default: 0.

margin1

The offset (from the left-most column) of the “hard” right margin (where the layout algorithm is mandated to break lines, if at all possible). Default: 80.

cost0

The cost of each character beyond the soft right margin, margin0. Default: 0.05.

cost1

The cost of each character beyond the hard right margin, margin1. Default: 100.

costb

The cost associated with the introduction of a newline. Default: 2.

indent

The number of spaces introduced by each successive indent. Default: 2.

force.brace

Whether to insert braces in “control flow” constructs, such as if or while, that lack them. Default: FALSE.

space.arg.eq

Whether to surround “=” signs in argument lists with spaces. Default: TRUE.

quiet

Whether to suppress output of all diagnostic information. Default: TRUE.

adj.comment

Multiplier applied to the cost of a newline when formatting comments. Default: 0.5.

adj.flow

Multiplier applied to the cost of a newline when formatting “control flow” constructs, such as if or while. Default: 0.3.

adj.call

Multiplier applied to the cost of a newline when formatting function calls. Default: 0.5.

adj.arg

Multiplier applied to the cost of a newline when formatting argument expressions in function calls. Default: 5.

cpack

Small penalty favoring justified layouts with elements packed onto earlier lines. Default: 1e-3.

Note

For a description of the layout algorithm used in rfmt, look in the “User guides, package vignettes and other documentation” section of the package documentation for the technical report “A New Approach to Optimal Code Formatting”.


google/rfmt documentation built on May 17, 2019, 7:59 a.m.