Skip to content

Commit

Permalink
Merge pull request #229 from jmbarbone/dev
Browse files Browse the repository at this point in the history
dev updates
  • Loading branch information
jmbarbone authored May 23, 2024
2 parents acc2258 + 2fc1d7b commit 2cc0821
Show file tree
Hide file tree
Showing 24 changed files with 321 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sys.setenv(TESTTHAT_CPUS = 4)
options(Ncpus = 4)

# Some issue where this was failing in tests
Sys.setenv(TESTTHAT_PARALLEL = if (getRversion() < 4) "FALSE" else "TRUE")
Sys.setenv(TESTTHAT_PARALLEL = if (getRversion() < "4") "FALSE" else "TRUE")

if (file.exists("~/.Rprofile")) {
source("~/.Rprofile", print.eval = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: R-CMD-check

Expand All @@ -30,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -48,3 +47,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
3 changes: 1 addition & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: lint

Expand All @@ -15,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -41,7 +41,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand All @@ -30,7 +30,8 @@ jobs:
needs: pr-document

- name: Document
run: Rscript -e 'roxygen2::roxygenise()'
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: commit
run: |
Expand All @@ -50,7 +51,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand All @@ -59,10 +60,12 @@ jobs:
- uses: r-lib/actions/setup-r@v2

- name: Install dependencies
run: Rscript -e 'install.packages("styler")'
run: install.packages("styler")
shell: Rscript {0}

- name: Style
run: Rscript -e 'styler::style_pkg()'
run: styler::style_pkg()
shell: Rscript {0}

- name: commit
run: |
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -27,5 +27,24 @@ jobs:
needs: coverage

- name: Test coverage
run: covr::codecov()
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "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@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mark
Type: Package
Title: Miscellaneous, Analytic R Kernels
Version: 0.7.0.9007
Version: 0.7.0.9008
Authors@R:
person(given = "Jordan Mark",
family = "Barbone",
Expand All @@ -22,7 +22,7 @@ Depends:
Imports:
cli,
fs (>= 1.6.2),
fuj (>= 0.1.4),
fuj (>= 0.2.1),
magrittr (>= 2.0.1),
rlang,
stats (>= 3.6),
Expand All @@ -49,7 +49,7 @@ Suggests:
xopen,
yaml,
jsonlite
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
Config/testthat/parallel: true
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export(ls_dataframe)
export(ls_function)
export(ls_object)
export(make_sf)
export(mark_compress_methods)
export(mark_write_methods)
export(match_arg)
export(match_param)
export(median2)
Expand Down
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* includes `tryn()` for running an expression a maximum number of times before failure [#80](https://github.com/jmbarbone/mark/issues/80)
* `echo()` is deprecated in favor of `echo::echo()` [#210](https://github.com/jmbarbone/mark/issues/210) (this was incorrectly listed in the previous release)
* `match_param()` enhancements
* can now return multiple matches [#191](https:://github.com/jmbarbone/mark/issues/191), and can return partial matches
* error message readability improved for `matchParamMatchError`
* can now return multiple matches [#191](https://github.com/jmbarbone/mark/issues/191), and can return partial matches
* error message readability improved for `matchParamMatchError`[#194](https://github.com/jmbarbone/mark/issues/194)
* `choices` can now be a list of `formula` elements, preserving the return value
* `unlist0()` no longer fails when input list is not named [#220](https://github.com/jmbarbone/mark/issues/220)
* `file_copy_md5()` added as a wrapper for `fs::file_copy()` but provides MD5 checks through `tools::md5sum()` to avoid overwriting files that had no content changes [#207](https://github.com/jmbarbone/mark/issues/207)
Expand Down
2 changes: 1 addition & 1 deletion R/base-conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ alpha_base <- function(x, base = 26) {
}

base_alpha_single <- function(x, base) {
a <- letters %wi% chr_split(tolower(x))
a <- chr_split(tolower(x)) %wi% letters
a <- match(a, letters[1:base], nomatch = NA_integer_)

if (anyNA(a)) {
Expand Down
15 changes: 13 additions & 2 deletions R/match-arg.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,14 @@ cond_match_param_match <- function(
return(toString(x))
}

toString(sprintf("%s = %s", names(x), x))
nms <- names(x)
if (is.null(nms)) {
return(toString(x))
}

ok <- nzchar(nms)
nms[ok] <- paste(nms[ok], "= ")
toString(paste0(nms, x))
}

to_options <- function(x) {
Expand All @@ -234,7 +241,11 @@ cond_match_param_match <- function(

collapse(mapply(
function(x, nm) {
sprintf("%s = %s", nm, toString(x))
if (nzchar(nm)) {
sprintf("%s = %s", nm, toString(x))
} else {
toString(x)
}
},
x = x,
nm = names(x),
Expand Down
2 changes: 1 addition & 1 deletion R/todos.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ do_todo <- function( # nolint: cyclocomp_linter.
}

finds <- lapply(
lapply(files, readLines, warn = FALSE),
lapply(files, readLines, warn = FALSE, skipNul = TRUE),
function(x, regex) {
x <- enc2utf8(x)
ind <- grep(pattern = regex, x = x)
Expand Down
Loading

0 comments on commit 2cc0821

Please sign in to comment.