commented_code_linter: Commented code linter

View source: R/comment_linters.R

commented_code_linterR Documentation

Commented code linter

Description

Check that there is no commented code outside roxygen blocks.

Usage

commented_code_linter()

Tags

best_practices, default, readability, style

See Also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "# x <- 1",
  linters = commented_code_linter()
)

lint(
  text = "x <- f() # g()",
  linters = commented_code_linter()
)

lint(
  text = "x + y # + z[1, 2]",
  linters = commented_code_linter()
)

# okay
lint(
  text = "x <- 1; x <- f(); x + y",
  linters = commented_code_linter()
)

lint(
  text = "#' x <- 1",
  linters = commented_code_linter()
)


lintr documentation built on May 29, 2024, 11:31 a.m.