Skip to content

Commit

Permalink
date-vignette; linting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathancallahan committed Aug 20, 2019
1 parent 6156555 commit 9c2e807
Show file tree
Hide file tree
Showing 38 changed files with 633 additions and 212 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Package
Package: MazamaCoreUtils
Version: 0.3.0
Version: 0.3.1
Title: Utility Functions for Production R Code
Authors@R: c(
person("Jonathan", "Callahan", email="[email protected]", role=c("aut","cre")),
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export(TRACE)
export(WARN)
export(dateRange)
export(initializeLogging)
export(lintFunctionArgs_directory)
export(lintFunctionArgs_dir)
export(lintFunctionArgs_file)
export(logger.debug)
export(logger.error)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# MazamaCoreUtils 0.3.1

* Tweak for CRAN.
* Renamed `lintFunctionArgs_directory()` to `lintFunctionArgs_dir()`.
* Added `fullPath` argument to linting funcitons.
* Added `date-parsing` vignette.

# MazamaCoreUtils 0.3.0

This version focuses on enhancing the time utility capabilities of
Expand Down
19 changes: 12 additions & 7 deletions R/functionArgument_linting.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param 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".
#' @param fullPath Logical specifying whether to display absolute paths.
#'
#' @return A \code{\link[tibble]{tibble}} detailing the results of the lint.
#'
Expand All @@ -34,7 +35,7 @@
#' argument, or that \code{"baz"} had been passed as an unnamed argument.
#'
#' @name lintFunctionArgs
#' @aliases lintFunctionArgs_file lintFunctionArgs_directory
#' @aliases lintFunctionArgs_file lintFunctionArgs_dir
#'
#' @examples
#' \dontrun{
Expand All @@ -56,7 +57,8 @@ NULL
#' @export
lintFunctionArgs_file <- function(
filePath = NULL,
rules = NULL
rules = NULL,
fullPath = FALSE
) {

# Validate input ------------------------------------------------------------
Expand Down Expand Up @@ -124,6 +126,8 @@ lintFunctionArgs_file <- function(

# Check function arguments ------------------------------------------------

if ( !fullPath ) fileString <- basename(normFilePath)

results <-
functionCalls %>%
dplyr::filter(.data$function_name %in% names(rules)) %>%
Expand All @@ -132,9 +136,9 @@ lintFunctionArgs_file <- function(
.data$named_args, .data$function_name,
~purrr::has_element(.x, rules[[.y]])
),
file_path = normFilePath
file = fileString
) %>%
dplyr::select(.data$file_path, dplyr::everything())
dplyr::select(.data$file, dplyr::everything())

return(results)

Expand All @@ -143,9 +147,10 @@ lintFunctionArgs_file <- function(

#' @rdname lintFunctionArgs
#' @export
lintFunctionArgs_directory <- function(
lintFunctionArgs_dir <- function(
dirPath = "./R",
rules = NULL
rules = NULL,
fullPath = FALSE
) {

# Validate input -------------------------------------------------------------
Expand All @@ -169,7 +174,7 @@ lintFunctionArgs_directory <- function(

results <- normDirPath %>%
list.files(pattern = "\\.R$", full.names = TRUE, recursive = TRUE) %>%
purrr::map_dfr(lintFunctionArgs_file, rules)
purrr::map_dfr(lintFunctionArgs_file, rules, fullPath)

return(results)

Expand Down
1 change: 0 additions & 1 deletion R/utils-tidyeval-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
#' @keywords internal
#' @aliases .data
#' @importFrom rlang .data
#' @usage .data
NULL
5 changes: 4 additions & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 39 additions & 36 deletions docs/articles/cache-management.html

Large diffs are not rendered by default.

196 changes: 196 additions & 0 deletions docs/articles/date-parsing.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9c2e807

Please sign in to comment.