analyticalmonk / Rperform

:bar_chart: R package for tracking performance metrics across git versions and branches.
https://analyticalmonk.github.io/Rperform
GNU General Public License v3.0
65 stars 9 forks source link

Make package CRAN ready #16

Open analyticalmonk opened 8 years ago

analyticalmonk commented 8 years ago

Currently, R CMD check fails. Update and complete documentation, and make other required changes.

analyticalmonk commented 8 years ago

Current status: Eliminated ERRORs; reduced multiple WARNINGs to a single one; single NOTE.

About the existing WARNING:

Message being returned:

checking dependencies in R code ... WARNING
Unexported object imported by a ':::' call: ‘testthat:::test_code’
  See the note in ?`:::` about the use of this operator.

Background:

The WARNING message has to do with the methodology employed for obtaining the runtime for testthat blocks. Steps employed for doing it (along with examples from code) are:

analyticalmonk commented 8 years ago

@tdhock The only reason for using test_code() that I can make out is to evaluate the test in the original environment from which the top-most function (such as time_commit() in the above case) was called. This is in contrast to the general approach taken the testthat to evaluate tests without affecting the global state. Since you had written the testthatQuantity() function, can you explain why this approach was required?

joshuaulrich commented 8 years ago

A couple more "NOTE"s from running R CMD check --as-cran:

* checking R code for possible problems ... NOTE
.plot_mem: no visible global function definition for ‘png’
.plot_mem: no visible global function definition for ‘dev.off’
.plot_testMetrics: no visible global function definition for ‘png’
.plot_testMetrics: no visible global function definition for ‘dev.off’
.plot_time: no visible global function definition for ‘png’
.plot_time: no visible global function definition for ‘dev.off’
list_commits: no visible global function definition for ‘as’
plot_metrics: no visible global function definition for
  ‘capture.output’
Undefined global functions or variables:
  as capture.output dev.off png
Consider adding
  importFrom("grDevices", "dev.off", "png")
  importFrom("methods", "as")
  importFrom("utils", "capture.output")
to your NAMESPACE file (and ensure that your DESCRIPTION Imports field
contains 'methods').
* checking Rd files ... NOTE
prepare_Rd: Rperform-package.Rd:31-32: Dropping empty section \examples

The fixes should be evident, but let me know if you have questions. Here's the command I ran:

_R_CHECK_CRAN_INCOMING_=FALSE _R_CHECK_FORCE_SUGGESTS_=FALSE \
R CMD check Rperform_0.0.0.9000.tar.gz --as-cran
tdhock commented 8 years ago

My motivation for testthatQuantity was to copy what was implemented in the testthat package, but make some modifications that allow measuring the time of each test_that block.

To avoid that WARNING about ::: you can instead use get.

For example, instead of

testthat:::test_code()

you can use

test_code <- get("test_code", envir=asNamespace("testthat"))
test_code()