russHyde / dupree

{dupree} helps identify code blocks that have a high level of similarity in a set of R files
https://russhyde.github.io/dupree/
Other
37 stars 0 forks source link

`relative_path = TRUE` argument in `dupree_[dir|package]` #62

Open russHyde opened 4 years ago

russHyde commented 4 years ago

Reason:

Running dupree_package on aoos during code_as_data returned a data.frame that looks like:

file_a  file_b  block_a block_b line_a  line_b  score
<MY_HOME>/temp/dev-tools-analysis/aoos/R/S4-expressions.R    <MY_HOME>/temp/dev-tools-analysis/aoos/R/S4-expressions.R  2       4       71      139     0.24880382775119614
<MY_HOME>/temp/dev-tools-analysis/aoos/R/RL-retList.R        <MY_HOME>/temp/dev-tools-analysis/aoos/R/S4RC-Accessor.R   98      16      112     32      0.2222222222222222

I would rather the file paths were relative to the package-path or dir-path that was passed into dupree_* (for this particular analysis), that is:

file_a  file_b  block_a block_b line_a  line_b  score
R/S4-expressions.R    R/S4-expressions.R  2       4       71      139     0.24880382775119614
R/RL-retList.R        R/S4RC-Accessor.R   98      16      112     32      0.2222222222222222

lintr provides an equivalent argument, that is TRUE by default. See lint_dir / lint_package:

@param relative_path if \code{TRUE}, file paths are printed using their path
#' relative to the base directory.  If \code{FALSE}, use the full
#' absolute path.

Could the name relative_path be confused: