Skip to contents

These functions provide utitilies to scrape the editor and editDate roxygen tags and put them into a nice data.frame for use in the validation reports. In addition, opinionated kable formatting functions are provided as well to facilitate nice printing in the reports.

Usage

vt_scrape_requirement_editors(
  tags = c("editor", "editDate"),
  src = ".",
  ref = vt_path(),
  dynamic_ref = NULL
)

vt_scrape_test_case_editors(
  tags = c("editor", "editDate"),
  src = ".",
  ref = vt_path(),
  dynamic_ref = NULL
)

vt_scrape_test_code_editors(
  tags = c("editor", "editDate", "deprecate"),
  src = ".",
  ref = vt_path(),
  dynamic_ref = NULL
)

vt_scrape_function_editors(
  tags = c("editor", "editDate", "export"),
  src = ".",
  ref = vt_path()
)

vt_kable_requirement_editors(x, format = vt_render_to())

vt_kable_function_editors(x, format = vt_render_to())

vt_kable_test_case_editors(x, format = vt_render_to())

vt_kable_test_code_editors(x, format = vt_render_to())

Arguments

tags

which tags to keep. defaults to editor and editDate

src

path to package sources. defaults to current directory and passed to vt_scrape_tags_from

ref

reference path to whre validation documentation lives. defaults to vt_path annd passed to vt_scrape_tags_from.

dynamic_ref

dynamic referencer object

x

data.frame as exported from vt_scrape_*

format

passed to knitr::kable, NULL by default

Value

data.frame containing the results of the scraped roxygen tags for each section

knitr_kable object

Note

vt_scrape_functions Requires access to raw R/ or function documentation parsed via valtools into validation/ folder. Cannot pull information from installed R/ location.

Examples


withr::with_tempdir({

captured_output <- capture.output({vt_create_package(open = FALSE)})
vt_use_req(
     name = "req1",
     username = "B user",
     title = "Requirement 1",
     open = FALSE)
writeLines(c(
    "#' @title Say Hello",
    "#' @editor B User",
    "#' @editDate 2021-04-27",
    "#' @export",
    "hello <- function(){print(\"Hello\")}"
    ), con = "R/hello.R")
vt_use_test_case(
    name = "testcase1",
    username = "B user",
    title = "TesT Case 1",
    open = FALSE)
vt_use_test_code(
    name = "testcode1",
    username = "C user",
    open = FALSE)

req_editors <- vt_scrape_requirement_editors()
vt_kable_requirement_editors(req_editors)

fun_editors <- vt_scrape_function_editors()
vt_kable_function_editors(fun_editors)

t_case_editors <- vt_scrape_test_case_editors()
vt_kable_test_case_editors(t_case_editors)

t_code_editors <- vt_scrape_test_code_editors()
vt_kable_test_code_editors(t_code_editors)


})
#>  Setting active project to "/tmp/Rtmpzsp7fE/file180f6c811a27".
#>  Creating R/.
#>  Writing DESCRIPTION.
#>  Writing NAMESPACE.
#>  Setting active project to "<no active project>".
#> Created package structure
#>  Adding "!*" to ./vignettes/validation/.gitignore.
#> Created vignettes/validation  in package structure
#> validation config file created. Add user information through `vt_add_user_to_config()`
#> Item created:requirements/req1.md 
#> Filename(s): req1.md added to validation config file.
#> Item created:test_cases/testcase1.md 
#> Filename(s): testcase1.md added to validation config file.
#> Item created:test_code/testcode1.R 
#> Filename(s): testcode1.R added to validation config file.
#> <table class="table" style="margin-left: auto; margin-right: auto;">
#>  <thead>
#>   <tr>
#>    <th style="text-align:left;"> Test Code ID </th>
#>    <th style="text-align:left;"> Editor </th>
#>    <th style="text-align:left;"> Edit Date </th>
#>   </tr>
#>  </thead>
#> <tbody>
#>   <tr>
#>    <td style="text-align:left;border-left:1px solid;"> TESTNUMBER </td>
#>    <td style="text-align:left;"> C user </td>
#>    <td style="text-align:left;border-right:1px solid;"> 2024-11-05 </td>
#>   </tr>
#> </tbody>
#> </table>