Check that infix operators are surrounded by spaces. Enforces the corresponding Tidyverse style guide rule; see https://style.tidyverse.org/syntax.html#infix-operators.
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
. IfFALSE
, usage likex = 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.
See also
linters for a complete list of linters available in lintr.
https://style.tidyverse.org/syntax.html#infix-operators