Skip to content

Lintr should lint Roxygen documentation examples #265

@AlexAxthelm

Description

@AlexAxthelm

Example code should be well formatted.

I hand't though about this until I started using 1.0.1, and it noticed a lot of trailing line spaces in the Roxygen comments, but I noticed that there aren't any checks for the actual example code.

For example:

#' show head and return summary
#'
#' @param bar an object
#'
#' @return summary of \code{bar}
#' @export
#'
#' @examples
#' ThisIsATerribleVariable = 6:20
#' foo( ThisIsATerribleVariable )
#' 
foo <- function(bar){
  print(head(bar))
  return(summary(bar))
}

I would expect lintr to flag line 9 for snake_case and <- not =, and line 10 for space around code in parentheses. In stead, all that I get is line 11, for trailing whitespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked-internalFulfillment of this issue is blocked until another lintr issue is finishedfeaturea feature request or enhancementroxygen2Linting package documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions