lintFunctionArgs | R Documentation |
This function parses an R Script file, grouping function calls and the named arguments passed to those functions. Then, based on a set of rules, it is determined if functions of interest have specific named arguments specified.
lintFunctionArgs_file(filePath = NULL, rules = NULL, fullPath = FALSE)
lintFunctionArgs_dir(dirPath = "./R", rules = NULL, fullPath = FALSE)
filePath |
Path to a file, given as a length one character vector. |
rules |
A named list where the name of each element is a function name, and the value is a character vector of the named argument to check for. All arguments must be specified for a function to "pass". |
fullPath |
Logical specifying whether to display absolute paths. |
dirPath |
Path to a directory, given as a length one character vector. |
A tibble
detailing the results of the lint.
The output of the function argument linter is a tibble with the following columns:
path to the source file
Line of the source file the function is on
Column of the source file the function starts at
The name of the function
A vector of the named arguments passed to the function
True iff the function specifies all of the named arguments required by the given rules
This function is only able to test for named arguments passed to a function.
For example, it would report that foo(x = bar, "baz")
has specified
the named argument x
, but not that bar
was the value of the
argument, or that "baz"
had been passed as an unnamed argument.
## Not run:
library(MazamaCoreUtils)
# Example rule list for checking
exRules <- list(
"fn_one" = "x",
"fn_two" = c("foo", "bar")
)
# Example of using included timezone argument linter
lintFunctionArgs_file(
"local_test/timezone_lint_test_script.R",
MazamaCoreUtils::timezoneLintRules
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.