From 62c8e3462262d7c364fbcf6dbb052971fd5e6095 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 9 Nov 2023 10:37:22 +0100 Subject: [PATCH 1/5] Add lintr package in pipeline --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e245a6cc..cbc39ada 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,3 +9,10 @@ build: - R CMD build --resave-data . - R CMD check --as-cran --no-manual --run-donttest CSTools_*.tar.gz - R -e 'covr::package_coverage()' + +lint-check: + stage: build + script: + - module load R/4.1.2-foss-2015a-bare + - echo "Run lintr on the package..." + - Rscript -e 'lintr::lint_package(path = ".")' -- GitLab From bb03318cb4dbb9e8c643cb32be7d4fb46df04d29 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 21 Dec 2023 14:34:30 +0100 Subject: [PATCH 2/5] Add lintr tags and exclusions to the pipeline --- .Rbuildignore | 1 + .gitlab-ci.yml | 1 + .lintr | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 .lintr diff --git a/.Rbuildignore b/.Rbuildignore index 31cdda42..6cd6d8c8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,6 +6,7 @@ ./.nc$ .*^(?!data)\.RData$ .*\.gitlab-ci.yml$ +.lintr ^tests$ #^inst/doc$ ^inst/doc/usecase/UseCase2_PrecipitationDownscaling_RainFARM_RF100\.R$ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbc39ada..2750bb3f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,3 +16,4 @@ lint-check: - module load R/4.1.2-foss-2015a-bare - echo "Run lintr on the package..." - Rscript -e 'lintr::lint_package(path = ".")' + - R -e 'covr::package_coverage()' diff --git a/.lintr b/.lintr new file mode 100644 index 00000000..bbec668d --- /dev/null +++ b/.lintr @@ -0,0 +1,35 @@ +linters: linters_with_tags( + tags = c("package_development", "readability", "best_practices"), + line_length_linter = line_length_linter(100L), + T_and_F_symbol_linter = NULL, + quotes_linter = NULL, + commented_code_linter = NULL, + implicit_integer_linter = NULL, + vector_logic_linter = NULL, + extraction_operator_linter = NULL, + function_left_parentheses_linter = NULL, + semicolon_linter = NULL, + indentation_linter = NULL, + unnecessary_nested_if_linter = NULL, + if_not_else_linter = NULL, + object_length_linter = NULL, + infix_spaces_linter(exclude_operators = "~") +) +exclusions: list( + "R/AnalogsPred_train.R", + "R/BEI_PDFBest.R", + "R/BEI_Weights.R", + "R/CST_AdamontAnalog.R", + "R/CST_AdamontQQCorr.R", + "R/CST_AnalogsPredictors.R", + "R/CST_BEI_Weighting.R", + "R/CST_CategoricalEnsCombination.R", + "R/CST_DynBiasCorrection.R", + "R/CST_EnsClustering.R", + "R/PlotCombinedMap.R", + "R/PlotForecastPDF.R", + "R/PlotMostLikelyQuantileMap.R", + "R/PlotPDFsOLE.R", + "R/PlotTriangles4Categories.R", + "R/PlotWeeklyClim.R" +) -- GitLab From 9f31d837bbe072a8064e5f16a745d018c189b37e Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 21 Dec 2023 15:28:56 +0100 Subject: [PATCH 3/5] Correct spacing in .lintr config file --- .lintr | 66 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.lintr b/.lintr index bbec668d..753b9131 100644 --- a/.lintr +++ b/.lintr @@ -1,35 +1,35 @@ -linters: linters_with_tags( - tags = c("package_development", "readability", "best_practices"), - line_length_linter = line_length_linter(100L), - T_and_F_symbol_linter = NULL, - quotes_linter = NULL, - commented_code_linter = NULL, - implicit_integer_linter = NULL, - vector_logic_linter = NULL, - extraction_operator_linter = NULL, - function_left_parentheses_linter = NULL, - semicolon_linter = NULL, - indentation_linter = NULL, - unnecessary_nested_if_linter = NULL, - if_not_else_linter = NULL, - object_length_linter = NULL, - infix_spaces_linter(exclude_operators = "~") -) +linters: linters_with_tags( # lintr_3.1.1 + tags = c("package_development", "readability", "best_practices"), + line_length_linter = line_length_linter(100L), + T_and_F_symbol_linter = NULL, + quotes_linter = NULL, + commented_code_linter = NULL, + implicit_integer_linter = NULL, + vector_logic_linter = NULL, + extraction_operator_linter = NULL, + function_left_parentheses_linter = NULL, + semicolon_linter = NULL, + indentation_linter = NULL, + unnecessary_nested_if_linter = NULL, + if_not_else_linter = NULL, + object_length_linter = NULL, + infix_spaces_linter(exclude_operators = "~") + ) exclusions: list( - "R/AnalogsPred_train.R", - "R/BEI_PDFBest.R", - "R/BEI_Weights.R", - "R/CST_AdamontAnalog.R", - "R/CST_AdamontQQCorr.R", - "R/CST_AnalogsPredictors.R", - "R/CST_BEI_Weighting.R", - "R/CST_CategoricalEnsCombination.R", - "R/CST_DynBiasCorrection.R", - "R/CST_EnsClustering.R", - "R/PlotCombinedMap.R", - "R/PlotForecastPDF.R", - "R/PlotMostLikelyQuantileMap.R", - "R/PlotPDFsOLE.R", - "R/PlotTriangles4Categories.R", - "R/PlotWeeklyClim.R" + "R/AnalogsPred_train.R", + "R/BEI_PDFBest.R", + "R/BEI_Weights.R", + "R/CST_AdamontAnalog.R", + "R/CST_AdamontQQCorr.R", + "R/CST_AnalogsPredictors.R", + "R/CST_BEI_Weighting.R", + "R/CST_CategoricalEnsCombination.R", + "R/CST_DynBiasCorrection.R", + "R/CST_EnsClustering.R", + "R/PlotCombinedMap.R", + "R/PlotForecastPDF.R", + "R/PlotMostLikelyQuantileMap.R", + "R/PlotPDFsOLE.R", + "R/PlotTriangles4Categories.R", + "R/PlotWeeklyClim.R" ) -- GitLab From 40767084472fd26117c6f50ebc5106041baaeafe Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 21 Dec 2023 15:50:48 +0100 Subject: [PATCH 4/5] Correct .lintr config and error in a vignette --- .gitlab-ci.yml | 1 - .lintr | 6 ++++-- vignettes/RainFARM_vignette.Rmd | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2750bb3f..cbc39ada 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,4 +16,3 @@ lint-check: - module load R/4.1.2-foss-2015a-bare - echo "Run lintr on the package..." - Rscript -e 'lintr::lint_package(path = ".")' - - R -e 'covr::package_coverage()' diff --git a/.lintr b/.lintr index 753b9131..11c9deeb 100644 --- a/.lintr +++ b/.lintr @@ -31,5 +31,7 @@ exclusions: list( "R/PlotMostLikelyQuantileMap.R", "R/PlotPDFsOLE.R", "R/PlotTriangles4Categories.R", - "R/PlotWeeklyClim.R" -) + "R/PlotWeeklyClim.R", + "tests/testthat/", + "tests/testthat.R" + ) diff --git a/vignettes/RainFARM_vignette.Rmd b/vignettes/RainFARM_vignette.Rmd index a51d75cb..27d74233 100644 --- a/vignettes/RainFARM_vignette.Rmd +++ b/vignettes/RainFARM_vignette.Rmd @@ -180,21 +180,21 @@ slopes <- CST_RFSlope(exp, time_dim = c("member", "ftime")) dim(slopes) # dataset var sdate # 1 1 3 -slopes -, , 1 +# slopes +# , , 1 - [,1] -[1,] 1.09957 +# [,1] +# [1,] 1.09957 -, , 2 +# , , 2 - [,1] -[1,] 1.768861 +# [,1] +# [1,] 1.768861 -, , 3 +# , , 3 - [,1] -[1,] 1.190176 +# [,1] +# [1,] 1.190176 ``` which return an array of spectral slopes, one for each "dataset" and starting date "sdate". -- GitLab From 107f8cbf64e6b75ac798c6d64ee6ea89573a8734 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 21 Dec 2023 16:12:01 +0100 Subject: [PATCH 5/5] Exclude inst and Analogs from lintr checks --- .lintr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.lintr b/.lintr index 11c9deeb..31497af1 100644 --- a/.lintr +++ b/.lintr @@ -16,11 +16,13 @@ linters: linters_with_tags( # lintr_3.1.1 infix_spaces_linter(exclude_operators = "~") ) exclusions: list( + "inst", "R/AnalogsPred_train.R", "R/BEI_PDFBest.R", "R/BEI_Weights.R", "R/CST_AdamontAnalog.R", "R/CST_AdamontQQCorr.R", + "R/Analogs.R", "R/CST_AnalogsPredictors.R", "R/CST_BEI_Weighting.R", "R/CST_CategoricalEnsCombination.R", -- GitLab