# defaults for which functions are considered undesirable
names(default_undesirable_functions)
# will produce lints
lint(
text = "sapply(x, mean)",
linters = undesirable_function_linter()
)
lint(
text = "log10(x)",
linters = undesirable_function_linter(fun = c("log10" = NA))
)
lint(
text = "log10(x)",
linters = undesirable_function_linter(fun = c("log10" = "use log()"))
)
lint(
text = 'dir <- "path/to/a/directory"',
linters = undesirable_function_linter(fun = c("dir" = NA))
)
# okay
lint(
text = "vapply(x, mean, FUN.VALUE = numeric(1))",
linters = undesirable_function_linter()
)
lint(
text = "log(x, base = 10)",
linters = undesirable_function_linter(fun = c("log10" = "use log()"))
)
lint(
text = 'dir <- "path/to/a/directory"',
linters = undesirable_function_linter(fun = c("dir" = NA), symbol_is_undesirable = FALSE)
)
Run the code above in your browser using DataLab