From e3b365fed566283822e5484d4121c662f9fbf0c9 Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Tue, 23 Jan 2024 11:25:43 -0800 Subject: [PATCH] Initial setup (#8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Questions: 1. Can we discuss `./tests/testhat/setup.R`? I am not sure I understand what it's doing. - I can delete this file. 3. What is the reporter here? `test_check(pkg_name, reporter = ParallelProgressReporter$new())` - Is this similar to the parallel processing of unit tests available in testthat edition 3 (which is opt-in)? - Can I add `Config/testthat/parallel: true` to the DESCRIPTION without breaking things? - ADDED the config to DESCRIPTION, and no longer need the reporter. 4. `.pre-commit-config.yaml` The defaults here are styling and re-documenting, right? But we have workflows for those as well. Do we need both? What is the role of all the dependencies listed in the file? - I can leave this and not install the pre-commit hooks. Or i can delete this 6. `.gitlab-ci.yml`, do I need this one since this is a GH repo? KEEP THIS BECAUSE WE WILL NEED IT FOR VALIDATION. 7. Where are staged dependencies used? I see them in the R CMD Checks yaml. Any other spaces? I don't think I need that infrastructure right now: if I delete the file now, will it break existing workflows? - I CAN DELETE OR NOT DELETE 9. `build-check-install.yaml` - Can we discuss the details of `junit-xml` reports, so I can understand what they are doing? - What versions of R are checked? A project like cards need to be checked on the last 4 versions of R. - This checks one version of R only for now. This may change in the future. For now, I'll probably just add the Posit checks for older versions. - The reports that are uploaded to the pkgdown site, are the just static html files? If I prefer not to add a dropdown menu that persists all every page of the website, can I link to them another way? - I can delete these menus from the _pkgdown.yaml, and then add a link via a fa-icon - Is this built similarly to the admiral workflows based off images that update every so often? If so, how frequently do they update? What if I need to use a new feature from a package? 10. I โค๏ธ `branch-cleanup`. Did I specify this option correctly? ![image](https://github.com/insightsengineering/cardx/assets/26774684/d4ee72ce-71c3-4526-9234-01d9ccba040e) 11. Does either the lintr or styler actually change my scripts or just report when they are not properly linted/styled? If so, can that be changed to just report? --- .github/workflows/check.yaml | 4 +- .github/workflows/scheduled.yaml | 18 ++------ .gitignore | 3 ++ .pre-commit-config.yaml | 71 -------------------------------- DESCRIPTION | 10 +++-- R/.gitkeep | 0 R/cardx-package.R | 6 +++ _pkgdown.yml | 16 +++---- inst/WORDLIST | 2 + man/.gitkeep | 0 man/cardx-package.Rd | 28 +++++++++++++ staged_dependencies.yaml | 5 --- tests/testthat.R | 3 +- tests/testthat/.gitkeep | 0 tests/testthat/setup.R | 35 ---------------- tests/testthat/test-delete_me.R | 3 ++ 16 files changed, 62 insertions(+), 142 deletions(-) delete mode 100644 .pre-commit-config.yaml delete mode 100644 R/.gitkeep create mode 100644 R/cardx-package.R delete mode 100644 man/.gitkeep create mode 100644 man/cardx-package.Rd delete mode 100644 staged_dependencies.yaml delete mode 100644 tests/testthat/.gitkeep delete mode 100644 tests/testthat/setup.R create mode 100644 tests/testthat/test-delete_me.R diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 444c3134c..fe4ff93dc 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -53,7 +53,7 @@ jobs: secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} with: - auto-update: true + auto-update: false gitleaks: name: gitleaks ๐Ÿ’ง uses: insightsengineering/r.pkg.template/.github/workflows/gitleaks.yaml@main @@ -83,7 +83,7 @@ jobs: name: Style Check ๐Ÿ‘— uses: insightsengineering/r.pkg.template/.github/workflows/style.yaml@main with: - auto-update: true + auto-update: false grammar: if: github.event_name != 'push' name: Grammar Check ๐Ÿ”ค diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index df66705fe..36fdc192a 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -7,27 +7,15 @@ on: workflow_dispatch: jobs: - dependency-test: - strategy: - fail-fast: false - matrix: - test-strategy: ["min_cohort", "min_isolated", "release", "max"] - uses: insightsengineering/r.pkg.template/.github/workflows/verdepcheck.yaml@main - name: Dependency Test - ${{ matrix.test-strategy }} ๐Ÿ”ข - secrets: - REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} - GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }} - with: - strategy: ${{ matrix.test-strategy }} - additional-env-vars: | - PKG_SYSREQS_DRY_RUN=true branch-cleanup: name: Branch Cleanup ๐Ÿงน uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + last-commit-age-days: 365 cran-status: name: CRAN Status Monitor ๐Ÿ“บ uses: insightsengineering/r.pkg.template/.github/workflows/cran-status.yaml@main with: - issue-assignees: "shajoezhu,Melkiades,edelarua,gmbecker,ayogasekaram" + issue-assignees: "ddsjoberg" diff --git a/.gitignore b/.gitignore index f93e9a6da..25330c565 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ docs # others .DS_Store temp/ + + +.pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 44a93971e..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -# All available hooks: https://pre-commit.com/hooks.html -# R specific hooks: https://github.com/lorenzwalthert/precommit -default_stages: [commit] -default_language_version: - python: python3 -repos: - - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.0 - hooks: - - id: style-files - name: Style code with `styler` - args: [--style_pkg=styler, --style_fun=tidyverse_style, - --cache-root=styler] - - id: roxygenize - name: Regenerate package documentation - additional_dependencies: - - checkmate - - digest - - dplyr - - ggplot2 - - glue - - grDevices - - lifecycle - - logger - - magrittr - - methods - - bioc::MultiAssayExperiment - - R6 - - rlang - - rtables - - shinyjs - - shinyWidgets - - stats - - bioc::SummarizedExperiment - - utils - - yaml - - id: spell-check - name: Check spelling with `spelling` - exclude: > - (?x)^( - .*\.[rR]| - .*\.css| - .*\.jpg| - .*\.js| - .*\.png| - .*\.py| - .*\.RData| - .*\.Rds| - .*\.rds| - .*\.Rproj| - .*\.sh| - .*\.svg| - .*\.xml| - (.*/|)\_pkgdown.y[a]?ml| - (.*/|)\.gitignore| - (.*/|)\.gitlab-ci\.y[a]?ml| - (.*/|)\.lintr| - (.*/|)\.pre-commit-.*| - (.*/|)\.Rbuildignore| - (.*/|)\.Renviron| - (.*/|)\.Rprofile| - (.*/|)CODEOWNERS| - (.*/|)DESCRIPTION| - (.*/|)LICENSE| - (.*/|)NAMESPACE| - (.*/|)staged_dependencies\.y[a]?ml| - (.*/|)WORDLIST| - \.github/.*\.y[a]?ml| - data/.* - )$ diff --git a/DESCRIPTION b/DESCRIPTION index e560e5cff..c35ac038f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,6 @@ Package: cardx -Title: R Package to Supplement ARD Functions Found in {cards} +Title: Extra Analysis Results Data Utilities Version: 0.0.0.9005 -Date: 2024-01-23 Authors@R: c( person("Daniel", "Sjoberg", , "sjobergd@gene.com", role = c("aut", "cre")), person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")) @@ -13,13 +12,16 @@ BugReports: https://github.com/insightsengineering/cardx/issues Depends: R (>= 4.0) Imports: - utils + cards (>= 0.0.0.9012) Suggests: testthat (>= 3.2.0) +Remotes: + insightsengineering/cards Config/Needs/website: insightsengineering/nesttemplate Config/testthat/edition: 3 +Config/testthat/parallel: true Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.0 diff --git a/R/.gitkeep b/R/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/R/cardx-package.R b/R/cardx-package.R new file mode 100644 index 000000000..a65cf6430 --- /dev/null +++ b/R/cardx-package.R @@ -0,0 +1,6 @@ +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start +## usethis namespace: end +NULL diff --git a/_pkgdown.yml b/_pkgdown.yml index 449ccfdd3..927257a73 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -8,14 +8,14 @@ navbar: structure: left: [intro, reference, articles, tutorials, news, reports] right: [search, github] - components: - reports: - text: Reports - menu: - - text: Coverage report - href: coverage-report/ - - text: Unit test report - href: unit-test-report/ + # components: + # reports: + # text: Reports + # menu: + # - text: Coverage report + # href: coverage-report/ + # - text: Unit test report + # href: unit-test-report/ github: icon: fa-github href: https://github.com/insightsengineering/cardx diff --git a/inst/WORDLIST b/inst/WORDLIST index 95f99a480..d5347ff56 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,3 +1,5 @@ ARD Forkers +Hoffmann +funder repo diff --git a/man/.gitkeep b/man/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/man/cardx-package.Rd b/man/cardx-package.Rd new file mode 100644 index 000000000..130581a57 --- /dev/null +++ b/man/cardx-package.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cardx-package.R +\docType{package} +\name{cardx-package} +\alias{cardx} +\alias{cardx-package} +\title{cardx: Extra Analysis Results Data Utilities} +\description{ +R Package to Supplement ARD Functions Found in {cards}. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/insightsengineering/cardx} + \item Report bugs at \url{https://github.com/insightsengineering/cardx/issues} +} + +} +\author{ +\strong{Maintainer}: Daniel Sjoberg \email{sjobergd@gene.com} + +Other contributors: +\itemize{ + \item F. Hoffmann-La Roche AG [copyright holder, funder] +} + +} +\keyword{internal} diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml deleted file mode 100644 index fd7ce3188..000000000 --- a/staged_dependencies.yaml +++ /dev/null @@ -1,5 +0,0 @@ -current_repo: - repo: insightsengineering/cardx - host: https://github.com -upstream_repos: {} -downstream_repos: {} diff --git a/tests/testthat.R b/tests/testthat.R index 0545fd002..961b2989a 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,3 +1,2 @@ -pkg_name <- "cardx" library(testthat) -test_check(pkg_name, reporter = ParallelProgressReporter$new()) +test_check("cardx") diff --git a/tests/testthat/.gitkeep b/tests/testthat/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R deleted file mode 100644 index 9c74d4d29..000000000 --- a/tests/testthat/setup.R +++ /dev/null @@ -1,35 +0,0 @@ -# Extra libraries (suggested) for tests -library(dplyr) - -# skip_if_too_deep -skip_if_too_deep <- function(depth) { - checkmate::assert_number(depth, lower = 0, upper = 5) - - testing_depth <- getOption("TESTING_DEPTH") - if (is.null(testing_depth)) testing_depth <- Sys.getenv("TESTING_DEPTH") - - testing_depth <- tryCatch( - as.numeric(testing_depth), - error = function(error) 3, - warning = function(warning) 3 - ) - - if (length(testing_depth) != 1 || is.na(testing_depth)) testing_depth <- 3 - - if (testing_depth < depth) { - testthat::skip(paste("testing depth", testing_depth, "is below current testing specification", depth)) - } -} - -# expect_snapshot_ggplot - set custom plot dimensions -expect_snapshot_ggplot <- function(title, fig, width = NA, height = NA) { - skip_if_not_installed("svglite") - - name <- paste0(title, ".svg") - path <- tempdir() - suppressMessages(ggplot2::ggsave(name, fig, path = path, width = width, height = height)) - path <- file.path(path, name) - - testthat::announce_snapshot_file(name = name) - testthat::expect_snapshot_file(path, name) -} diff --git a/tests/testthat/test-delete_me.R b/tests/testthat/test-delete_me.R new file mode 100644 index 000000000..8849056e2 --- /dev/null +++ b/tests/testthat/test-delete_me.R @@ -0,0 +1,3 @@ +test_that("multiplication works", { + expect_equal(2 * 2, 4) +})