mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 21:50:59 -05:00
fix(R linting): try installing the R package before linting R language (#1911)
* fix(R linting): try installing the R package before linting R language * the tool used to lint the R language gives false positives for files inside an R library, which is not installed * this change tries to naively install the package in the linted directory Resolves #1910 * fix code * fixed it * fixed it Co-authored-by: Admiral Awkbar <admiralawkbar@github.com>
This commit is contained in:
parent
fafdcd214e
commit
a2193cb9f6
2 changed files with 54 additions and 1 deletions
|
@ -437,4 +437,57 @@ function RunAdditionalInstalls() {
|
|||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
###############################
|
||||
# Run installs for R language #
|
||||
###############################
|
||||
if [ "${VALIDATE_R}" == "true" ] && [ "${#FILE_ARRAY_R[@]}" -ne 0 ]; then
|
||||
info "Detected R Language files to lint."
|
||||
info "Trying to install the R package inside:[${WORKSPACE_PATH}]"
|
||||
#########################
|
||||
# Run the build command #
|
||||
#########################
|
||||
BUILD_CMD=$(R CMD build "${WORKSPACE_PATH}" 2>&1)
|
||||
|
||||
##############
|
||||
# Error code #
|
||||
##############
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ "${ERROR_CODE}" -ne 0 ]; then
|
||||
# Error
|
||||
warn "ERROR! Failed to run:[R CMD build] at location:[${WORKSPACE_PATH}]"
|
||||
warn "BUILD_CMD:[${BUILD_CMD}]"
|
||||
else
|
||||
# Get the build package
|
||||
BUILD_PKG=$(
|
||||
cd "${WORKSPACE_PATH}" || exit 0
|
||||
echo *.tar.gz 2>&1
|
||||
)
|
||||
##############################
|
||||
# Install the build packages #
|
||||
##############################
|
||||
INSTALL_CMD=$(
|
||||
cd "${WORKSPACE_PATH}" || exit 0
|
||||
R CMD INSTALL "${BUILD_PKG}" 2>&1
|
||||
)
|
||||
|
||||
##############
|
||||
# Error code #
|
||||
##############
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ "${ERROR_CODE}" -ne 0 ]; then
|
||||
# Error
|
||||
warn "ERROR: Failed to install the build package at:[${BUILD_PKG}]"
|
||||
warn "INSTALL_CMD:[${INSTALL_CMD}]"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
################################################################################
|
||||
#### Function LintCodebase #####################################################
|
||||
function LintCodebase() {
|
||||
# Call comes thorugh as:
|
||||
# Call comes through as:
|
||||
# LintCodebase "${LANGUAGE}" "${LINTER_NAME}" "${LINTER_COMMAND}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${TEST_CASE_RUN}" "${!LANGUAGE_FILE_ARRAY}"
|
||||
####################
|
||||
# Pull in the vars #
|
||||
|
|
Loading…
Reference in a new issue