cyclocomp_linter: Cyclomatic complexity linter

View source: R/cyclocomp_linter.R

cyclocomp_linterR Documentation

Cyclomatic complexity linter

Description

Check for overly complicated expressions. See cyclocomp::cyclocomp().

Usage

cyclocomp_linter(complexity_limit = 15L)

Arguments

complexity_limit

Maximum cyclomatic complexity, default 15. Expressions more complex than this are linted. See cyclocomp::cyclocomp().

Tags

best_practices, configurable, default, readability, style

See Also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "if (TRUE) 1 else 2",
  linters = cyclocomp_linter(complexity_limit = 1L)
)

# okay
lint(
  text = "if (TRUE) 1 else 2",
  linters = cyclocomp_linter(complexity_limit = 2L)
)


lintr documentation built on Nov. 7, 2023, 5:07 p.m.