Check that namespace::function()
calls except for box::*()
are not made.
Source: R/namespaced_function_calls.R
namespaced_function_calls.Rd
Check that namespace::function()
calls except for box::*()
are not made.
Examples
# will produce lints
code <- "box::use(package)
tidyr::pivot_longer()"
lintr::lint(text = code, linters = namespaced_function_calls())
#> ::warning file=<text>,line=2,col=1::file=<text>,line=2,col=1,[namespaced_function_calls] Explicit `package::function()` calls are not advisible when using `box` modules.
## allow `tidyr::pivot_longer()`
code <- "box::use(package)
tidyr::pivot_longer()
tidyr::pivot_wider()"
lintr::lint(text = code, linters = namespaced_function_calls(allow = c("tidyr::pivot_longer")))
#> ::warning file=<text>,line=3,col=1::file=<text>,line=3,col=1,[namespaced_function_calls] Explicit `package::function()` calls are not advisible when using `box` modules.
# okay
code <- "box::use(package)"
lintr::lint(text = code, linters = namespaced_function_calls())
## allow all `tidyr`
code <- "box::use(package)
tidyr::pivot_longer()
tidyr::pivot_wider()"
lintr::lint(text = code, linters = namespaced_function_calls(allow = c("tidyr")))
## allow `tidyr::pivot_longer()`
code <- "box::use(package)
tidyr::pivot_longer()"
lintr::lint(text = code, linters = namespaced_function_calls(allow = c("tidyr::pivot_longer")))