#683 avoid print mount recursion fix #592

Open Bruno Tremblay meztez

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 4 files from the diff.
Other files ignored by Codecov

@@ -382,6 +382,15 @@
Loading
382 382
    #' @param ... additional arguments for recursive calls
383 383
    #' @return A terminal friendly representation of a plumber router.
384 384
    print = function(prefix="", topLevel=TRUE, ...){
385 +
386 +
      # Avoid printing recursion (mount on mount on mount on ...)
387 +
      on.exit({private$printing = NULL}, add = TRUE)
388 +
      private$printing = sum(private$printing, ifelse(topLevel, 0L, 1L))
389 +
      if (isTRUE(private$printing == 2L)) {
390 +
        cat(crayon::bgBlue("# Circular Plumber reference detected", "\n", sep=""))
391 +
        return()
392 +
      }
393 +
385 394
      endCount <- as.character(sum(unlist(lapply(self$endpoints, length))))
386 395
387 396
      # Reference on box characters: https://en.wikipedia.org/wiki/Box-drawing_character
@@ -1066,6 +1075,7 @@
Loading
1066 1075
    parsed = NULL, # The parsed representation of the API
1067 1076
    globalSettings = list(info=list()), # Global settings for this API. Primarily used for OpenAPI Specification.
1068 1077
    disable_run = NULL, # Disable run method during parsing of the Plumber file
1078 +
    printing = NULL, # Logical flag indicating if router is printing
1069 1079
1070 1080
    errorHandler = NULL,
1071 1081
    notFoundHandler = NULL,

Learn more Showing 4 files with coverage changes found.

Changes in R/pr_set.R
New
Loading file...
Changes in R/plumber.R
New
Loading file...
Changes in R/parse-body.R
New
Loading file...
Changes in R/serializer.R
New
Loading file...
Files Coverage
R 0.04% 80.27%
Project Totals (35 files) 80.27%
Loading