Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^[\.]?air\.toml$
^\.vscode$
1 change: 0 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: R-CMD-check.yaml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: test-coverage.yaml
Expand Down Expand Up @@ -42,14 +41,16 @@ jobs:
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"Posit.air-vscode"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[r]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "Posit.air-vscode"
}
}
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Title: Cache 'CRAN'-Like Metadata and R Packages
Version: 2.2.3.9000
Authors@R: c(
person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")),
person("Posit Software, PBC", role = c("cph", "fnd"))
person("Posit Software, PBC", role = c("cph", "fnd"),
comment = c(ROR = "03wc8by49"))
)
Description: Metadata and package cache for CRAN-like repositories. This
is a utility package to be used by package management tools that want
Expand Down Expand Up @@ -40,7 +41,8 @@ Suggests:
zip
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Config/usethis/last-upkeep: 2025-04-30
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE, r6 = FALSE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.2.9000
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
YEAR: 2025
COPYRIGHT HOLDER: pkgcache authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 pkgcache authors
Copyright (c) 2025 pkgcache authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 14 additions & 11 deletions R/aa-assertthat.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

assert_that <- function(..., env = parent.frame(), msg = NULL) {
res <- see_if(..., env = env, msg = msg)
if (res) return(TRUE)

throw(new_assert_error(attr(res, "msg")))
}

new_assert_error <- function (message, call = NULL) {
new_assert_error <- function(message, call = NULL) {
cond <- new_error(message, call. = call)
class(cond) <- c("assert_error", class(cond))
cond
Expand All @@ -16,17 +15,19 @@ see_if <- function(..., env = parent.frame(), msg = NULL) {
asserts <- eval(substitute(alist(...)))

for (assertion in asserts) {
res <- tryCatch({
eval(assertion, env)
}, error = function(e) {
structure(FALSE, msg = e$message)
})
res <- tryCatch(
{
eval(assertion, env)
},
error = function(e) {
structure(FALSE, msg = e$message)
}
)
check_result(res)

# Failed, so figure out message to produce
if (!res) {
if (is.null(msg))
msg <- get_message(res, assertion, env)
if (is.null(msg)) msg <- get_message(res, assertion, env)
return(structure(FALSE, msg = msg))
}
}
Expand All @@ -36,7 +37,9 @@ see_if <- function(..., env = parent.frame(), msg = NULL) {

check_result <- function(x) {
if (!is.logical(x))
throw(new_assert_error("assert_that: assertion must return a logical value"))
throw(new_assert_error(
"assert_that: assertion must return a logical value"
))
if (any(is.na(x)))
throw(new_assert_error("assert_that: missing values present in assertion"))
if (length(x) != 1) {
Expand Down Expand Up @@ -68,7 +71,7 @@ get_message <- function(res, call, env = parent.frame()) {
fail_default <- function(call, env) {
call_string <- deparse(call, width.cutoff = 60L)
if (length(call_string) > 1L) {
call_string <- paste0(call_string[1L], "...")
call_string <- paste0(call_string[1L], "...")
}

paste0(call_string, " is not TRUE")
Expand Down
Loading