Skip to content

Commit

Permalink
Merge branch 'main' into ssl-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arnfinn authored Oct 23, 2024
2 parents bdc1248 + 374e85e commit 6e3e899
Show file tree
Hide file tree
Showing 22 changed files with 291 additions and 266 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
^Meta$
^docker-compose.yml$
^.devcontainer$
^renovate\.json$
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")
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rapbase
Type: Package
Title: Base Functions and Resources for Rapporteket
Version: 1.24.3
Version: 1.25.0
Authors@R: c(
person(given = "Are",
family = "Edvardsen",
Expand Down Expand Up @@ -50,7 +50,7 @@ Imports:
sship (>= 0.9.0),
utils,
yaml
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/Rapporteket/rapbase
BugReports: https://github.com/Rapporteket/rapbase/issues
Suggests:
Expand Down
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
10 changes: 5 additions & 5 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,14 +110,14 @@ 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) {

user <- userAttribute(caller)
user <- userAttribute()
stopifnot(length(user$name) > 0)

# Initial privileges and affiliation will be first in list
Expand Down
1 change: 0 additions & 1 deletion R/rapbase.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
#' R-packages at Rapporteket. This packages is relevant for developers of
#' packages/registries at Rapporteket
#'
#' @docType package
#' @name rapbase
NULL
Loading

0 comments on commit 6e3e899

Please sign in to comment.