Skip to content

Commit

Permalink
directly print warnings from codeCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Mar 19, 2024
1 parent 5b76090 commit 632790e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ restore-renv: ## Restore renv to the state described in interactively

check: ## Check if the GAMS code follows the coding etiquette
## using gms::codeCheck
Rscript -e 'invisible(gms::codeCheck(strict = TRUE))'
Rscript -e 'options(warn = 1); invisible(gms::codeCheck(strict = TRUE));'

check-fix: ## Check if the GAMS code follows the coding etiquette
## and offer fixing any problems directly if possible
## using gms::codeCheck
Rscript -e 'invisible(gms::codeCheck(strict = TRUE, interactive = TRUE))'
Rscript -e 'options(warn = 1); invisible(gms::codeCheck(strict = TRUE, interactive = TRUE));'

test: ## Test if the model compiles and runs without running a full
## scenario. Tests take about 15 minutes to run.
Expand All @@ -79,7 +79,7 @@ test: ## Test if the model compiles and runs without running a full
test-fix: ## First run codeCheck interactively, then test if the model compiles and runs without
## running a full scenario. Tests take about 15 minutes to run.
$(info Tests take about 18 minutes to run, please be patient)
@Rscript -e 'invisible(gms::codeCheck(strict = TRUE, interactive = TRUE)); testthat::test_dir("tests/testthat"); message("Do not forget to commit changes done by codeCheck to not_used.txt files");'
@Rscript -e 'options(warn = 1); invisible(gms::codeCheck(strict = TRUE, interactive = TRUE)); testthat::test_dir("tests/testthat"); message("Do not forget to commit changes done by codeCheck to not_used.txt files");'

test-coupled: ## Test if the coupling with MAgPIE works. Takes significantly
## longer than 60 minutes to run and needs slurm and magpie
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_01-codeCheck.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
test_that("GAMS code follows the coding etiquette", {
# have to run this via localSystem2 so that it uses the renv, where gms
# is actually installed.
codecheckcode <- "'invisible(gms::codeCheck(strict = TRUE)); if (! is.null(warnings())) stop(warnings())'"
codecheckcode <- "'options(warn = 1); invisible(gms::codeCheck(strict = TRUE));'"
output <- localSystem2("Rscript", c("-e", codecheckcode))
printIfFailed(output)
expectSuccessStatus(output)
Expand Down

0 comments on commit 632790e

Please sign in to comment.