mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 20:52:12 -05:00
Fix shfmt errors
This commit is contained in:
parent
e1a83d9f70
commit
b7e5dfce01
11 changed files with 152 additions and 134 deletions
|
@ -7,11 +7,11 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
||||||
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
|
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
|
||||||
TEST_FOLDER='.automation/test' # Folder where test are stored
|
TEST_FOLDER='.automation/test' # Folder where test are stored
|
||||||
CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip
|
CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip
|
||||||
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
|
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
|
||||||
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
||||||
|
|
||||||
############################
|
############################
|
||||||
|
@ -39,7 +39,10 @@ CleanTestFiles() {
|
||||||
##################
|
##################
|
||||||
# Find the files #
|
# Find the files #
|
||||||
##################
|
##################
|
||||||
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*_bad_*" 2>&1)
|
mapfile -t FIND_CMD < <(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
find "${GITHUB_WORKSPACE}" -type f -name "*_bad_*" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -70,7 +73,10 @@ CleanTestFiles() {
|
||||||
################################
|
################################
|
||||||
# Its a test, we can delete it #
|
# Its a test, we can delete it #
|
||||||
################################
|
################################
|
||||||
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
|
REMOVE_FILE_CMD=$(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
rm -f "$FILE" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -96,7 +102,10 @@ CleanTestDockerFiles() {
|
||||||
##################
|
##################
|
||||||
# Find the files #
|
# Find the files #
|
||||||
##################
|
##################
|
||||||
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*Dockerfile" 2>&1)
|
mapfile -t FIND_CMD < <(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
find "${GITHUB_WORKSPACE}" -type f -name "*Dockerfile" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -127,7 +136,10 @@ CleanTestDockerFiles() {
|
||||||
################################
|
################################
|
||||||
# Its a test, we can delete it #
|
# Its a test, we can delete it #
|
||||||
################################
|
################################
|
||||||
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
|
REMOVE_FILE_CMD=$(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
rm -f "$FILE" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -153,7 +165,10 @@ CleanSHAFolder() {
|
||||||
##################
|
##################
|
||||||
# Find the files #
|
# Find the files #
|
||||||
##################
|
##################
|
||||||
REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; sudo rm -rf "${GITHUB_SHA}" 2>&1)
|
REMOVE_CMD=$(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
sudo rm -rf "${GITHUB_SHA}" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -178,7 +193,10 @@ RenameTestFolder() {
|
||||||
#####################
|
#####################
|
||||||
# Rename the folder #
|
# Rename the folder #
|
||||||
#####################
|
#####################
|
||||||
RENAME_FOLDER_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; mv "${TEST_FOLDER}" "${CLEAN_FOLDER}" 2>&1)
|
RENAME_FOLDER_CMD=$(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
mv "${TEST_FOLDER}" "${CLEAN_FOLDER}" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -205,7 +223,10 @@ CleanPowershell() {
|
||||||
##################
|
##################
|
||||||
# Find the files #
|
# Find the files #
|
||||||
##################
|
##################
|
||||||
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*.psd1" 2>&1)
|
mapfile -t FIND_CMD < <(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
find "${GITHUB_WORKSPACE}" -type f -name "*.psd1" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -236,7 +257,10 @@ CleanPowershell() {
|
||||||
################################
|
################################
|
||||||
# Its a test, we can delete it #
|
# Its a test, we can delete it #
|
||||||
################################
|
################################
|
||||||
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
|
REMOVE_FILE_CMD=$(
|
||||||
|
cd "${GITHUB_WORKSPACE}" || exit 1
|
||||||
|
rm -f "$FILE" 2>&1
|
||||||
|
)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
||||||
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
|
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
|
||||||
DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub
|
DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub
|
||||||
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
|
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
|
||||||
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
|
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
|
||||||
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
|
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
|
||||||
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
|
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
|
||||||
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|
|
@ -8,21 +8,20 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
GHE_CONFIG_PID='/var/run/ghe-config.pid' # PID file when a config is running
|
GHE_CONFIG_PID='/var/run/ghe-config.pid' # PID file when a config is running
|
||||||
GHE_APPLY_COMMAND='ghe-config-apply' # Command running when a config run
|
GHE_APPLY_COMMAND='ghe-config-apply' # Command running when a config run
|
||||||
SLEEP_SECONDS=20 # Seconds to sleep before next check
|
SLEEP_SECONDS=20 # Seconds to sleep before next check
|
||||||
PID_CHECK_LIMIT=15 # How many times to check the pid before moving on
|
PID_CHECK_LIMIT=15 # How many times to check the pid before moving on
|
||||||
PID_CHECK=0 # Count of times to check the pid
|
PID_CHECK=0 # Count of times to check the pid
|
||||||
PROCESS_CHECK_LIMIT=15 # How many times to check the process before moving on
|
PROCESS_CHECK_LIMIT=15 # How many times to check the process before moving on
|
||||||
PROCESS_CHECK=0 # Count of times to check the process
|
PROCESS_CHECK=0 # Count of times to check the process
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################### SUB ROUTINES BELOW #################################
|
########################### SUB ROUTINES BELOW #################################
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function CheckGHEPid ######################################################
|
#### Function CheckGHEPid ######################################################
|
||||||
CheckGHEPid()
|
CheckGHEPid() {
|
||||||
{
|
|
||||||
##################################
|
##################################
|
||||||
# Check to prevent infinite loop #
|
# Check to prevent infinite loop #
|
||||||
##################################
|
##################################
|
||||||
|
@ -75,8 +74,7 @@ CheckGHEPid()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function CheckGHEProcess ##################################################
|
#### Function CheckGHEProcess ##################################################
|
||||||
CheckGHEProcess()
|
CheckGHEProcess() {
|
||||||
{
|
|
||||||
##################################
|
##################################
|
||||||
# Check to prevent infinite loop #
|
# Check to prevent infinite loop #
|
||||||
##################################
|
##################################
|
||||||
|
@ -139,8 +137,7 @@ CheckGHEProcess()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function RunConfigApply ###################################################
|
#### Function RunConfigApply ###################################################
|
||||||
RunConfigApply()
|
RunConfigApply() {
|
||||||
{
|
|
||||||
##########
|
##########
|
||||||
# Header #
|
# Header #
|
||||||
##########
|
##########
|
||||||
|
|
|
@ -8,10 +8,10 @@ ERROR_CODE=$?
|
||||||
|
|
||||||
# Check the shell
|
# Check the shell
|
||||||
if [ ${ERROR_CODE} -ne 0 ]; then
|
if [ ${ERROR_CODE} -ne 0 ]; then
|
||||||
echo "We did it!"
|
echo "We did it!"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "We done goofed it..."
|
echo "We done goofed it..."
|
||||||
echo "${HELLO_WORLD}"
|
echo "${HELLO_WORLD}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -17,31 +17,31 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
||||||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||||
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
|
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
|
||||||
DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub
|
DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub
|
||||||
GCR_USERNAME="${GCR_USERNAME}" # Username to login to GitHub package registry
|
GCR_USERNAME="${GCR_USERNAME}" # Username to login to GitHub package registry
|
||||||
GCR_TOKEN="${GCR_TOKEN}" # Password to login to GitHub package registry
|
GCR_TOKEN="${GCR_TOKEN}" # Password to login to GitHub package registry
|
||||||
REGISTRY="${REGISTRY}" # What registry to upload | <GCR> or <Docker>
|
REGISTRY="${REGISTRY}" # What registry to upload | <GCR> or <Docker>
|
||||||
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
|
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
|
||||||
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
|
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
|
||||||
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
|
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
|
||||||
MAJOR_TAG='' # Major tag version if we need to update it
|
MAJOR_TAG='' # Major tag version if we need to update it
|
||||||
UPDATE_MAJOR_TAG=0 # Flag to deploy the major tag version as well
|
UPDATE_MAJOR_TAG=0 # Flag to deploy the major tag version as well
|
||||||
GCR_URL='ghcr.io' # URL to Github Container Registry
|
GCR_URL='ghcr.io' # URL to Github Container Registry
|
||||||
DOCKER_IMAGE_REPO='' # Docker tag for the image when created
|
DOCKER_IMAGE_REPO='' # Docker tag for the image when created
|
||||||
GCR_IMAGE_REPO='' # Docker tag for the image when created
|
GCR_IMAGE_REPO='' # Docker tag for the image when created
|
||||||
FOUND_IMAGE=0 # Flag for if the image has already been built
|
FOUND_IMAGE=0 # Flag for if the image has already been built
|
||||||
CONTAINER_URL='' # Final URL to upload
|
CONTAINER_URL='' # Final URL to upload
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# Dynamic build variables to pass to container when built #
|
# Dynamic build variables to pass to container when built #
|
||||||
###########################################################
|
###########################################################
|
||||||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z"
|
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z"
|
||||||
BUILD_REVISION=$(git rev-parse --short HEAD) # Current git commit EX> "e89faa7"
|
BUILD_REVISION=$(git rev-parse --short HEAD) # Current git commit EX> "e89faa7"
|
||||||
BUILD_VERSION='' # Current version of the container being built
|
BUILD_VERSION='' # Current version of the container being built
|
||||||
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
|
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
|
||||||
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
@ -329,7 +329,7 @@ BuildImage() {
|
||||||
########################################################
|
########################################################
|
||||||
if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
|
if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
|
||||||
# Tag the image with the major tag as well
|
# Tag the image with the major tag as well
|
||||||
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
|
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -515,7 +515,7 @@ FindBuiltImage() {
|
||||||
##############
|
##############
|
||||||
# Local vars #
|
# Local vars #
|
||||||
##############
|
##############
|
||||||
CHECK_IMAGE_REPO='' # Repo to look for
|
CHECK_IMAGE_REPO='' # Repo to look for
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Set the additional container URL #
|
# Set the additional container URL #
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
|
||||||
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
|
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
|
||||||
BUILD_DATE="${BUILD_DATE}" # Date the container was built
|
BUILD_DATE="${BUILD_DATE}" # Date the container was built
|
||||||
BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha
|
BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha
|
||||||
BUILD_VERSION="${GITHUB_SHA}" # Version of the container
|
BUILD_VERSION="${GITHUB_SHA}" # Version of the container
|
||||||
ORG_REPO="github/super-linter" # Org/repo
|
ORG_REPO="github/super-linter" # Org/repo
|
||||||
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
|
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
|
||||||
ERROR=0 # Error count
|
ERROR=0 # Error count
|
||||||
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
@ -39,8 +39,8 @@ ValidateLabel() {
|
||||||
##############
|
##############
|
||||||
# Grab input #
|
# Grab input #
|
||||||
##############
|
##############
|
||||||
CONTAINER_KEY="$1" # Example: org.opencontainers.image.created
|
CONTAINER_KEY="$1" # Example: org.opencontainers.image.created
|
||||||
CONTAINER_VALUE="$2" # Example: 1985-04-12T23:20:50.52Z
|
CONTAINER_VALUE="$2" # Example: 1985-04-12T23:20:50.52Z
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Get the docker label #
|
# Get the docker label #
|
||||||
|
|
|
@ -85,7 +85,7 @@ function BuildFileList() {
|
||||||
else
|
else
|
||||||
WORKSPACE_PATH="${GITHUB_WORKSPACE}"
|
WORKSPACE_PATH="${GITHUB_WORKSPACE}"
|
||||||
if [ "${TEST_CASE_RUN}" == "true" ]; then
|
if [ "${TEST_CASE_RUN}" == "true" ]; then
|
||||||
WORKSPACE_PATH="${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}"
|
WORKSPACE_PATH="${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -94,12 +94,12 @@ function BuildFileList() {
|
||||||
debug "----------------------------------------------"
|
debug "----------------------------------------------"
|
||||||
debug "Populating the file list with all the files in the ${WORKSPACE_PATH} workspace"
|
debug "Populating the file list with all the files in the ${WORKSPACE_PATH} workspace"
|
||||||
mapfile -t RAW_FILE_ARRAY < <(find "${WORKSPACE_PATH}" \
|
mapfile -t RAW_FILE_ARRAY < <(find "${WORKSPACE_PATH}" \
|
||||||
-not \( -path '*/\.git' -prune \) \
|
-not \( -path '*/\.git' -prune \) \
|
||||||
-not \( -path '*/\.rbenv' -prune \) \
|
-not \( -path '*/\.rbenv' -prune \) \
|
||||||
-not \( -path '*/\.terragrunt-cache' -prune \) \
|
-not \( -path '*/\.terragrunt-cache' -prune \) \
|
||||||
-not \( -path '*/\.venv' -prune \) \
|
-not \( -path '*/\.venv' -prune \) \
|
||||||
-type f \
|
-type f \
|
||||||
2>&1 | sort)
|
2>&1 | sort)
|
||||||
|
|
||||||
debug "RAW_FILE_ARRAY contents: ${RAW_FILE_ARRAY[*]}"
|
debug "RAW_FILE_ARRAY contents: ${RAW_FILE_ARRAY[*]}"
|
||||||
fi
|
fi
|
||||||
|
@ -401,12 +401,12 @@ function BuildFileList() {
|
||||||
# Get the Powershell files #
|
# Get the Powershell files #
|
||||||
############################
|
############################
|
||||||
elif [ "${FILE_TYPE}" == "ps1" ] ||
|
elif [ "${FILE_TYPE}" == "ps1" ] ||
|
||||||
[ "${FILE_TYPE}" == "psm1" ] ||
|
[ "${FILE_TYPE}" == "psm1" ] ||
|
||||||
[ "${FILE_TYPE}" == "psd1" ] ||
|
[ "${FILE_TYPE}" == "psd1" ] ||
|
||||||
[ "${FILE_TYPE}" == "ps1xml" ] ||
|
[ "${FILE_TYPE}" == "ps1xml" ] ||
|
||||||
[ "${FILE_TYPE}" == "pssc" ] ||
|
[ "${FILE_TYPE}" == "pssc" ] ||
|
||||||
[ "${FILE_TYPE}" == "psrc" ] ||
|
[ "${FILE_TYPE}" == "psrc" ] ||
|
||||||
[ "${FILE_TYPE}" == "cdxml" ]; then
|
[ "${FILE_TYPE}" == "cdxml" ]; then
|
||||||
################################
|
################################
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
################################
|
################################
|
||||||
|
@ -703,8 +703,8 @@ function IsValidShellScript() {
|
||||||
[ "${FILE_EXTENSION}" == "bash" ] ||
|
[ "${FILE_EXTENSION}" == "bash" ] ||
|
||||||
[ "${FILE_EXTENSION}" == "dash" ] ||
|
[ "${FILE_EXTENSION}" == "dash" ] ||
|
||||||
[ "${FILE_EXTENSION}" == "ksh" ]; then
|
[ "${FILE_EXTENSION}" == "ksh" ]; then
|
||||||
debug "$FILE is a valid shell script (has a valid extension: ${FILE_EXTENSION})"
|
debug "$FILE is a valid shell script (has a valid extension: ${FILE_EXTENSION})"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${GET_FILE_TYPE_CMD}" == *"POSIX shell script"* ]] ||
|
if [[ "${GET_FILE_TYPE_CMD}" == *"POSIX shell script"* ]] ||
|
||||||
|
@ -712,8 +712,8 @@ function IsValidShellScript() {
|
||||||
[[ ${GET_FILE_TYPE_CMD} == *"dash script"* ]] ||
|
[[ ${GET_FILE_TYPE_CMD} == *"dash script"* ]] ||
|
||||||
[[ ${GET_FILE_TYPE_CMD} == *"ksh script"* ]] ||
|
[[ ${GET_FILE_TYPE_CMD} == *"ksh script"* ]] ||
|
||||||
[[ ${GET_FILE_TYPE_CMD} == *"/usr/bin/env sh script"* ]]; then
|
[[ ${GET_FILE_TYPE_CMD} == *"/usr/bin/env sh script"* ]]; then
|
||||||
debug "$FILE is a valid shell script (has a valid file type: ${GET_FILE_TYPE_CMD})"
|
debug "$FILE is a valid shell script (has a valid file type: ${GET_FILE_TYPE_CMD})"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trace "$FILE is NOT a supported shell script. Skipping"
|
trace "$FILE is NOT a supported shell script. Skipping"
|
||||||
|
|
|
@ -17,8 +17,8 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-false}" # Boolean to see even more
|
||||||
# Log Vars #
|
# Log Vars #
|
||||||
# Define these early, so we can use debug logging ASAP if needed #
|
# Define these early, so we can use debug logging ASAP if needed #
|
||||||
##################################################################
|
##################################################################
|
||||||
LOG_FILE="${LOG_FILE:-super-linter.log}" # Default log file name (located in GITHUB_WORKSPACE folder)
|
LOG_FILE="${LOG_FILE:-super-linter.log}" # Default log file name (located in GITHUB_WORKSPACE folder)
|
||||||
LOG_LEVEL="${LOG_LEVEL:-VERBOSE}" # Default log level (VERBOSE, DEBUG, TRACE)
|
LOG_LEVEL="${LOG_LEVEL:-VERBOSE}" # Default log level (VERBOSE, DEBUG, TRACE)
|
||||||
|
|
||||||
if [[ ${ACTIONS_RUNNER_DEBUG} == true ]]; then LOG_LEVEL="DEBUG"; fi
|
if [[ ${ACTIONS_RUNNER_DEBUG} == true ]]; then LOG_LEVEL="DEBUG"; fi
|
||||||
# Boolean to see trace logs
|
# Boolean to see trace logs
|
||||||
|
@ -56,10 +56,10 @@ source /action/lib/worker.sh # Source the function script(s)
|
||||||
# GLOBALS #
|
# GLOBALS #
|
||||||
###########
|
###########
|
||||||
# Default Vars
|
# Default Vars
|
||||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
||||||
GITHUB_API_URL='https://api.github.com' # GitHub API root url
|
GITHUB_API_URL='https://api.github.com' # GitHub API root url
|
||||||
VERSION_FILE='/action/lib/linter-versions.txt' # File to store linter versions
|
VERSION_FILE='/action/lib/linter-versions.txt' # File to store linter versions
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Rules files #
|
# Rules files #
|
||||||
|
@ -219,20 +219,20 @@ LINTED_LANGUAGES_ARRAY=() # Will be filled at run time with all languages that w
|
||||||
###################
|
###################
|
||||||
# GitHub ENV Vars #
|
# GitHub ENV Vars #
|
||||||
###################
|
###################
|
||||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||||
FILTER_REGEX_INCLUDE="${FILTER_REGEX_INCLUDE}" # RegExp defining which files will be processed by linters (all by default)
|
FILTER_REGEX_INCLUDE="${FILTER_REGEX_INCLUDE}" # RegExp defining which files will be processed by linters (all by default)
|
||||||
FILTER_REGEX_EXCLUDE="${FILTER_REGEX_EXCLUDE}" # RegExp defining which files will be excluded from linting (none by default)
|
FILTER_REGEX_EXCLUDE="${FILTER_REGEX_EXCLUDE}" # RegExp defining which files will be excluded from linting (none by default)
|
||||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||||
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
||||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||||
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||||
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
||||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||||
|
|
||||||
################
|
################
|
||||||
# Default Vars #
|
# Default Vars #
|
||||||
|
@ -245,23 +245,23 @@ DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run o
|
||||||
###############################################################
|
###############################################################
|
||||||
# Default Vars that are called in Subs and need to be ignored #
|
# Default Vars that are called in Subs and need to be ignored #
|
||||||
###############################################################
|
###############################################################
|
||||||
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
||||||
export DEFAULT_DISABLE_ERRORS # Workaround SC2034
|
export DEFAULT_DISABLE_ERRORS # Workaround SC2034
|
||||||
ERROR_ON_MISSING_EXEC_BIT="${ERROR_ON_MISSING_EXEC_BIT:-false}" # Default to report a warning if a shell script doesn't have the executable bit set to 1
|
ERROR_ON_MISSING_EXEC_BIT="${ERROR_ON_MISSING_EXEC_BIT:-false}" # Default to report a warning if a shell script doesn't have the executable bit set to 1
|
||||||
export ERROR_ON_MISSING_EXEC_BIT
|
export ERROR_ON_MISSING_EXEC_BIT
|
||||||
RAW_FILE_ARRAY=() # Array of all files that were changed
|
RAW_FILE_ARRAY=() # Array of all files that were changed
|
||||||
export RAW_FILE_ARRAY # Workaround SC2034
|
export RAW_FILE_ARRAY # Workaround SC2034
|
||||||
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
||||||
export TEST_CASE_FOLDER # Workaround SC2034
|
export TEST_CASE_FOLDER # Workaround SC2034
|
||||||
WARNING_ARRAY_TEST=() # Array of warning linters that did not have an expected test result.
|
WARNING_ARRAY_TEST=() # Array of warning linters that did not have an expected test result.
|
||||||
export WARNING_ARRAY_TEST # Workaround SC2034
|
export WARNING_ARRAY_TEST # Workaround SC2034
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Format #
|
# Format #
|
||||||
##############
|
##############
|
||||||
OUTPUT_FORMAT="${OUTPUT_FORMAT}" # Output format to be generated. Default none
|
OUTPUT_FORMAT="${OUTPUT_FORMAT}" # Output format to be generated. Default none
|
||||||
OUTPUT_FOLDER="${OUTPUT_FOLDER:-super-linter.report}" # Folder where the reports are generated. Default super-linter.report
|
OUTPUT_FOLDER="${OUTPUT_FOLDER:-super-linter.report}" # Folder where the reports are generated. Default super-linter.report
|
||||||
OUTPUT_DETAILS="${OUTPUT_DETAILS:-simpler}" # What level of details. (simpler or detailed). Default simpler
|
OUTPUT_DETAILS="${OUTPUT_DETAILS:-simpler}" # What level of details. (simpler or detailed). Default simpler
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Array of changed files #
|
# Array of changed files #
|
||||||
|
@ -279,7 +279,7 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
|
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
|
||||||
debug "Checking if linter with name ${LINTER_NAME} for the ${LANGUAGE} language is available..."
|
debug "Checking if linter with name ${LINTER_NAME} for the ${LANGUAGE} language is available..."
|
||||||
|
|
||||||
if ! command -v "${LINTER_NAME}" 1&>/dev/null 2>&1; then
|
if ! command -v "${LINTER_NAME}" 1 &>/dev/null 2>&1; then
|
||||||
# Failed
|
# Failed
|
||||||
fatal "Failed to find [${LINTER_NAME}] in system!"
|
fatal "Failed to find [${LINTER_NAME}] in system!"
|
||||||
else
|
else
|
||||||
|
@ -288,8 +288,6 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -1189,9 +1187,9 @@ GetGitHubVars
|
||||||
########################################################
|
########################################################
|
||||||
# Initialize variables that depend on GitHub variables #
|
# Initialize variables that depend on GitHub variables #
|
||||||
########################################################
|
########################################################
|
||||||
DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory
|
DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory
|
||||||
export DEFAULT_ANSIBLE_DIRECTORY # Workaround SC2034
|
export DEFAULT_ANSIBLE_DIRECTORY # Workaround SC2034
|
||||||
REPORT_OUTPUT_FOLDER="${GITHUB_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the report folder
|
REPORT_OUTPUT_FOLDER="${GITHUB_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the report folder
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Validate the environment #
|
# Validate the environment #
|
||||||
|
@ -1271,7 +1269,6 @@ LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-esli
|
||||||
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
||||||
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES}"
|
||||||
|
|
||||||
|
|
||||||
debug "--- Linter commands ---"
|
debug "--- Linter commands ---"
|
||||||
debug "-----------------------"
|
debug "-----------------------"
|
||||||
for i in "${!LINTER_COMMANDS_ARRAY[@]}"; do
|
for i in "${!LINTER_COMMANDS_ARRAY[@]}"; do
|
||||||
|
@ -1317,8 +1314,8 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then
|
elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then
|
||||||
info "No .lintr configuration file found, using defaults."
|
info "No .lintr configuration file found, using defaults."
|
||||||
cp "$R_LINTER_RULES" "$GITHUB_WORKSPACE"
|
cp "$R_LINTER_RULES" "$GITHUB_WORKSPACE"
|
||||||
# Check if there's local configuration for the Raku linter
|
# Check if there's local configuration for the Raku linter
|
||||||
elif [ "${LANGUAGE}" = "RAKU" ] && [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then
|
elif [ "${LANGUAGE}" = "RAKU" ] && [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then
|
||||||
cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test .
|
cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test .
|
||||||
|
@ -1331,14 +1328,14 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
LintAnsibleFiles "${ANSIBLE_LINTER_RULES}" # Passing rules but not needed, dont want to exclude unused var
|
LintAnsibleFiles "${ANSIBLE_LINTER_RULES}" # Passing rules but not needed, dont want to exclude unused var
|
||||||
else
|
else
|
||||||
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
|
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
|
||||||
if [ -z "${LINTER_NAME}" ];then
|
if [ -z "${LINTER_NAME}" ]; then
|
||||||
fatal "Cannot find the linter name for ${LANGUAGE} language."
|
fatal "Cannot find the linter name for ${LANGUAGE} language."
|
||||||
else
|
else
|
||||||
debug "Setting LINTER_NAME to ${LINTER_NAME}..."
|
debug "Setting LINTER_NAME to ${LINTER_NAME}..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LINTER_COMMAND="${LINTER_COMMANDS_ARRAY["${LANGUAGE}"]}"
|
LINTER_COMMAND="${LINTER_COMMANDS_ARRAY["${LANGUAGE}"]}"
|
||||||
if [ -z "${LINTER_COMMAND}" ];then
|
if [ -z "${LINTER_COMMAND}" ]; then
|
||||||
fatal "Cannot find the linter command for ${LANGUAGE} language."
|
fatal "Cannot find the linter command for ${LANGUAGE} language."
|
||||||
else
|
else
|
||||||
debug "Setting LINTER_COMMAND to ${LINTER_COMMAND}..."
|
debug "Setting LINTER_COMMAND to ${LINTER_COMMAND}..."
|
||||||
|
|
|
@ -74,7 +74,7 @@ WriteFile() {
|
||||||
#################################
|
#################################
|
||||||
# Write the data to output file #
|
# Write the data to output file #
|
||||||
#################################
|
#################################
|
||||||
echo "${LINTER}: ${VERSION}" >> "${VERSION_FILE}" 2>&1
|
echo "${LINTER}: ${VERSION}" >>"${VERSION_FILE}" 2>&1
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
|
|
@ -29,7 +29,7 @@ export NC
|
||||||
# Log Functions
|
# Log Functions
|
||||||
LOG_TEMP=$(mktemp) || echo "Failed to create temporary log file."
|
LOG_TEMP=$(mktemp) || echo "Failed to create temporary log file."
|
||||||
export LOG_TEMP
|
export LOG_TEMP
|
||||||
echo "super-linter Log" > "${LOG_TEMP}"
|
echo "super-linter Log" >"${LOG_TEMP}"
|
||||||
log() {
|
log() {
|
||||||
local TOTERM=${1:-}
|
local TOTERM=${1:-}
|
||||||
local MESSAGE=${2:-}
|
local MESSAGE=${2:-}
|
||||||
|
@ -37,7 +37,7 @@ log() {
|
||||||
if [[ -n ${TOTERM} ]]; then
|
if [[ -n ${TOTERM} ]]; then
|
||||||
tee -a "${LOG_TEMP}" >&2
|
tee -a "${LOG_TEMP}" >&2
|
||||||
else
|
else
|
||||||
cat >> "${LOG_TEMP}" 2>&1
|
cat >>"${LOG_TEMP}" 2>&1
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
###########
|
###########
|
||||||
# Globals #
|
# Globals #
|
||||||
###########
|
###########
|
||||||
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
|
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
|
||||||
ERROR=0 # Error count
|
ERROR=0 # Error count
|
||||||
|
|
||||||
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue