ropensci-review-tools / srr

Software Review Roclets
https://docs.ropensci.org/srr/
Other
4 stars 2 forks source link

Workflow to check standards #21

Closed mpadge closed 2 years ago

mpadge commented 2 years ago

The following reprex copied from https://github.com/ropensci/statistical-software-review-book/issues/55 highlights a number of issues that need to be addressed here.

z <- system.file ("extdata", "pkgstats_9.9.tar.gz", package = "pkgstats")
path <- pkgstats::extract_tarball (z)
library (srr)
f <- file.path (path, "R", "srr-stats.R")
s <- srr_stats_roxygen (category = "bayesian", filename = f)
#> ✔ Downloaded general standards
#> ✔ Downloaded bayesian standards
#> ℹ Roxygen2-formatted standards written to [srr-stats.R]
any (grepl ("BS[0-9]", readLines (f))) # Are Bayesian stats in file?
#> [1] TRUE

r <- srr_report (path, view = FALSE)
#> ℹ Loading pkgstats
#>   ─  DONE (pkgstats)
#> 
#> ✔ Downloaded general standards
#> processing file: file62525e9b8c2.Rmd
#> output file: file62525e9b8c2.knit.md
#> 
#> Output created: /tmp/RtmprCkvzs/file62525e9b8c2.html

# Are Bayesian standards in report?
any (grepl ("BS[0-9]", r)) # Nope!!
#> [1] FALSE
r [grep ("Missing Standards", r):length (r)]
#> [1] "## Missing Standards"                                                                                                                                                                                  
#> [2] ""                                                                                                                                                                                                      
#> [3] "The following standards are missing:"                                                                                                                                                                  
#> [4] ""                                                                                                                                                                                                      
#> [5] "General standards:"                                                                                                                                                                                    
#> [6] ""                                                                                                                                                                                                      
#> [7] "G1.4a, G2.0a, G2.1a, G2.3a, G2.3b, G2.4a, G2.4b, G2.4c, G2.4d, G2.4e, G2.14a, G2.14b, G2.14c, G3.1a, G5.2a, G5.2b, G5.4a, G5.4b, G5.4c, G5.6a, G5.6b, G5.8a, G5.8b, G5.8c, G5.8d, G5.9a, G5.9b, G5.11a"
#> [8] ""

grep ("G1\\.4a", r) # But that one is not missing!
#> [1] 16 89

Created on 2021-11-22 by the reprex package (v2.0.1.9000)

mpadge commented 2 years ago

That commit fixes the missing categorical (Bayesian) tags in the report. Previous version didn't work when all stats for a category were tagged "TODO", and none were yet done.

mpadge commented 2 years ago

The second problem was a grep issue which the above commit fxes:

z <- system.file ("extdata", "pkgstats_9.9.tar.gz", package = "pkgstats")
path <- pkgstats::extract_tarball (z)
library (srr)
packageVersion ("srr")
#> [1] '0.0.1.131'
f <- file.path (path, "R", "srr-stats.R")
s <- srr_stats_roxygen (category = "bayesian", filename = f)
#> ✔ Downloaded general standards
#> ✔ Downloaded bayesian standards
#> ℹ Roxygen2-formatted standards written to [srr-stats.R]

any (grepl ("BS[0-9]", readLines (f))) # Bayesian stats are there!
#> [1] TRUE

r <- srr_report (path, view = FALSE)
#> ℹ Loading pkgstats
#> ℹ 1 functions decorated with [[cpp11::register]]
#> ✔ generated file 'cpp11.R'
#> ✔ generated file 'cpp11.cpp'
#>   ─  DONE (pkgstats)
#> 
#> ✔ Downloaded general standards
#> ✔ Downloaded bayesian standards
#> processing file: file83d154033ed1.Rmd
#> output file: file83d154033ed1.knit.md
#> 
#> Output created: /tmp/Rtmp6X3iak/file83d154033ed1.html

# Are Bayesian standards in report?
any (grepl ("BS[0-9]", r)) # yes!
#> [1] TRUE
# Any missing standards?
any (grepl ("Missing Standards", r))
#> [1] FALSE

Created on 2021-11-22 by the reprex package (v2.0.1.9000)

All okay now

mpadge commented 2 years ago

The above commit adds the workflow as a test file