Skip to content

Commit

Permalink
Merge pull request #114 from inbo/hotfix
Browse files Browse the repository at this point in the history
Hotfix
  • Loading branch information
ThierryO authored Jul 14, 2023
2 parents cef05b1 + b2d40a9 commit 3413f5f
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check_on_different_r_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
if: runner.os != 'linux'
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@ on:
tags:
- v*
workflow_run:
workflows: ["check package on main"]
workflows: ["check package on main with checklist"]
types:
- completed

jobs:

build:
prepare:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.gettag.outputs.tag }}
body: ${{ steps.gettag.outputs.body }}
steps:
- uses: actions/checkout@v3
- name: Get tag message
- name: Get tag
run: |
git fetch --tags --force
TAG=$(git tag --contains $(git rev-parse HEAD))
TAG_BODY=$(git tag --contains $(git rev-parse HEAD) -n100 | awk '(NR>2)')
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "TAG_BODY=$TAG_BODY" >> $GITHUB_OUTPUT
id: tag-body
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "body=$TAG_BODY" >> "$GITHUB_OUTPUT"
id: gettag
publish:
runs-on: ubuntu-latest
permissions:
contents: write
needs: prepare
steps:
- uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.tag-body.outputs.TAG }}
tag: ${{ steps.tag-body.outputs.TAG }}
body: ${{ steps.tag-body.outputs.TAG_BODY }}
name: Release ${{needs.prepare.outputs.tag}}
tag: ${{needs.prepare.outputs.tag}}
body: ${{needs.prepare.outputs.body}}
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code",
"version": "0.3.4",
"version": "0.3.5",
"license": "GPL-3.0",
"upload_type": "software",
"description": "<p>An opinionated set of rules for R packages and R source code\nprojects.<\/p>",
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ identifiers:
value: 10.5281/zenodo.4028303
- type: url
value: https://inbo.github.io/checklist/
version: 0.3.4
version: 0.3.5
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: checklist
Title: A Thorough and Strict Set of Checks for R Packages and Source Code
Version: 0.3.4
Version: 0.3.5
Authors@R: c(
person("Thierry", "Onkelinx", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# checklist 0.3.5

* Fix release GitHub Action.
* Bugfix in `update_citation()` on a `DESCRIPTION`.
* `check_spelling()` handles Roxygen2 tags `@aliases`, `@importMethodsFrom`,
`@include`, `@keywords`, `@method`, `@name`, `@slot`

# checklist 0.3.4

* `check_spelling()` ignores numbers.
Expand Down
2 changes: 1 addition & 1 deletion R/citation_description.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ description_author_format <- function(i, x) {
)[x[[i]]$role]
)
formatted$organisation <- ifelse(
is.null(x[[i]]), "", gsub(".*@", "", x[[i]]$email)
is.null(x[[i]]$email), "", gsub(".*@", "", x[[i]]$email)
)
if (is.null(x[[i]]$comment)) {
formatted$orcid <- ""
Expand Down
5 changes: 4 additions & 1 deletion R/citation_meta_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,10 @@ citation_r <- function(meta) {
"\"%s (%s) %s. Version %s. %s\"",
paste(authors_plain, collapse = "; "), format(Sys.Date(), "%Y"),
cit_meta$title, cit_meta$version,
paste0(paste(c(cit_meta$source, cit_meta$url), collapse = "; "), "")
ifelse(
length(cit_meta$url), paste(cit_meta$url, collapse = "; "),
cit_meta$source
)
),
keywords = paste0("\"", paste(cit_meta$keywords, collapse = "; "), "\"")
)
Expand Down
8 changes: 4 additions & 4 deletions R/spelling_parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spelling_parse_r <- function(r_file, wordlist) {
text <- ifelse(keep, raw_text, "")

# remove multiline tags
c("examples", "importFrom", "aliases") |>
c("aliases", "examples", "importFrom", "importMethodsFrom") |>
paste(collapse = "|") |>
sprintf(fmt = "^#'\\s*@(%s)") |>
grep(text) -> multiline
Expand All @@ -35,16 +35,16 @@ spelling_parse_r <- function(r_file, wordlist) {
gsub("", text) -> text

# remove the tag and the first word
c("param", "reference") |>
c("param", "reference", "slot") |>
paste(collapse = "|") |>
sprintf(fmt = "^#'\\s*@(%s)\\s+(\\w|\\.)+") |>
gsub("", text, perl = TRUE) -> text

# remove the entire line for certain tags
c(
"author", "docType", "export", "exportClass", "exportMethod", "family",
"importClassesFrom", "importFrom", "inherit\\w*Params", "keywords", "name",
"rdname", "seealso", "title", "template"
"importClassesFrom", "importFrom", "include", "inherit\\w*Params",
"keywords", "name", "method", "rdname", "seealso", "title", "template"
) |>
paste(collapse = "|") |>
sprintf(fmt = "^#'\\s*@(%s) .*") |>
Expand Down
4 changes: 3 additions & 1 deletion R/use_author.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ ask_orcid <- function(prompt = "orcid: ") {
return(orcid)
}
while (!validate_orcid(orcid)) {
cat("\nPlease provide a valid ORCiD in the format `0000-0000-0000-0000`\n")
message(
"\nPlease provide a valid ORCiD in the format `0000-0000-0000-0000`\n"
)
orcid <- readline(prompt = prompt)
}
return(orcid)
Expand Down
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ citHeader("To cite `checklist` in publications please use:")
# begin checklist entry
bibentry(
bibtype = "Manual",
title = "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.4",
title = "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.5",
author = c( author = c(person(given = "Thierry", family = "Onkelinx"))),
year = 2023,
url = "https://inbo.github.io/checklist/",
abstract = "An opinionated set of rules for R packages and R source code projects.",
textVersion = "Onkelinx, Thierry (2023) checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.4. https://github.com/inbo/checklist/; https://inbo.github.io/checklist/",
textVersion = "Onkelinx, Thierry (2023) checklist: A Thorough and Strict Set of Checks for R Packages and Source Code. Version 0.3.5. https://inbo.github.io/checklist/",
keywords = "quality control; documentation; publication",
doi = "10.5281/zenodo.4028303",
)
Expand Down
3 changes: 3 additions & 0 deletions inst/package_template/check_on_different_r_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
32 changes: 19 additions & 13 deletions inst/package_template/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@ on:
tags:
- v*
workflow_run:
workflows: ["check package on main"]
workflows: ["check package on main with checklist"]
types:
- completed

jobs:

build:
prepare:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.gettag.outputs.tag }}
body: ${{ steps.gettag.outputs.body }}
steps:
- uses: actions/checkout@v3
- name: Get tag message
- name: Get tag
run: |
git fetch --tags --force
TAG=$(git tag --contains $(git rev-parse HEAD))
TAG_BODY=$(git tag --contains $(git rev-parse HEAD) -n100 | awk '(NR>2)')
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "TAG_BODY=$TAG_BODY" >> $GITHUB_OUTPUT
id: tag-body
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "body=$TAG_BODY" >> "$GITHUB_OUTPUT"
id: gettag
publish:
runs-on: ubuntu-latest
permissions:
contents: write
needs: prepare
steps:
- uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.tag-body.outputs.TAG }}
tag: ${{ steps.tag-body.outputs.TAG }}
body: ${{ steps.tag-body.outputs.TAG_BODY }}
name: Release ${{needs.prepare.outputs.tag}}
tag: ${{needs.prepare.outputs.tag}}
body: ${{needs.prepare.outputs.body}}
2 changes: 1 addition & 1 deletion tests/testthat/test_a_author.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_that("author tools", {
stub(ask_orcid, "readline", mock(""))
expect_equal(ask_orcid(), "")
stub(ask_orcid, "readline", mock("junk", "0000-0002-1825-0097"))
expect_equal(ask_orcid(), "0000-0002-1825-0097")
expect_equal(suppressMessages(ask_orcid()), "0000-0002-1825-0097")

root <- tempfile("author")
expect_false(is_dir(root))
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test_e_bookdown_zenodo.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_that("bookdown_zenodo() works", {
skip_if_not_installed("zen4R")
skip_if_not_installed("bookdown")
skip_if(Sys.getenv("MY_UNIVERSE") != "") # skip test on r-universe.dev
expect_match(Sys.getenv("ZENODO_SANDBOX"), "^\\w{60}$")
sandbox_token <- Sys.getenv("ZENODO_SANDBOX")

Expand Down

0 comments on commit 3413f5f

Please sign in to comment.