Check that parentheses and square brackets do not have spaces directly inside them, i.e., directly following an opening delimiter or directly preceding a closing delimiter.
See also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "c( TRUE, FALSE )",
linters = spaces_inside_linter()
)
#> ::warning file=<text>,line=1,col=3::file=<text>,line=1,col=3,[spaces_inside_linter] Do not place spaces after parentheses.
#> ::warning file=<text>,line=1,col=15::file=<text>,line=1,col=15,[spaces_inside_linter] Do not place spaces before parentheses.
lint(
text = "x[ 1L ]",
linters = spaces_inside_linter()
)
#> ::warning file=<text>,line=1,col=3::file=<text>,line=1,col=3,[spaces_inside_linter] Do not place spaces after square brackets.
#> ::warning file=<text>,line=1,col=6::file=<text>,line=1,col=6,[spaces_inside_linter] Do not place spaces before square brackets.
# okay
lint(
text = "c(TRUE, FALSE)",
linters = spaces_inside_linter()
)
lint(
text = "x[1L]",
linters = spaces_inside_linter()
)