diff --git a/Makefile b/Makefile index 610a19a366..4863646e0b 100644 --- a/Makefile +++ b/Makefile @@ -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. @@ -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 diff --git a/tests/testthat/test_01-codeCheck.R b/tests/testthat/test_01-codeCheck.R index 755ade5ace..766902752a 100644 --- a/tests/testthat/test_01-codeCheck.R +++ b/tests/testthat/test_01-codeCheck.R @@ -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)