Learn R Programming

lintr (version 3.0.2)

infix_spaces_linter: Infix spaces linter

Description

Check that infix operators are surrounded by spaces. Enforces the corresponding Tidyverse style guide rule; see https://style.tidyverse.org/syntax.html#infix-operators.

Usage

infix_spaces_linter(exclude_operators = NULL, allow_multiple_spaces = TRUE)

Arguments

exclude_operators

Character vector of operators to exlude from consideration for linting. Default is to include the following "low-precedence" operators: +, -, ~, >, >=, <, <=, ==, !=, &, &&, |, ||, <-, :=, <<-, ->, ->>, =, /, *, and any infix operator (exclude infixes by passing "%%"). Note that <-, :=, and <<- are included/excluded as a group (indicated by passing "<-"), as are -> and ->> (viz, "->"), and that = for assignment and for setting arguments in calls are treated the same.

allow_multiple_spaces

Logical, default TRUE. If FALSE, usage like x = 2 will also be linted; excluded by default because such usage can sometimes be used for better code alignment, as is allowed by the style guide.

Tags

default, readability, style

See Also

linters for a complete list of linters available in lintr.
https://style.tidyverse.org/syntax.html#infix-operators