Skip to content

Commit

Permalink
Merge branch 'master' into fix_tinytex
Browse files Browse the repository at this point in the history
  • Loading branch information
arnfinn authored Oct 21, 2024
2 parents 4a3f866 + 9b68c39 commit 6649af5
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
GITHUB_ACTIONS_RUN_DB_UNIT_TESTS: true
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name: lint

jobs:
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
steps:
Expand All @@ -24,14 +24,11 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: |
any::lintr
needs: lint
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: |
lintr::lint_package()
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: false
LINTR_ERROR_ON_LINT: true
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.6.1
uses: JamesIves/github-pages-deploy-action@v4.6.8
with:
clean: false
branch: gh-pages
Expand Down
1 change: 1 addition & 0 deletions .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ linters: linters_with_defaults(
object_name_linter(c("camelCase", "snake_case")),
cyclocomp_linter(complexity_limit = 30),
line_length_linter(80))
exclusions: list("data-raw", "tests")
18 changes: 13 additions & 5 deletions R/autoReport.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,12 @@ writeAutoReportData <- function(fileName = "autoReport.yml", config,
)
# to maintain some order, remove files older than 30 days
files <- file.info(list.files(bckFilePath, full.names = TRUE))
rmFiles <- rownames(files[difftime(Sys.time(), files[, "mtime"],
units = "days"
) > 30, ])
rmFiles <- rownames(files[difftime(Sys.time(),
files[, "mtime"],
units = "days"
) > 30,
]
)
file.remove(rmFiles)
con <- file(oriFile, "w")
}
Expand Down Expand Up @@ -453,10 +456,13 @@ getRegs <- function(config) {
#' runAutoReport()
#' }
#'

runAutoReport <- function(dayNumber = as.POSIXlt(Sys.Date())$yday + 1,
type = c("subscription", "dispatchment"),
dryRun = FALSE) {
# nolint start: object_name_linter
. <- ""
# nolint end

# get report candidates
reps <- readAutoReportData() %>%
Expand All @@ -474,8 +480,8 @@ runAutoReport <- function(dayNumber = as.POSIXlt(Sys.Date())$yday + 1,
{
rep <- reps[[i]]
if (dayNumber %in% rep$runDayOfYear &
as.Date(rep$terminateDate) > Sys.Date() &
as.Date(rep$startDate) <= Sys.Date()) {
as.Date(rep$terminateDate) > Sys.Date() &
as.Date(rep$startDate) <= Sys.Date()) {
# get explicit referenced function and call it
f <- .getFun(paste0(rep$package, "::", rep$fun))
content <- do.call(what = f, args = rep$params)
Expand Down Expand Up @@ -709,7 +715,9 @@ makeAutoReportTab <- function(session,
includeReportId = FALSE) {
stopifnot(type %in% c("subscription", "dispatchment", "bulletin"))

# nolint start: object_name_linter
. <- ""
# nolint end

l <- list()
autoRep <- readAutoReportData() %>%
Expand Down
2 changes: 1 addition & 1 deletion R/fireInTheHole.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fireInTheHole <- function(flipPeriod = FALSE) {
conf <- getConfig(fileName = "rapbaseConfig.yml")

if (hour >= conf$r$schedule$nocturnal$startHour &&
hour < conf$r$schedule$nocturnal$endHour) {
hour < conf$r$schedule$nocturnal$endHour) {
night <- TRUE
} else {
night <- FALSE
Expand Down
16 changes: 8 additions & 8 deletions R/log.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ appendLog <- function(event, name) {
doAppend <- TRUE
doColNames <- FALSE
if (!file.exists(file.path(path, name)) ||
file.size(file.path(path, name)) == 0) {
file.size(file.path(path, name)) == 0) {
doAppend <- FALSE
doColNames <- TRUE
}
Expand Down Expand Up @@ -440,13 +440,13 @@ sanitizeLog <- function() {
lf <- lf %>%
dplyr::filter(as.Date(.data$time) > eolDate)
write.table(
lf,
logFile[i],
append = FALSE,
sep = ",",
row.names = FALSE,
col.names = TRUE,
qmethod = "double")
lf,
logFile[i],
append = FALSE,
sep = ",",
row.names = FALSE,
col.names = TRUE,
qmethod = "double")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ getRapPackages <- function() {
#'
isRapContext <- function() {
if (Sys.getenv("R_RAP_INSTANCE") %in%
c("DEV", "TEST", "QA", "PRODUCTION", "PRODUCTIONC")) {
c("DEV", "TEST", "QA", "PRODUCTION", "PRODUCTIONC")) {
return(TRUE)
} else {
return(FALSE)
Expand Down
59 changes: 30 additions & 29 deletions R/moduleAutoReport.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,13 @@ autoReportServer <- function(id, registryName, type, org = NULL,

stopifnot(freq %in% c("day", "week", "month", "quarter", "year"))

defaultFreq <- switch(freq,
day = "Daglig-day",
week = "Ukentlig-week",
month = "M\u00E5nedlig-month",
quarter = "Kvartalsvis-quarter",
year = "\u00C5rlig-year"
defaultFreq <- switch(
freq,
day = "Daglig-day",
week = "Ukentlig-week",
month = "M\u00E5nedlig-month",
quarter = "Kvartalsvis-quarter",
year = "\u00C5rlig-year"
)

shiny::moduleServer(id, function(input, output, session) {
Expand Down Expand Up @@ -416,8 +417,8 @@ autoReportServer <- function(id, registryName, type, org = NULL,
Sys.Date() + 1
} else {
seq.Date(Sys.Date(),
by = strsplit(input$freq, "-")[[1]][2],
length.out = 2
by = strsplit(input$freq, "-")[[1]][2],
length.out = 2
)[2]
},
min = Sys.Date() + 1,
Expand Down Expand Up @@ -555,17 +556,17 @@ autoReportServer <- function(id, registryName, type, org = NULL,
#' @rdname autoReport
#' @export
autoReportServer2 <- function(
id,
registryName,
type,
org = NULL,
paramNames = shiny::reactiveVal(c("")),
paramValues = shiny::reactiveVal(c("")),
reports = NULL,
orgs = NULL,
eligible = TRUE,
freq = "month",
user
id,
registryName,
type,
org = NULL,
paramNames = shiny::reactiveVal(c("")),
paramValues = shiny::reactiveVal(c("")),
reports = NULL,
orgs = NULL,
eligible = TRUE,
freq = "month",
user
) {
stopifnot(
all(unlist(lapply(user, shiny::is.reactive), use.names = FALSE))
Expand Down Expand Up @@ -608,16 +609,16 @@ autoReportServer2 <- function(
)
shiny::observeEvent(
userEvent(),
autoReport$tab <- makeAutoReportTab(
session = session,
namespace = id,
user = user$name(),
group = registryName,
orgId = user$org(),
type = type,
mapOrgId = orgList2df(orgs)
),
ignoreNULL = FALSE
autoReport$tab <- makeAutoReportTab(
session = session,
namespace = id,
user = user$name(),
group = registryName,
orgId = user$org(),
type = type,
mapOrgId = orgList2df(orgs)
),
ignoreNULL = FALSE
)

shiny::observeEvent(input$addEmail, {
Expand Down
8 changes: 4 additions & 4 deletions R/moduleNavbarWidget.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' called from outside the registry environment \code{caller} must be set to
#' the actual name of the R package.
#'
#' @return Shiny objects, mostly. \code{navbarWidgetServer2()} invisibly returns
#' @return Shiny objects, mostly. \code{navbarWidgetServer2()} invisibly returns
#' a list of reactive values representing user metadata and privileges. See
#' \code{\link{userAttribute}} for further details on these values.
#' @name navbarWidget
Expand Down Expand Up @@ -110,9 +110,9 @@ navbarWidgetServer <- function(id, orgName,
#' @rdname navbarWidget
#' @export
navbarWidgetServer2 <- function(
id,
orgName,
caller = environmentName(topenv(parent.frame()))
id,
orgName,
caller = environmentName(topenv(parent.frame()))
) {

shiny::moduleServer(id, function(input, output, session) {
Expand Down
16 changes: 8 additions & 8 deletions R/userAttribute.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
#' @export

userInfo <- function(
entity,
shinySession = NULL,
devContexts = c("DEV"),
testContexts = c("TEST"),
prodContexts = c("QA", "QAC", "PRODUCTION", "PRODUCTIONC"),
group = NULL
entity,
shinySession = NULL,
devContexts = c("DEV"),
testContexts = c("TEST"),
prodContexts = c("QA", "QAC", "PRODUCTION", "PRODUCTIONC"),
group = NULL
) {

# stop helper function
Expand Down Expand Up @@ -200,7 +200,7 @@ userAttribute <- function(group, unit = NULL) {
stopifnot(group %in% utils::installed.packages()[, 1])

if (Sys.getenv("SHINYPROXY_USERGROUPS") == "" ||
Sys.getenv("USERORGID") == "") {
Sys.getenv("USERORGID") == "") {
stop(paste(
"Environmental variables SHINYPROXY_USERGROUPS and USERORGID must both",
"be set!"
Expand Down Expand Up @@ -249,7 +249,7 @@ userAttribute <- function(group, unit = NULL) {
orgs <- vector()
roles <- vector()
orgNames <- vector()
for (i in seq_len(length(units))) {
for (i in seq_len(length(units))) {
orgs[i] <- unitAttribute(units[i], "resh")
roles[i] <- unitAttribute(units[i], "role")
orgNames[i] <- unitAttribute(units[i], "titlewithpath")
Expand Down

0 comments on commit 6649af5

Please sign in to comment.