R/functionArgument_linting.R
lintFunctionArgs.RdParse R source code and identify calls to selected functions that are missing required named arguments.
lintFunctionArgs_file(filePath = NULL, rules = NULL, fullPath = FALSE)
lintFunctionArgs_dir(dirPath = "./R", rules = NULL, fullPath = FALSE)Path to a single R source file.
Named list of linting rules. Each list name is a function name and each value is a character vector of required named arguments.
Logical specifying whether returned file paths should be
absolute paths. If FALSE, only base file names are returned.
Path to a directory containing R source files.
A tibble describing matching function calls, with columns:
Source file path or file name.
Line number where the function call begins.
Column number where the function call begins.
Name of the function being checked.
List column containing named arguments used in the call.
Logical indicating whether all required named arguments were supplied.
Rules are supplied as a named list where each name is a function to check and each value is a character vector of required argument names. A function call passes when all required arguments are supplied by name.
This linter only checks whether arguments are named in the call. It does not evaluate code, inspect argument values, or detect unnamed positional arguments.
This linter only detects named arguments. For example, foo(x = bar, "baz")
is treated as specifying the named argument x, but the value bar and the
unnamed argument "baz" are not inspected.
if (FALSE) { # \dontrun{
rules <- list(
fn_one = "x",
fn_two = c("foo", "bar")
)
lintFunctionArgs_file(
filePath = "local_test/timezone_lint_test_script.R",
rules = rules
)
lintFunctionArgs_dir(
dirPath = "./R",
rules = MazamaCoreUtils::timezoneLintRules
)
} # }