for_loop_index_linter | R Documentation |
for (x in x)
is a poor choice of indexing variable. This overwrites
x
in the calling scope and is confusing to read.
for_loop_index_linter()
best_practices, readability, robustness
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "for (x in x) { TRUE }",
linters = for_loop_index_linter()
)
lint(
text = "for (x in foo(x, y)) { TRUE }",
linters = for_loop_index_linter()
)
# okay
lint(
text = "for (xi in x) { TRUE }",
linters = for_loop_index_linter()
)
lint(
text = "for (col in DF$col) { TRUE }",
linters = for_loop_index_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.