mirror of
https://github.com/msberends/AMR.git
synced 2026-03-30 06:55:56 +02:00
Compare commits
4 Commits
8760c6d85a
...
eae14d44bf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eae14d44bf | ||
|
|
11c175ae19 | ||
|
|
ec3b12b937 | ||
|
|
5ecbc9001e |
@@ -28,11 +28,8 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
# run in each PR in this repo
|
|
||||||
branches: '**'
|
|
||||||
push:
|
push:
|
||||||
branches: '**'
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
# also run a schedule everyday at 1 AM.
|
# also run a schedule everyday at 1 AM.
|
||||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||||
|
|||||||
33
.github/workflows/check-current-testthat.yaml
vendored
33
.github/workflows/check-current-testthat.yaml
vendored
@@ -41,7 +41,22 @@ on:
|
|||||||
name: check-recent
|
name: check-recent
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- id: set-matrix
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
|
echo 'matrix={"config":[{"os":"ubuntu-latest","r":"release","allowfail":false}]}' >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo 'matrix={"config":[{"os":"windows-latest","r":"devel","allowfail":false},{"os":"ubuntu-latest","r":"devel","allowfail":false,"http-user-agent":"release"},{"os":"macOS-latest","r":"release","allowfail":true},{"os":"windows-latest","r":"release","allowfail":false},{"os":"ubuntu-latest","r":"release","allowfail":false},{"os":"ubuntu-latest","r":"oldrel-1","allowfail":false},{"os":"ubuntu-latest","r":"oldrel-2","allowfail":false},{"os":"ubuntu-latest","r":"oldrel-3","allowfail":false},{"os":"ubuntu-latest","r":"oldrel-4","allowfail":false}]}' >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
R-code-check:
|
R-code-check:
|
||||||
|
needs: setup
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
|
||||||
continue-on-error: ${{ matrix.config.allowfail }}
|
continue-on-error: ${{ matrix.config.allowfail }}
|
||||||
@@ -50,23 +65,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
|
||||||
config:
|
|
||||||
# current development version, check all major OSes:
|
|
||||||
# - {os: macOS-latest, r: 'devel', allowfail: true}
|
|
||||||
- {os: windows-latest, r: 'devel', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'devel', allowfail: false, http-user-agent: 'release'}
|
|
||||||
|
|
||||||
# current 'release' version, check all major OSes:
|
|
||||||
- {os: macOS-latest, r: 'release', allowfail: true}
|
|
||||||
- {os: windows-latest, r: 'release', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'release', allowfail: false}
|
|
||||||
|
|
||||||
# older versions (see also check-old-tinytest.yaml for even older versions):
|
|
||||||
- {os: ubuntu-latest, r: 'oldrel-1', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'oldrel-2', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'oldrel-3', allowfail: false}
|
|
||||||
- {os: ubuntu-latest, r: 'oldrel-4', allowfail: false}
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
4
.github/workflows/check-old-tinytest.yaml
vendored
4
.github/workflows/check-old-tinytest.yaml
vendored
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# only run after a git push on any branch in this repo
|
# only run after a git push on the main branch
|
||||||
branches: '**'
|
branches: [main]
|
||||||
|
|
||||||
name: check-old
|
name: check-old
|
||||||
|
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ cli_to_plain <- function(msg, envir = parent.frame()) {
|
|||||||
|
|
||||||
apply_sub <- function(msg, pattern, formatter) {
|
apply_sub <- function(msg, pattern, formatter) {
|
||||||
while (grepl(pattern, msg, perl = TRUE)) {
|
while (grepl(pattern, msg, perl = TRUE)) {
|
||||||
m <- regexec(pattern, msg, perl = TRUE)
|
m <- regexec(pattern, msg)
|
||||||
matches <- regmatches(msg, m)[[1]]
|
matches <- regmatches(msg, m)[[1]]
|
||||||
if (length(matches) < 2L) break
|
if (length(matches) < 2L) break
|
||||||
full_match <- matches[1L]
|
full_match <- matches[1L]
|
||||||
@@ -462,12 +462,12 @@ cli_to_plain <- function(msg, envir = parent.frame()) {
|
|||||||
msg <- apply_sub(msg, "\\{\\.emph (\\{[^}]+\\}|[^}]+)\\}", function(c) paste0("*", resolve(c), "*"))
|
msg <- apply_sub(msg, "\\{\\.emph (\\{[^}]+\\}|[^}]+)\\}", function(c) paste0("*", resolve(c), "*"))
|
||||||
msg <- apply_sub(msg, "\\{\\.help ([^}]+)\\}", function(c) {
|
msg <- apply_sub(msg, "\\{\\.help ([^}]+)\\}", function(c) {
|
||||||
# Handle [display text](topic) markdown link format: extract just the display text
|
# Handle [display text](topic) markdown link format: extract just the display text
|
||||||
m <- regmatches(c, regexec("^\\[(.*)\\]\\([^)]*\\)$", c, perl = TRUE))[[1L]]
|
m <- regmatches(c, regexec("^\\[(.*)\\]\\([^)]*\\)$", c))[[1L]]
|
||||||
if (length(m) >= 2L) m[2L] else paste0("`", resolve(c), "`")
|
if (length(m) >= 2L) m[2L] else paste0("`", resolve(c), "`")
|
||||||
})
|
})
|
||||||
msg <- apply_sub(msg, "\\{\\.topic ([^}]+)\\}", function(c) {
|
msg <- apply_sub(msg, "\\{\\.topic ([^}]+)\\}", function(c) {
|
||||||
# Handle [display text](topic) markdown link format: extract just the display text
|
# Handle [display text](topic) markdown link format: extract just the display text
|
||||||
m <- regmatches(c, regexec("^\\[(.*)\\]\\([^)]*\\)$", c, perl = TRUE))[[1L]]
|
m <- regmatches(c, regexec("^\\[(.*)\\]\\([^)]*\\)$", c))[[1L]]
|
||||||
if (length(m) >= 2L) m[2L] else paste0("?", resolve(c))
|
if (length(m) >= 2L) m[2L] else paste0("?", resolve(c))
|
||||||
})
|
})
|
||||||
msg <- apply_sub(msg, "\\{\\.url (\\{[^}]+\\}|[^}]+)\\}", function(c) resolve(c))
|
msg <- apply_sub(msg, "\\{\\.url (\\{[^}]+\\}|[^}]+)\\}", function(c) resolve(c))
|
||||||
@@ -475,7 +475,7 @@ cli_to_plain <- function(msg, envir = parent.frame()) {
|
|||||||
|
|
||||||
# bare {variable} or {expression} -> evaluate in caller's environment
|
# bare {variable} or {expression} -> evaluate in caller's environment
|
||||||
while (grepl("\\{[^{}]+\\}", msg)) {
|
while (grepl("\\{[^{}]+\\}", msg)) {
|
||||||
m <- regexec("\\{([^{}]+)\\}", msg, perl = TRUE)
|
m <- regexec("\\{([^{}]+)\\}", msg)
|
||||||
matches <- regmatches(msg, m)[[1]]
|
matches <- regmatches(msg, m)[[1]]
|
||||||
if (length(matches) < 2L) break
|
if (length(matches) < 2L) break
|
||||||
full_match <- matches[1L]
|
full_match <- matches[1L]
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ count_resistant <- function(...,
|
|||||||
# other arguments for meet_criteria are handled by sir_calc()
|
# other arguments for meet_criteria are handled by sir_calc()
|
||||||
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
||||||
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("count_resistant", "eucast_default", entire_session = TRUE)) {
|
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("count_resistant", "eucast_default", entire_session = TRUE)) {
|
||||||
message_("{.help [{.fun count_resistant}](AMR::count_resistant)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic AMR-options}.")
|
message_("{.help [{.fun count_resistant}](AMR::count_resistant)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic [AMR-options](AMR::AMR-options)}.")
|
||||||
message_("This message will be shown once per session.")
|
message_("This message will be shown once per session.")
|
||||||
}
|
}
|
||||||
tryCatch(
|
tryCatch(
|
||||||
@@ -152,7 +152,7 @@ count_susceptible <- function(...,
|
|||||||
# other arguments for meet_criteria are handled by sir_calc()
|
# other arguments for meet_criteria are handled by sir_calc()
|
||||||
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
||||||
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("count_susceptible", "eucast_default", entire_session = TRUE)) {
|
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("count_susceptible", "eucast_default", entire_session = TRUE)) {
|
||||||
message_("{.help [{.fun count_susceptible}](AMR::count_susceptible)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic AMR-options}.")
|
message_("{.help [{.fun count_susceptible}](AMR::count_susceptible)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic [AMR-options](AMR::AMR-options)}.")
|
||||||
message_("This message will be shown once per session.")
|
message_("This message will be shown once per session.")
|
||||||
}
|
}
|
||||||
tryCatch(
|
tryCatch(
|
||||||
|
|||||||
@@ -1097,7 +1097,7 @@ eucast_rules <- function(x,
|
|||||||
rules = getOption("AMR_interpretive_rules", default = c("breakpoints", "expected_phenotypes")),
|
rules = getOption("AMR_interpretive_rules", default = c("breakpoints", "expected_phenotypes")),
|
||||||
...) {
|
...) {
|
||||||
if (!is.null(getOption("AMR_eucastrules", default = NULL))) {
|
if (!is.null(getOption("AMR_eucastrules", default = NULL))) {
|
||||||
warning_("The global option {.code AMR_eucastrules} that you have set is now invalid was ignored - set {.code AMR_interpretive_rules} instead. See {.topic AMR-options}.")
|
warning_("The global option {.code AMR_eucastrules} that you have set is now invalid was ignored - set {.code AMR_interpretive_rules} instead. See {.topic [AMR-options](AMR::AMR-options)}.")
|
||||||
}
|
}
|
||||||
interpretive_rules(x = x, col_mo = col_mo, info = info, rules = rules, guideline = "EUCAST", ...)
|
interpretive_rules(x = x, col_mo = col_mo, info = info, rules = rules, guideline = "EUCAST", ...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ resistance <- function(...,
|
|||||||
# other arguments for meet_criteria are handled by sir_calc()
|
# other arguments for meet_criteria are handled by sir_calc()
|
||||||
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
||||||
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("resistance", "eucast_default", entire_session = TRUE)) {
|
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("resistance", "eucast_default", entire_session = TRUE)) {
|
||||||
message_("{.help [{.fun resistance}](AMR::resistance)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic AMR-options}.")
|
message_("{.help [{.fun resistance}](AMR::resistance)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic [AMR-options](AMR::AMR-options)}.")
|
||||||
message_("This message will be shown once per session.")
|
message_("This message will be shown once per session.")
|
||||||
}
|
}
|
||||||
tryCatch(
|
tryCatch(
|
||||||
@@ -266,7 +266,7 @@ susceptibility <- function(...,
|
|||||||
# other arguments for meet_criteria are handled by sir_calc()
|
# other arguments for meet_criteria are handled by sir_calc()
|
||||||
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
meet_criteria(guideline, allow_class = "character", is_in = c("EUCAST", "CLSI"), has_length = 1)
|
||||||
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("susceptibility", "eucast_default", entire_session = TRUE)) {
|
if (is.null(getOption("AMR_guideline")) && missing(guideline) && message_not_thrown_before("susceptibility", "eucast_default", entire_session = TRUE)) {
|
||||||
message_("{.help [{.fun susceptibility}](AMR::susceptibility)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic AMR-options}.")
|
message_("{.help [{.fun susceptibility}](AMR::susceptibility)} assumes the EUCAST guideline and thus considers the 'I' category susceptible. Set the {.arg guideline} argument or the {.code AMR_guideline} option to either \"CLSI\" or \"EUCAST\", see {.topic [AMR-options](AMR::AMR-options)}.")
|
||||||
message_("This message will be shown once per session.")
|
message_("This message will be shown once per session.")
|
||||||
}
|
}
|
||||||
tryCatch(
|
tryCatch(
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ deprecation_warning <- function(old = NULL, new = NULL, fn = NULL, extra_msg = N
|
|||||||
". The old name will be removed in future version, so please update your code.",
|
". The old name will be removed in future version, so please update your code.",
|
||||||
ifelse(type == "argument",
|
ifelse(type == "argument",
|
||||||
". While the old argument still works, it will be removed in a future version, so please update your code.",
|
". While the old argument still works, it will be removed in a future version, so please update your code.",
|
||||||
" and will be removed in a future version, see {.topic AMR-deprecated}."
|
" and will be removed in a future version, see {.topic [AMR-deprecated](AMR::AMR-deprecated)}."
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
ifelse(!is.null(extra_msg),
|
ifelse(!is.null(extra_msg),
|
||||||
|
|||||||
Reference in New Issue
Block a user