lintr icon indicating copy to clipboard operation
lintr copied to clipboard

Lintr should lint Roxygen documentation examples

Open AlexAxthelm opened this issue 7 years ago • 0 comments

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.

AlexAxthelm avatar Sep 11 '17 15:09 AlexAxthelm