diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0204e9a6..d2df3894 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -82,7 +82,7 @@ jobs:
if: ${ (env.ACT || false)}
run: sudo apt update
- name: Install Tidy Ubuntu
- run: sudo apt install -y tidy
+ run: apt update && sudo apt install -y tidy
- name: build tarball for submission to CRAN
run: R CMD build $GITHUB_WORKSPACE
- name: Grab tarball path
diff --git a/NEWS.md b/NEWS.md
index 80ff5794..7cb790b1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,8 +5,11 @@
## CHANGES
* Updated `pkgnet-intro` vignette to include information on the Class Inheritance Reporter and other minor edits.
+* Recursive function network creation made tolerant to empty lists. (#322)
+* Excessive warnings removed for custom `vignette_path` param in `CreatePackageVignette()` (#322)
## BUGFIXES
+* `CreatePackageReporter()` failing on Windows to build package coverage when `report_path` specified. (#322)
# pkgnet 0.4.2
## NEW FEATURES
diff --git a/R/CreatePackageVignette.R b/R/CreatePackageVignette.R
index 8f423d6b..07c7edb8 100644
--- a/R/CreatePackageVignette.R
+++ b/R/CreatePackageVignette.R
@@ -85,42 +85,6 @@ CreatePackageVignette <- function(pkg = "."
, dirname(vignette_path)))
}
- # Check if vignette_path matches the right package
- # if the path is to a file in a directory named vignettes
- vignetteDirAbsPath <- normalizePath(dirname(vignette_path))
- # If path is a vignettes directory
- if (grepl('/vignettes$', vignetteDirAbsPath)) {
- # Get path for expected DESCRIPTION file for package
- expectedDescriptionPath <- gsub(
- pattern = "vignettes$"
- , replacement = "DESCRIPTION"
- , x = vignetteDirAbsPath
- )
-
- # If DESCRIPTION file exists check the name
- if (file.exists(expectedDescriptionPath)) {
- foundPkgName <- read.dcf(expectedDescriptionPath)[1,][["Package"]]
-
- # If it doesn't match pkg_name, give warning
- if (!identical(foundPkgName, pkg_name)) {
- log_warn(glue::glue(
- "You are writing a report for {pkg_name} to the vignettes "
- , "directory for {foundPkgName}"
- , pkg_name = pkg_name
- , foundPkgName = foundPkgName))
- }
-
- # Otherwise, warn that we're writing to a vignettes folder inside
- # a directory that is not a package root
- } else {
- log_warn(paste(
- "You specified a path to a vignettes directory"
- , vignetteDirAbsPath
- , "that is not inside a package root directory."
- ))
- }
- }
-
log_info(sprintf(
"Creating pkgnet package report as vignette for %s..."
, pkg_name
diff --git a/R/FunctionReporter.R b/R/FunctionReporter.R
index d8ca0c3e..ff404dfc 100644
--- a/R/FunctionReporter.R
+++ b/R/FunctionReporter.R
@@ -151,12 +151,24 @@ FunctionReporter <- R6::R6Class(
log_info(sprintf("Calculating test coverage for %s...", self$pkg_name))
+ # workaround for covr conflict with loaded packages on windows
+ if(.Platform$OS.type == "windows") {
+ detach(paste0('package:',self$pkg_name), unload = TRUE, character.only = TRUE)
+ }
+
pkgCovDT <- data.table::as.data.table(covr::package_coverage(
path = private$pkg_path
, type = "tests"
, combine_types = FALSE
+ , quiet = FALSE
+ , clean = FALSE
))
+ # workaround for covr conflict with loaded packages on windows
+ if(.Platform$OS.type == "windows") {
+ attachNamespace(self$pkg_name)
+ }
+
pkgCovDT <- pkgCovDT[, .(coveredLines = sum(value > 0)
, totalLines = .N
, coverageRatio = sum(value > 0)/.N
@@ -395,12 +407,17 @@ FunctionReporter <- R6::R6Class(
if (!is.list(x) && listable) {
x <- as.list(x)
- # Check for expression of the form foo$bar
- # We still want to split it up because foo might be a function
- # but we want to get rid of bar, because it's a symbol in foo's namespace
- # and not a symbol that could be reliably matched to the package namespace
- if (identical(x[[1]], quote(`$`))) {
- x <- x[1:2]
+ if (length(x) > 0){
+ # Check for expression of the form foo$bar
+ # We still want to split it up because foo might be a function
+ # but we want to get rid of bar, because it's a symbol in foo's namespace
+ # and not a symbol that could be reliably matched to the package namespace
+ if (identical(x[[1]], quote(`$`))) {
+ x <- x[1:2]
+ }
+ } else {
+ # make empty lists "not listable" so recursion stops
+ listable <- FALSE
}
}
@@ -643,9 +660,10 @@ FunctionReporter <- R6::R6Class(
if (!is.list(x) && listable) {
xList <- as.list(x)
+ if (length(xList) > 0){
+
# Check if expression x is from _$_
if (identical(xList[[1]], quote(`$`))) {
-
# Check if expression x is of form self$foo, private$foo, or super$foo
# We want to keep those together because they could refer to the class'
# methods. So expression is not listable
@@ -654,6 +672,7 @@ FunctionReporter <- R6::R6Class(
|| identical(xList[[2]], quote(super))) {
listable <- FALSE
+
# If expression lefthand side is not keyword, we still want to split
# it up because left might be a function
# but we want to get rid of right, because it's a symbol in left's namespace
@@ -667,8 +686,15 @@ FunctionReporter <- R6::R6Class(
} else {
x <- xList
}
+ } else {
+ # make empty list "non-listable" so recursion stops
+ listable <- FALSE
+ }
+
}
+
+
if (listable){
# Filter out atomic values because we don't care about them
x <- Filter(f = Negate(is.atomic), x = x)
diff --git a/inst/baseballstats/DESCRIPTION b/inst/baseballstats/DESCRIPTION
index 8747b126..57638582 100644
--- a/inst/baseballstats/DESCRIPTION
+++ b/inst/baseballstats/DESCRIPTION
@@ -18,4 +18,3 @@ Suggests:
License: file LICENSE
LazyData: TRUE
RoxygenNote: 7.1.0
-Roxygen: list(r6 = FALSE)
diff --git a/inst/milne/DESCRIPTION b/inst/milne/DESCRIPTION
index 861faa4a..a07958b4 100644
--- a/inst/milne/DESCRIPTION
+++ b/inst/milne/DESCRIPTION
@@ -17,5 +17,4 @@ LinkingTo:
Rcpp
License: file LICENSE
LazyData: TRUE
-RoxygenNote: 7.1.0
-Roxygen: list(r6 = FALSE)
+RoxygenNote: 7.3.1
diff --git a/inst/milne/R/The_End.R b/inst/milne/R/The_End.R
index d18c4fd5..5a189261 100644
--- a/inst/milne/R/The_End.R
+++ b/inst/milne/R/The_End.R
@@ -1,22 +1,36 @@
# R6 Class Definitions for testing
-#' @title Age One
-#' @name One
-#' @family TheEnd
-#' @description Age One
+#' R6 Class Age One
+#'
+#' @description
+#' Age One
+#'
+#' @details
+#' Age One
+#'
#' @importFrom R6 R6Class
#' @export
One <- R6::R6Class(
classname = "One",
public = list(
+
+ #' @description
+ #' Create a New Age One Object
+ #' @return An Age One Object
initialize = function() {
cat("The End, by A. A. Milne \n")
},
+
+ #' @description
+ #' Print poem
print_poem = function() {
cat("When I was One, \n",
"I had just begun. \n"
)
},
+
+ #' @description
+ #' Get Age
how_old_am_i = function() {private$get_age()}
),
private = list(
@@ -24,16 +38,22 @@ One <- R6::R6Class(
)
)
-#' @title Age Two
-#' @name Two
-#' @family TheEnd
-#' @description Age Two
+#' R6 Class Age Two
+#'
+#' @description
+#' Age Two
+#'
+#' @details
+#' Age Two
+#'
#' @importFrom R6 R6Class
#' @export
Two <- R6::R6Class(
classname = "Two",
inherit = One,
public = list(
+ #' @description
+ #' Print poem two
print_poem = function() {
super$print_poem()
cat("When I was Two, \n",
@@ -43,10 +63,14 @@ Two <- R6::R6Class(
)
)
-#' @title Age Three
-#' @name Three
-#' @family TheEnd
-#' @description Age Three
+#' R6 Class Age Three
+#'
+#' @description
+#' Age Three
+#'
+#' @details
+#' Age Three
+#'
#' @importFrom R6 R6Class
#' @export
Three <- R6::R6Class(
@@ -54,6 +78,8 @@ Three <- R6::R6Class(
classname = "HardlyThree",
inherit = Two,
public = list(
+ #' @description
+ #' Print poem thrice
print_poem = function() {
super$print_poem()
cat("When I was Three, \n",
@@ -63,10 +89,14 @@ Three <- R6::R6Class(
)
)
-#' @title Age Four
-#' @name Four
-#' @family TheEnd
-#' @description Age Four
+#' R6 Class Age Four
+#'
+#' @description
+#' Age Four
+#'
+#' @details
+#' Age Four
+#'
#' @importFrom R6 R6Class
#' @export
Four <- R6::R6Class(
@@ -74,6 +104,8 @@ Four <- R6::R6Class(
classname = NULL,
inherit = Three,
public = list(
+ #' @description
+ #' Print poem four
print_poem = function() {
super$print_poem()
cat("When I was Four, \n",
@@ -83,16 +115,24 @@ Four <- R6::R6Class(
)
)
-#' @title Age Five
-#' @name Five
-#' @family TheEnd
-#' @description Age Five
+#' R6 Class Age Five
+#'
+#' @description
+#' Age Five
+#'
+#' @details
+#' Age Five
+#'
#' @importFrom R6 R6Class
#' @export
Five <- R6::R6Class(
classname = "Five",
inherit = Four,
public = list(
+ #' @description
+ #' Print poem five times
+ #' @details
+ #' Did your hand hit on the river?
print_poem = function() {
super$print_poem()
cat("When I was Five, \n",
@@ -104,16 +144,24 @@ Five <- R6::R6Class(
)
)
-#' @title Age Six
-#' @name Six
-#' @family TheEnd
-#' @description Age Six
+#' R6 Class Age Six
+#'
+#' @description
+#' Age Six
+#'
+#' @details
+#' Age Six
+#'
#' @importFrom R6 R6Class
#' @export
Six <- R6::R6Class(
classname = "Six",
inherit = Five,
public = list(
+ #' @description
+ #' Print poem six times
+ #' @details
+ #' I should have looked ahead
print_poem = function() {
super$print_poem()
cat("But now I am Six,",
@@ -123,6 +171,7 @@ Six <- R6::R6Class(
}
),
private = list(
+ # I don't think private classes and methods are supported by Roxygen2
print_ending = function() {
cat("So I think I'll be six now",
"for ever and ever."
diff --git a/inst/milne/man/Five.Rd b/inst/milne/man/Five.Rd
index c39c415a..50e71d4d 100644
--- a/inst/milne/man/Five.Rd
+++ b/inst/milne/man/Five.Rd
@@ -1,19 +1,61 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/The_End.R
-\docType{data}
\name{Five}
\alias{Five}
-\title{Age Five}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-Five
-}
+\title{R6 Class Age Five}
\description{
Age Five
}
-\seealso{
-Other TheEnd: \code{\link{Four}}, \code{\link{One}},
- \code{\link{Six}}, \code{\link{Three}}, \code{\link{Two}}
+\details{
+Age Five
+}
+\section{Super classes}{
+\code{milne::One} -> \code{milne::Two} -> \code{milne::HardlyThree} -> \code{milne::NA} -> \code{Five}
+}
+\section{Methods}{
+\subsection{Public methods}{
+\itemize{
+\item \href{#method-Five-print_poem}{\code{Five$print_poem()}}
+\item \href{#method-Five-clone}{\code{Five$clone()}}
+}
+}
+\if{html}{\out{
+Inherited methods
+
+