Skip to content

Commit

Permalink
Lint pakke (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnfinn authored Nov 26, 2024
1 parent 16f345e commit 28800fc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: false
LINTR_ERROR_ON_LINT: true
3 changes: 3 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters: linters_with_defaults(
object_name_linter(c("camelCase", "snake_case"))
)
1 change: 0 additions & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ app_server <- function(input, output, session) {

# Autoreport
ar <- rapbase::readAutoReportData()
# ar <- NULL

far <- shiny::reactive({
shiny::req(input$fpackage, input$ftype, input$fowner, input$forganization)
Expand Down
5 changes: 3 additions & 2 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

app_ui <- function() {

#shiny::addResourcePath("rap", system.file("www", package = "rapbase"))
app_title <- "RapAdm"

shiny::tagList(
Expand Down Expand Up @@ -75,7 +74,9 @@ app_ui <- function() {
shiny::radioButtons(
"downloadFormat",
label = shiny::tags$div(
shiny::HTML(as.character(shiny::icon("file-csv")), "File format:")
shiny::HTML(
as.character(shiny::icon("file-csv")), "File format:"
)
),
choices = c("csv", "xlsx-csv")
),
Expand Down
14 changes: 8 additions & 6 deletions R/autoreport.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ unique_autoreport <- function(data, entity) {
#' @param data List containing auto report data
#' run. May well contain repeating values
#' @param pointRangeMax Integer to provide static range of geom_point as
#' \code{range(1:pointRangeMax)}. If set to 0 (default) the range of current data will be
#' used.
#' \code{range(1:pointRangeMax)}. If set to 0 (default) the range of
#' current data will be used.
#'
#' @return a (gg)plot object
#' @export
Expand All @@ -44,7 +44,6 @@ calendar_autoreport <- function(data, pointRangeMax = 0) {
use.names = FALSE
)
}
#stopifnot(is.numeric(unlist(runDayOfYear)) || is.null(runDayOfYear))
stopifnot(is.integer(pointRangeMax) || pointRangeMax == 0)

startDate <- Sys.Date() - as.numeric(strftime(Sys.Date(), format = "%d")) + 1
Expand Down Expand Up @@ -87,14 +86,16 @@ calendar_autoreport <- function(data, pointRangeMax = 0) {
# plot object
g <- ggplot2::ggplot(
data = b, ggplot2::aes(x = .data$weekOfMonth, y = .data$dayName,
fill = .data$ymnId)) +
fill = .data$ymnId)
) +
ggplot2::geom_tile(colour = "white", size = .1, alpha = 0.3) +
ggplot2::facet_wrap(~yearMonthName, scales = "fixed", nrow = 4) +
ggplot2::geom_text(
data = b,
ggplot2::aes(.data$weekOfMonth, .data$dayName,
label = .data$monthDayNum),
colour = "black", size = 3.5, nudge_x = .25, nudge_y = -.15) +
colour = "black", size = 3.5, nudge_x = .25, nudge_y = -.15
) +
ggplot2::theme_minimal() +
ggplot2::theme(panel.grid.major = ggplot2::element_blank(),
panel.grid.minor = ggplot2::element_blank(),
Expand All @@ -114,7 +115,8 @@ calendar_autoreport <- function(data, pointRangeMax = 0) {
dplyr::left_join(autoReportCount, by = "dayOfYear")
g <- g + ggplot2::geom_point(data = b %>% dplyr::filter(!is.na(.data$n)),
ggplot2::aes(x = .data$weekOfMonth,
y = .data$dayName, size = .data$n),
y = .data$dayName,
size = .data$n),
colour = "#FF7260", alpha = 0.7)
}

Expand Down

0 comments on commit 28800fc

Please sign in to comment.