From d4c2b2e41d860133ced6aaf0104342dd1ed0aa07 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 21 Dec 2023 16:13:53 +0100 Subject: [PATCH] Add pipeline lintr check --- .Rbuildignore | 1 + .gitlab-ci.yml | 9 +++++++++ .lintr | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .lintr diff --git a/.Rbuildignore b/.Rbuildignore index 83f840f..2a2a753 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,6 +6,7 @@ ./.nc$ .*^(?!data)\.RData$ .*\.gitlab-ci.yml$ +.lintr ^tests$ ./.nfs* ^cran-comments\.md$ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0873a3f..88519c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - build + build: stage: build script: @@ -7,3 +8,11 @@ build: - R CMD build --resave-data . - R CMD check --as-cran --no-manual --run-donttest CSIndicators_*.tar.gz - R -e 'covr::package_coverage()' + +lint-check: + stage: build + script: + - module load R/4.1.2-foss-2015a-bare + - module load CDO/1.9.8-foss-2015a + - echo "Run lintr on the package..." + - Rscript -e 'lintr::lint_package(path = ".")' diff --git a/.lintr b/.lintr new file mode 100644 index 0000000..d56581d --- /dev/null +++ b/.lintr @@ -0,0 +1,22 @@ +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", + "tests/testthat/", + "tests/testthat.R" + ) -- GitLab