Skip to contents

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.

Usage

spaces_inside_linter()

See also

Examples

# will produce lints
lint(
  text = "c( TRUE, FALSE )",
  linters = spaces_inside_linter()
)
#> <text>:1:3: style: [spaces_inside_linter] Do not place spaces after parentheses.
#> c( TRUE, FALSE )
#>   ^
#> <text>:1:15: style: [spaces_inside_linter] Do not place spaces before parentheses.
#> c( TRUE, FALSE )
#>               ^

lint(
  text = "x[ 1L ]",
  linters = spaces_inside_linter()
)
#> <text>:1:3: style: [spaces_inside_linter] Do not place spaces after square brackets.
#> x[ 1L ]
#>   ^
#> <text>:1:6: style: [spaces_inside_linter] Do not place spaces before square brackets.
#> x[ 1L ]
#>      ^

# okay
lint(
  text = "c(TRUE, FALSE)",
  linters = spaces_inside_linter()
)
#>  No lints found.

lint(
  text = "x[1L]",
  linters = spaces_inside_linter()
)
#>  No lints found.