Skip to content

R6 class inheriting from unexported parent causes check() error #1236

@hongooi73

Description

@hongooi73

Running devtools::check() on an internal package gives the following result:

> checking Rd cross-references ... WARNING
  Missing link or links in documentation object 'LiquiditySeekerStrategy.Rd': 
    '[algotrade:Strategy]{algotrade::Strategy}'

  Missing link or links in documentation object 'TWAPStrategy.Rd':
    '[algotrade:Strategy]{algotrade::Strategy}'

  See section 'Cross-references' in the 'Writing R Extensions' manual.        

The reason, as far as I can tell, is because my exported TWAPStrategy and LiquiditySeekerStrategy classes inherit from a parent Strategy class, which is private. My documentation markup for the exported classes doesn't include any explicit links to Strategy, but it appears that roxygen2 inserts them anyway.

Some sample markup:

#' TWAP strategy class
#'
#' @description
#' This class emulates the TWAP trading stategy.
#' @details
#' The TWAP strategy is the simplest strategy in use. (...)
#' @export
TWAPStrategy <- R6::R6Class("TWAPStrategy", inherit=Strategy, ...)

And the start of the corresponding .Rd file:

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/TWAPStrategy.R
\name{TWAPStrategy}
\alias{TWAPStrategy}
\title{TWAP strategy class}
\description{
This class emulates the TWAP trading stategy.
}
\details{
The TWAP strategy is the simplest strategy in use. (...)
}
\section{Super class}{
\code{\link[algotrade:Strategy]{algotrade::Strategy}} -> \code{TWAPStrategy}
}

Notice the link to the Strategy class, which check() complains about. Should this link be there for an unexported class?

Metadata

Metadata

Assignees

No one assigned

    Labels

    R6 6️⃣bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions