Learn R Programming

lintr (version 3.1.2)

commented_code_linter: Commented code linter

Description

Check that there is no commented code outside roxygen blocks.

Usage

commented_code_linter()

Arguments

Tags

best_practices, default, readability, style

See Also

linters for a complete list of linters available in lintr.

Examples

Run this code
# 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()
)

Run the code above in your browser using DataLab