diff --git a/.Rbuildignore b/.Rbuildignore index 31cdda424dd02966ebb9f5f9ee8c1caa31ee008e..6cd6d8c85b536ff118f5edcc0caf6668aa64fda5 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 e245a6cccf20d743bddeb28f8fd424e6218a39c6..cbc39ada0ea6744da506a87409949d4e824aedbf 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 = ".")' diff --git a/.lintr b/.lintr new file mode 100644 index 0000000000000000000000000000000000000000..31497af1361e5de67c6498933e2f944c754dda16 --- /dev/null +++ b/.lintr @@ -0,0 +1,39 @@ +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( + "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", + "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", + "tests/testthat/", + "tests/testthat.R" + ) diff --git a/vignettes/RainFARM_vignette.Rmd b/vignettes/RainFARM_vignette.Rmd index a51d75cb9160e14b5b1247ee1a4039486a2f1279..27d7423320eed8442a0b0111869b8f8e67bec9be 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".