From 0f47f68445be28f5e45ec521e87722867143190d Mon Sep 17 00:00:00 2001 From: assignUser Date: Mon, 17 Aug 2020 12:01:25 +0000 Subject: [PATCH] add .lintr detection --- .github/linters/.lintr | 2 +- TEMPLATES/.lintr | 2 +- lib/linter.sh | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/linters/.lintr b/.github/linters/.lintr index 05eefeeb..aac8e22e 100644 --- a/.github/linters/.lintr +++ b/.github/linters/.lintr @@ -1 +1 @@ -linters: with_defaults(object_usage_linter = NULL) \ No newline at end of file +linters: with_defaults(object_usage_linter = NULL) diff --git a/TEMPLATES/.lintr b/TEMPLATES/.lintr index 05eefeeb..aac8e22e 100644 --- a/TEMPLATES/.lintr +++ b/TEMPLATES/.lintr @@ -1 +1 @@ -linters: with_defaults(object_usage_linter = NULL) \ No newline at end of file +linters: with_defaults(object_usage_linter = NULL) diff --git a/lib/linter.sh b/lib/linter.sh index 8eb6f0fb..413f9537 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1695,8 +1695,17 @@ fi # R LINTING # ################ if [ "${VALIDATE_R}" == "true" ]; then + ########################## + # Check for local config # + ########################## + if [ ! -f "${GITHUB_WORKSPACE}/.lintr" ]; then + info " " + info "No .lintr configuration file found, using defaults." + cp $R_LINTER_RULES $GITHUB_WORKSPACE + fi + ####################### - # Lint the R files # + # Lint the R files # ####################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" LintCodebase "R" "lintr" "${R_LINTER_RULES}" ".*\.\(r\|R\|Rmd\|rmd\)\$" "${FILE_ARRAY_R[@]}"