Avoid the symbols T
and F
, and use TRUE
and FALSE
instead.
See also
linters for a complete list of linters available in lintr.
Tags
best_practices, consistency, default, readability, robustness, style
Examples
# will produce lints
lint(
text = "x <- T; y <- F",
linters = T_and_F_symbol_linter()
)
#> ::warning file=<text>,line=1,col=7::file=<text>,line=1,col=7,[T_and_F_symbol_linter] Use TRUE instead of the symbol T.
#> ::warning file=<text>,line=1,col=15::file=<text>,line=1,col=15,[T_and_F_symbol_linter] Use FALSE instead of the symbol F.
lint(
text = "T = 1.2; F = 2.4",
linters = T_and_F_symbol_linter()
)
#> ::warning file=<text>,line=1,col=2::file=<text>,line=1,col=2,[T_and_F_symbol_linter] Don't use T as a variable name, as it can break code relying on T being TRUE.
#> ::warning file=<text>,line=1,col=11::file=<text>,line=1,col=11,[T_and_F_symbol_linter] Don't use F as a variable name, as it can break code relying on F being FALSE.
# okay
lint(
text = "x <- c(TRUE, FALSE)",
linters = T_and_F_symbol_linter()
)
lint(
text = "t = 1.2; f = 2.4",
linters = T_and_F_symbol_linter()
)