Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@describeIn with plain functions does not include the function name. #285

Closed
jimhester opened this issue Sep 29, 2014 · 1 comment · Fixed by #286
Closed

@describeIn with plain functions does not include the function name. #285

jimhester opened this issue Sep 29, 2014 · 1 comment · Fixed by #286

Comments

@jimhester
Copy link
Member

@jimhester jimhester commented Sep 29, 2014

#' S1 documentation
s1 <- function(x) { }

#' @describeIn s1 a function a lot like s1, but different
s2 <- function(x) { x + 1 }

Generates this Rd

% Generated by roxygen2 (4.0.2): do not edit by hand
\name{s1}
\alias{s1}
\alias{s2}
\title{S1 documentation}
\usage{
s1(x)

s2(x)
}
\description{
S1 documentation
}
\section{Functions}{
\itemize{
\item \code{}: a function a lot like s1, but different
}}

Note the lack of anything in the \code{} block. I would expect this to be \code{s2} for this example.

This problematic code seems to be minidesc.R#L76, which calls default_name.default() which just returns NULL.

I think the correct solution would be to create a default_name.function which returns the function name. If you agree let me know and I can make a pull request.

@jimhester
Copy link
Member Author

@jimhester jimhester commented Sep 29, 2014

I think this should be a valid test for the issue. My proposed fix doesn't seem to fix it though, I would have to keep digging to figure out why...

test_that("@describeIn class captures function name", {
  out <- roc_proc_text(rd_roclet(), "
    #' Title
    f <- function(x)

    #' @describeIn f A
    f2 <- function(x) 1
    ")[[1]]

  expect_equal(get_tag(out, "minidesc")$values$label, "a")
})

jimhester added a commit to jimhester/roxygen that referenced this issue Sep 30, 2014
Previously these did not include the function name in the list.
Fixes r-lib#285
@hadley hadley closed this in #286 Sep 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant