From 42aa2340237c4876b9ba798e93ce37de5ade68a3 Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Thu, 29 Dec 2022 13:00:47 +0100 Subject: [PATCH 1/8] Add coverage. --- .Rbuildignore | 1 + .github/workflows/test-coverage.yaml | 50 ++++++++++++++++++++++++++++ DESCRIPTION | 2 ++ README.md | 1 + codecov.yml | 14 ++++++++ 5 files changed, 68 insertions(+) create mode 100644 .github/workflows/test-coverage.yaml create mode 100644 codecov.yml diff --git a/.Rbuildignore b/.Rbuildignore index f6279af..7dbc4a9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ logo.* ^pkgdown$ cran-comments.md ^CRAN-SUBMISSION$ +^codecov\.yml$ diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..2c5bb50 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: test-coverage + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr + needs: coverage + + - name: Test coverage + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") + ) + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/DESCRIPTION b/DESCRIPTION index 03ec9a0..461d3e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,3 +32,5 @@ NeedsCompilation: yes SystemRequirements: C++11 License: GPL-3 RoxygenNote: 7.2.3 +Suggests: + covr diff --git a/README.md b/README.md index 6787e3d..702f0b1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![R-CMD-check](https://github.com/swarm-lab/cec/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/swarm-lab/cec/actions/workflows/R-CMD-check.yaml) +[![Codecov test coverage](https://codecov.io/gh/swarm-lab/cec/branch/master/graph/badge.svg)](https://app.codecov.io/gh/swarm-lab/cec?branch=master) [![CRAN status](https://www.r-pkg.org/badges/version/CEC)](https://CRAN.R-project.org/package=CEC) [![CRANLOGS downloads](https://cranlogs.r-pkg.org/badges/cec)](https://cran.r-project.org/package=cec) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..04c5585 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true From b8fd58cbc81ce8605025a8e6ad45843fc5099a41 Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Thu, 30 Nov 2023 10:44:38 -0500 Subject: [PATCH 2/8] Fix new CRAN check errors. --- DESCRIPTION | 5 +-- NEWS.md | 12 ++++++ R/cec.R | 2 +- cran-comments.md | 99 +++++++++++++++++++++++++----------------------- src/cec_r.cpp | 12 +++--- 5 files changed, 73 insertions(+), 57 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 461d3e2..f7ac5d5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: CEC Type: Package Title: Cross-Entropy Clustering -Version: 0.11.0 -Date: 2022-12-12 +Version: 0.11.1 +Date: 2023-11-30 Authors@R: c( person("Kamieniecki", "Konrad", email = "konrad.kamieniecki@alumni.uj.edu.pl", role = c("aut")), @@ -29,7 +29,6 @@ Imports: stats, utils NeedsCompilation: yes -SystemRequirements: C++11 License: GPL-3 RoxygenNote: 7.2.3 Suggests: diff --git a/NEWS.md b/NEWS.md index f6378d7..4a7dde8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# CEC v0.11.1 + +## New features + +* N/A. + +## Minor improvements and fixes + +* Fixing new CRAN check errors. + +--- + # CEC v0.11.0 ## New features diff --git a/R/cec.R b/R/cec.R index 443a567..f1ad3ff 100644 --- a/R/cec.R +++ b/R/cec.R @@ -7,7 +7,7 @@ #' #' @param x A numeric matrix of data. Each row corresponds to a distinct #' observation; each column corresponds to a distinct variable/dimension. It -#' must not contain \code{NA} values. +#' must not contain \code{NA} values. #' #' @param centers Either a matrix of initial centers or the number of initial #' centers (\code{k}, single number \code{cec(data, 4, ...)}) or a vector for diff --git a/cran-comments.md b/cran-comments.md index 5e2e9f8..6d2fb22 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,7 @@ ## Test environments -* local M1 OS X 13.0.1, R 4.2.2 -* local M1 OS X 13.0.1, R-devel +* local M1 OS X 14.1.1, R 4.3.2 +* local M1 OS X 14.1.1, R-devel * Github Actions "windows-latest (release)" * Github Actions "macOS-latest (release)" * Github Actions "ubuntu-latest (release)" @@ -10,62 +10,67 @@ * r-hub Windows Server 2022, R-devel, 64 bit * r-hub Ubuntu Linux 20.04.1 LTS, R-release, GCC * r-hub Fedora Linux, R-devel, clang, gfortran +* r-hub Debian Linux, R-devel, GCC ASAN/UBSAN * win-builder.r-project.org ## R CMD check results There were no ERRORs or WARNINGs. -"Possibly misspelled words in DESCRIPTION: - CEC (16:17, 19:5) - Spurek (19:33)" - -These are the correct spellings. - -"Found the following (possibly) invalid URLs: - URL: - From: README.md - Message: Empty URL" - -Fixed. - ## Downstream dependencies There are currently no downstream dependencies for this package. ## CRAN team comments -"Please always write package names, software names and API (application -programming interface) names in single quotes in title and description. -e.g: --> 'CEC' -Please note that package names are case sensitive." - -Fixed. - -"Please do not use on.exit() to reset user's options(), working directory -or par() after you changed it in examples and vignettes and demos. e.g.: -man/cec.Rd -Please reset in the following way -e.g.: -oldpar <- par(mfrow = c(1,2)) -... -par(oldpar)" - -Fixed. +This submission fixes the following CRAN check issues: + +Version: 0.11.0 +Check: whether package can be installed +Result: WARN + Found the following significant warnings: + cec_r.cpp:65:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:75:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:123:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:133:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:160:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:167:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + See ‘/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/CEC.Rcheck/00install.out’ for details. + * used C++ compiler: ‘Debian clang version 17.0.5 (1)’ +Flavor: r-devel-linux-x86_64-debian-clang + +Version: 0.11.0 +Check: C++ specification +Result: NOTE + Specified C++11: please drop specification unless essential +Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-release-windows-x86_64 + +Version: 0.11.0 +Check: Rd files +Result: NOTE + checkRd: (-1) cec.Rd:164-165: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:166-168: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:169-172: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:173-175: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:176-177: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:178-180: Lost braces in \itemize; meant \describe ? + checkRd: (-1) cec.Rd:181-182: Lost braces in \itemize; meant \describe ? + checkRd: (-1) init.centers.Rd:19-20: Lost braces in \itemize; meant \describe ? + checkRd: (-1) init.centers.Rd:21-22: Lost braces in \itemize; meant \describe ? +Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc + +Version: 0.11.0 +Check: whether package can be installed +Result: WARN + Found the following significant warnings: + cec_r.cpp:65:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:75:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:123:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:133:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:160:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + cec_r.cpp:167:15: warning: format string is not a string literal (potentially insecure) [-Wformat-security] + See ‘/data/gannet/ripley/R/packages/tests-clang/CEC.Rcheck/00install.out’ for details. + * used C++ compiler: ‘clang version 17.0.5’ +Flavor: r-devel-linux-x86_64-fedora-clang --- - -The package appeared to have been "orphaned" and I am "adopting" it as new -maintainer. CRAN check errors were not corrected for months, there has not been -any activity on the package's GitHub repository in more than a year, and the -previous maintainer have not replied to my or others' messages to fix the check -errors. - -I have conserved the attribution structure of the package and just added myself -as the new maintainer. I have also fixed the check errors, updated the -documentation, and made code modifications that do not alter the usage of -user-facing functions or modify their output for maintaining continuity with the -previous versions of the package on CRAN. - -If this "adoption" is not acceptable for CRAN policies, please disregard this -submission. diff --git a/src/cec_r.cpp b/src/cec_r.cpp index 1ca0af6..9fb8e1f 100644 --- a/src/cec_r.cpp +++ b/src/cec_r.cpp @@ -62,7 +62,7 @@ SEXP cec_r(SEXP x_r, SEXP centers_param_r, SEXP control_param_r, SEXP models_par } if (ex_what) - error(ex_what); + error("%s", ex_what); try { SEXP r_res; @@ -72,7 +72,7 @@ SEXP cec_r(SEXP x_r, SEXP centers_param_r, SEXP control_param_r, SEXP models_par } catch (std::exception &ex) { ex_what = ex.what(); } - error(ex_what); + error("%s", ex_what); } extern "C" @@ -120,7 +120,7 @@ SEXP cec_split_r(SEXP x_r, SEXP centers_param_r, SEXP control_param_r, SEXP mode } if (ex_what) - error(ex_what); + error("%s", ex_what); try { SEXP r_res; @@ -130,7 +130,7 @@ SEXP cec_split_r(SEXP x_r, SEXP centers_param_r, SEXP control_param_r, SEXP mode } catch (std::exception &ex) { ex_what = ex.what(); } - error(ex_what); + error("%s", ex_what); } extern "C" @@ -157,14 +157,14 @@ SEXP cec_init_centers_r(SEXP x_r, SEXP k_r, SEXP method_r) { } if (ex_what) - error(ex_what); + error("%s", ex_what); try { SEXP r_res = put(*res); return r_res; } catch (exception &ex) { ex_what = ex.what(); - error(ex_what); + error("%s", ex_what); } } From 617442164c71c59de9f4e3b6dd9930a8eb1355c2 Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Sat, 2 Dec 2023 07:52:23 -0500 Subject: [PATCH 3/8] Fix itemize check issue. --- R/cec.R | 2 +- R/init.centers.R | 5 ++--- man/cec.Rd | 2 +- man/init.centers.Rd | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/R/cec.R b/R/cec.R index f1ad3ff..eaf9996 100644 --- a/R/cec.R +++ b/R/cec.R @@ -128,7 +128,7 @@ #' implementations of \emph{\strong{H}} have been proposed (expressed as a type #' - model - of the clustering): #' -#' \itemize{ +#' \describe{ #' \item{"all": }{All Gaussian densities. Data will form ellipsoids with #' arbitrary radiuses.} #' \item{"covariance": }{Gaussian densities with a fixed given covariance. The diff --git a/R/init.centers.R b/R/init.centers.R index b36cf89..c6d492e 100644 --- a/R/init.centers.R +++ b/R/init.centers.R @@ -11,9 +11,8 @@ #' #' @param method A character string indicating the initialization method to use. #' It can take the following values: -#' \itemize{ -#' \item{"kmeans++": }{the centers are selected using the k-means++ algorithm. -#' } +#' \describe{ +#' \item{"kmeans++": }{the centers are selected using the k-means++ algorithm.} #' \item{"random": }{the centers are randomly selected among the values in #' \code{x}} #' } diff --git a/man/cec.Rd b/man/cec.Rd index 3330ebe..3da7ba3 100644 --- a/man/cec.Rd +++ b/man/cec.Rd @@ -160,7 +160,7 @@ Cross-Entropy Clustering (CEC) aims to partition \emph{m} points implementations of \emph{\strong{H}} have been proposed (expressed as a type - model - of the clustering): - \itemize{ + \describe{ \item{"all": }{All Gaussian densities. Data will form ellipsoids with arbitrary radiuses.} \item{"covariance": }{Gaussian densities with a fixed given covariance. The diff --git a/man/init.centers.Rd b/man/init.centers.Rd index 4f2e8ec..2efbeb7 100644 --- a/man/init.centers.Rd +++ b/man/init.centers.Rd @@ -15,9 +15,8 @@ must not contain \code{NA} values.} \item{method}{A character string indicating the initialization method to use. It can take the following values: -\itemize{ - \item{"kmeans++": }{the centers are selected using the k-means++ algorithm. - } +\describe{ + \item{"kmeans++": }{the centers are selected using the k-means++ algorithm.} \item{"random": }{the centers are randomly selected among the values in \code{x}} }} From 8a7a88884eab1716e78c768d24910e562490586b Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Sat, 2 Dec 2023 08:02:56 -0500 Subject: [PATCH 4/8] Fix URL --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 702f0b1..e6d7df2 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![R-CMD-check](https://github.com/swarm-lab/cec/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/swarm-lab/cec/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/swarm-lab/cec/branch/master/graph/badge.svg)](https://app.codecov.io/gh/swarm-lab/cec?branch=master) -[![CRAN status](https://www.r-pkg.org/badges/version/CEC)](https://CRAN.R-project.org/package=CEC) -[![CRANLOGS downloads](https://cranlogs.r-pkg.org/badges/cec)](https://cran.r-project.org/package=cec) +[![CRAN status](https://www.r-pkg.org/badges/version/CEC)](https://cran.r-project.org/package=CEC) +[![CRANLOGS downloads](https://cranlogs.r-pkg.org/badges/cec)](https://cran.r-project.org/package=CEC) ## Description From 4e595eae2da8e01dba7076ee19b29442246935d9 Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Sat, 2 Dec 2023 08:23:13 -0500 Subject: [PATCH 5/8] Add reverse dependency check. --- revdep/README.md | 24 ++++++++++++++++++++++++ revdep/cran.md | 7 +++++++ revdep/failures.md | 1 + revdep/problems.md | 1 + 4 files changed, 33 insertions(+) create mode 100644 revdep/README.md create mode 100644 revdep/cran.md create mode 100644 revdep/failures.md create mode 100644 revdep/problems.md diff --git a/revdep/README.md b/revdep/README.md new file mode 100644 index 0000000..8462b94 --- /dev/null +++ b/revdep/README.md @@ -0,0 +1,24 @@ +# Platform + +|field |value | +|:--------|:------------------------------------------| +|version |R version 4.3.2 (2023-10-31) | +|os |macOS Sonoma 14.1.2 | +|system |aarch64, darwin20 | +|ui |RStudio | +|language |(EN) | +|collate |en_US.UTF-8 | +|ctype |en_US.UTF-8 | +|tz |America/New_York | +|date |2023-12-02 | +|rstudio |2023.09.1+494 Desert Sunflower (desktop) | +|pandoc |3.1.9 @ /opt/homebrew/bin/ (via rmarkdown) | + +# Dependencies + +|package |old |new |Δ | +|:-------|:------|:------|:--| +|CEC |0.11.0 |0.11.1 |* | + +# Revdeps + diff --git a/revdep/cran.md b/revdep/cran.md new file mode 100644 index 0000000..782ef68 --- /dev/null +++ b/revdep/cran.md @@ -0,0 +1,7 @@ +## revdepcheck results + +We checked 1 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. + + * We saw 0 new problems + * We failed to check 0 packages + diff --git a/revdep/failures.md b/revdep/failures.md new file mode 100644 index 0000000..9a20736 --- /dev/null +++ b/revdep/failures.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file diff --git a/revdep/problems.md b/revdep/problems.md new file mode 100644 index 0000000..9a20736 --- /dev/null +++ b/revdep/problems.md @@ -0,0 +1 @@ +*Wow, no problems at all. :)* \ No newline at end of file From 7c433c6f909f0a9040b29a6ca4d8aab29cedf3cf Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Sat, 2 Dec 2023 08:25:24 -0500 Subject: [PATCH 6/8] Update cran-comments.md --- cran-comments.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 6d2fb22..089fdc8 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -19,7 +19,10 @@ There were no ERRORs or WARNINGs. ## Downstream dependencies -There are currently no downstream dependencies for this package. +Downstream dependencies on CRAN and Bioconductor were checked with ‘revdepcheck::revdep_check()’. We checked 1 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. + + * We saw 0 new problems + * We failed to check 0 packages ## CRAN team comments From 349916bdce36fe8ea54faedd02d84296704fa6ad Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Mon, 8 Jan 2024 14:35:06 +0100 Subject: [PATCH 7/8] Update .Rbuildignore --- .Rbuildignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.Rbuildignore b/.Rbuildignore index 7dbc4a9..fba9064 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ logo.* cran-comments.md ^CRAN-SUBMISSION$ ^codecov\.yml$ +revdep From f6918db1b9150c38719a1d821cf1849cd6cfcc67 Mon Sep 17 00:00:00 2001 From: Simon Garnier Date: Mon, 8 Jan 2024 14:59:33 +0100 Subject: [PATCH 8/8] Update date --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f7ac5d5..1bed299 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: CEC Type: Package Title: Cross-Entropy Clustering Version: 0.11.1 -Date: 2023-11-30 +Date: 2024-01-08 Authors@R: c( person("Kamieniecki", "Konrad", email = "konrad.kamieniecki@alumni.uj.edu.pl", role = c("aut")),