Open maelle opened 6 years ago
Perhaps the output could also describe how to address duplication, e.g.,
An alternative to @describeIn is @rdname. It overrides the default file name generated by roxygen and merges documentation for multiple objects into one file. This gives you complete freedom to combine documentation however you see fit. There are two ways to use @rdname. You can add documentation to an existing function:
#' Basic arithmetic
#'
#' @param x,y numeric vectors.
add <- function(x, y) x + y
#' @rdname add
times <- function(x, y) x * y
taken from https://cran.r-project.org/web/packages/roxygen2/vignettes/rd.html
I also second the idea of finding duplicated code lines! That'd be seriously handy for refactoring code.
Thanks both! I like this idea :)
This is a feature request dear @hfrick π πΊ
With
roxygen2
one can inherit parameters/sections from one function to the other in order to remove duplication of doc sources while still having docs everywhere it's needed. Cf this blog post. I think a function that'd help find duplicates could be useful.Here is code by @jimhester to find duplicates
He also wrote the
tidyverse
-compliant versionThis already helps a lot. A perfect helper would:
Parse the results a bit more and say stuff like "the parameter BLABLA is documented in functions A, B, C" (and this even if the documentation is different, based on the parameter name rather than the whole line).
Also find lines that are close (in case one has two similar Details section but corrected a typo in only one of them?)
Have a verbose output but also markers?
I also wonder if a similar tool for code lines could be useful but maybe it even already exists? π€