Check that there is no commented code outside roxygen blocks.
See also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "# x <- 1",
linters = commented_code_linter()
)
#> ::warning file=<text>,line=1,col=3::file=<text>,line=1,col=3,[commented_code_linter] Commented code should be removed.
lint(
text = "x <- f() # g()",
linters = commented_code_linter()
)
#> ::warning file=<text>,line=1,col=12::file=<text>,line=1,col=12,[commented_code_linter] Commented code should be removed.
lint(
text = "x + y # + z[1, 2]",
linters = commented_code_linter()
)
#> ::warning file=<text>,line=1,col=9::file=<text>,line=1,col=9,[commented_code_linter] Commented code should be removed.
# okay
lint(
text = "x <- 1; x <- f(); x + y",
linters = commented_code_linter()
)
lint(
text = "#' x <- 1",
linters = commented_code_linter()
)