Skip to contents

Check that all left parentheses in a function call do not have spaces before them (e.g. mean (1:3)). Although this is syntactically valid, it makes the code difficult to read.

Usage

function_left_parentheses_linter()

Details

Exceptions are made for control flow functions (if, for, etc.).

See also

Examples

# will produce lints
lint(
  text = "mean (x)",
  linters = function_left_parentheses_linter()
)
#> ::warning file=<text>,line=1,col=5::file=<text>,line=1,col=5,[function_left_parentheses_linter] Remove spaces before the left parenthesis in a function call.

lint(
  text = "stats::sd(c (x, y, z))",
  linters = function_left_parentheses_linter()
)
#> ::warning file=<text>,line=1,col=12::file=<text>,line=1,col=12,[function_left_parentheses_linter] Remove spaces before the left parenthesis in a function call.

# okay
lint(
  text = "mean(x)",
  linters = function_left_parentheses_linter()
)

lint(
  text = "stats::sd(c(x, y, z))",
  linters = function_left_parentheses_linter()
)

lint(
  text = "foo <- function(x) (x + 1)",
  linters = function_left_parentheses_linter()
)