Skip to content

Commit

Permalink
Merge pull request #71 from dfe-analytical-services/tidy-commit-hook
Browse files Browse the repository at this point in the history
Updating workflow naming and commit hooks
  • Loading branch information
rmbielby authored Feb 7, 2024
2 parents cadda40 + 07979d4 commit 47a5de8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/shiny-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
automatedTests:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: shiny-tests

strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tidyCode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
tidyCode:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: tidyCode

strategy:
fail-fast: false
Expand Down
16 changes: 13 additions & 3 deletions .hooks/pre-commit.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cat("Running commit hooks...",fill=TRUE)
shhh <- suppressPackageStartupMessages # It's a library, so shhh!
shhh(library(dplyr))
shhh(library(xfun))

shhh(library(dfeshiny))

error_flag <- FALSE

Expand All @@ -28,8 +28,6 @@ if(ncol(ign_files)>1){
}
}



suffixes <- "xlsx$|dat$|csv$|tex$|pdf$"

current_files <- data.frame(files = list.files("./", recursive = TRUE)) %>%
Expand Down Expand Up @@ -69,4 +67,16 @@ if (error_flag) {
quit(save = "no", status = 1, runLast = FALSE)
}

tidy_output <- tidy_code()
if(any(tidy_output)){
error_flag <- TRUE
}

if (error_flag) {
cat("Warning: Code did not appear to have been tidied.\nI've run tidy code for you,
please check your files and the dashboard still works and then re-stage and try committing again.")
quit(save = "no", status = 1, runLast = FALSE)
}


# End of hooks
7 changes: 5 additions & 2 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ choicesLAs <- dfAreas %>%
choicesAreas <- dfAreas %>%
filter(geographic_level == "National") %>%
select(geographic_level, area_name = country_name) %>%
rbind(dfAreas %>% filter(geographic_level == "Regional") %>%
select(geographic_level, area_name = region_name)) %>%
rbind(
dfAreas %>%
filter(geographic_level == "Regional") %>%
select(geographic_level, area_name = region_name)
) %>%
rbind(choicesLAs)

choicesYears <- unique(dfRevBal$time_period)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 47a5de8

Please sign in to comment.