mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 08:41:02 -05:00
Format (fix indentation)
This commit is contained in:
parent
a03fd743f1
commit
0e547aa871
6 changed files with 2371 additions and 2371 deletions
File diff suppressed because it is too large
Load diff
1748
lib/linter.sh
1748
lib/linter.sh
File diff suppressed because it is too large
Load diff
54
lib/log.sh
54
lib/log.sh
|
@ -1,24 +1,24 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
declare -Agr B=(
|
declare -Agr B=(
|
||||||
[B]=$(echo -e "\e[44m")
|
[B]=$(echo -e "\e[44m")
|
||||||
[C]=$(echo -e "\e[46m")
|
[C]=$(echo -e "\e[46m")
|
||||||
[G]=$(echo -e "\e[42m")
|
[G]=$(echo -e "\e[42m")
|
||||||
[K]=$(echo -e "\e[40m")
|
[K]=$(echo -e "\e[40m")
|
||||||
[M]=$(echo -e "\e[45m")
|
[M]=$(echo -e "\e[45m")
|
||||||
[R]=$(echo -e "\e[41m")
|
[R]=$(echo -e "\e[41m")
|
||||||
[W]=$(echo -e "\e[47m")
|
[W]=$(echo -e "\e[47m")
|
||||||
[Y]=$(echo -e "\e[43m")
|
[Y]=$(echo -e "\e[43m")
|
||||||
)
|
)
|
||||||
declare -Agr F=(
|
declare -Agr F=(
|
||||||
[B]=$(echo -e "\e[0;34m")
|
[B]=$(echo -e "\e[0;34m")
|
||||||
[C]=$(echo -e "\e[0;36m")
|
[C]=$(echo -e "\e[0;36m")
|
||||||
[G]=$(echo -e "\e[0;32m")
|
[G]=$(echo -e "\e[0;32m")
|
||||||
[K]=$(echo -e "\e[0;30m")
|
[K]=$(echo -e "\e[0;30m")
|
||||||
[M]=$(echo -e "\e[0;35m")
|
[M]=$(echo -e "\e[0;35m")
|
||||||
[R]=$(echo -e "\e[0;31m")
|
[R]=$(echo -e "\e[0;31m")
|
||||||
[W]=$(echo -e "\e[0;37m")
|
[W]=$(echo -e "\e[0;37m")
|
||||||
[Y]=$(echo -e "\e[0;33m")
|
[Y]=$(echo -e "\e[0;33m")
|
||||||
)
|
)
|
||||||
readonly NC=$(echo -e "\e[0m")
|
readonly NC=$(echo -e "\e[0m")
|
||||||
|
|
||||||
|
@ -31,15 +31,15 @@ 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:-}
|
||||||
echo -e "${MESSAGE:-}" | (
|
echo -e "${MESSAGE:-}" | (
|
||||||
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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
trace() { log "${LOG_TRACE:-}" "${NC}$(date +"%F %T") ${F[B]}[TRACE ]${NC} $*${NC}"; }
|
trace() { log "${LOG_TRACE:-}" "${NC}$(date +"%F %T") ${F[B]}[TRACE ]${NC} $*${NC}"; }
|
||||||
debug() { log "${LOG_DEBUG:-}" "${NC}$(date +"%F %T") ${F[B]}[DEBUG ]${NC} $*${NC}"; }
|
debug() { log "${LOG_DEBUG:-}" "${NC}$(date +"%F %T") ${F[B]}[DEBUG ]${NC} $*${NC}"; }
|
||||||
|
@ -48,6 +48,6 @@ notice() { log "true" "${NC}$(date +"%F %T") ${F[G]}[NOTICE]${NC} $*${NC}"; }
|
||||||
warn() { log "true" "${NC}$(date +"%F %T") ${F[Y]}[WARN ]${NC} $*${NC}"; }
|
warn() { log "true" "${NC}$(date +"%F %T") ${F[Y]}[WARN ]${NC} $*${NC}"; }
|
||||||
error() { log "true" "${NC}$(date +"%F %T") ${F[R]}[ERROR ]${NC} $*${NC}"; }
|
error() { log "true" "${NC}$(date +"%F %T") ${F[R]}[ERROR ]${NC} $*${NC}"; }
|
||||||
fatal() {
|
fatal() {
|
||||||
log "true" "${NC}$(date +"%F %T") ${B[R]}${F[W]}[FATAL ]${NC} $*${NC}"
|
log "true" "${NC}$(date +"%F %T") ${B[R]}${F[W]}[FATAL ]${NC} $*${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
declare -Agr B=(
|
declare -Agr B=(
|
||||||
[B]=$(echo -e "\e[44m")
|
[B]=$(echo -e "\e[44m")
|
||||||
[C]=$(echo -e "\e[46m")
|
[C]=$(echo -e "\e[46m")
|
||||||
[G]=$(echo -e "\e[42m")
|
[G]=$(echo -e "\e[42m")
|
||||||
[K]=$(echo -e "\e[40m")
|
[K]=$(echo -e "\e[40m")
|
||||||
[M]=$(echo -e "\e[45m")
|
[M]=$(echo -e "\e[45m")
|
||||||
[R]=$(echo -e "\e[41m")
|
[R]=$(echo -e "\e[41m")
|
||||||
[W]=$(echo -e "\e[47m")
|
[W]=$(echo -e "\e[47m")
|
||||||
[Y]=$(echo -e "\e[43m")
|
[Y]=$(echo -e "\e[43m")
|
||||||
)
|
)
|
||||||
declare -Agr F=(
|
declare -Agr F=(
|
||||||
[B]=$(echo -e "\e[0;34m")
|
[B]=$(echo -e "\e[0;34m")
|
||||||
[C]=$(echo -e "\e[0;36m")
|
[C]=$(echo -e "\e[0;36m")
|
||||||
[G]=$(echo -e "\e[0;32m")
|
[G]=$(echo -e "\e[0;32m")
|
||||||
[K]=$(echo -e "\e[0;30m")
|
[K]=$(echo -e "\e[0;30m")
|
||||||
[M]=$(echo -e "\e[0;35m")
|
[M]=$(echo -e "\e[0;35m")
|
||||||
[R]=$(echo -e "\e[0;31m")
|
[R]=$(echo -e "\e[0;31m")
|
||||||
[W]=$(echo -e "\e[0;37m")
|
[W]=$(echo -e "\e[0;37m")
|
||||||
[Y]=$(echo -e "\e[0;33m")
|
[Y]=$(echo -e "\e[0;33m")
|
||||||
)
|
)
|
||||||
readonly NC=$(echo -e "\e[0m")
|
readonly NC=$(echo -e "\e[0m")
|
||||||
|
|
||||||
|
|
|
@ -10,175 +10,175 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetValidationInfo ################################################
|
#### Function GetValidationInfo ################################################
|
||||||
function GetValidationInfo() {
|
function GetValidationInfo() {
|
||||||
############################################
|
############################################
|
||||||
# Print headers for user provided env vars #
|
# Print headers for user provided env vars #
|
||||||
############################################
|
############################################
|
||||||
info "--------------------------------------------"
|
info "--------------------------------------------"
|
||||||
info "Gathering user validation information..."
|
info "Gathering user validation information..."
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Skip validation if were running locally #
|
# Skip validation if were running locally #
|
||||||
###########################################
|
###########################################
|
||||||
if [[ ${RUN_LOCAL} != "true" ]]; then
|
if [[ ${RUN_LOCAL} != "true" ]]; then
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE,,}"
|
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE,,}"
|
||||||
######################################
|
######################################
|
||||||
# Validate we should check all files #
|
# Validate we should check all files #
|
||||||
######################################
|
######################################
|
||||||
if [[ ${VALIDATE_ALL_CODEBASE} != "false" ]]; then
|
if [[ ${VALIDATE_ALL_CODEBASE} != "false" ]]; then
|
||||||
# Set to true
|
# Set to true
|
||||||
VALIDATE_ALL_CODEBASE="${DEFAULT_VALIDATE_ALL_CODEBASE}"
|
VALIDATE_ALL_CODEBASE="${DEFAULT_VALIDATE_ALL_CODEBASE}"
|
||||||
info "- Validating ALL files in code base..."
|
info "- Validating ALL files in code base..."
|
||||||
else
|
|
||||||
# Its false
|
|
||||||
info "- Only validating [new], or [edited] files in code base..."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Create Print Array #
|
|
||||||
######################
|
|
||||||
PRINT_ARRAY=()
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Convert strings to lowercase #
|
|
||||||
################################
|
|
||||||
# Loop through all languages
|
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
|
||||||
# build the variable
|
|
||||||
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
|
||||||
# Set the value of the var to lowercase
|
|
||||||
eval "${VALIDATE_LANGUAGE}=${!VALIDATE_LANGUAGE,,}"
|
|
||||||
done
|
|
||||||
|
|
||||||
################################################
|
|
||||||
# Determine if any linters were explicitly set #
|
|
||||||
################################################
|
|
||||||
ANY_SET="false"
|
|
||||||
# Loop through all languages
|
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
|
||||||
# build the variable
|
|
||||||
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
|
||||||
# Check to see if the variable was set
|
|
||||||
if [ -n "${!VALIDATE_LANGUAGE}" ]; then
|
|
||||||
# It was set, need to set flag
|
|
||||||
ANY_SET="true"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
###################################################
|
|
||||||
# Validate if we should check individual lanuages #
|
|
||||||
###################################################
|
|
||||||
# Loop through all languages
|
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
|
||||||
# build the variable
|
|
||||||
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
|
||||||
# Check if ANY_SET was set
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Check to see if the variable was set
|
|
||||||
if [ -z "${!VALIDATE_LANGUAGE}" ]; then
|
|
||||||
# Flag was not set, default to false
|
|
||||||
eval "${VALIDATE_LANGUAGE}='false'"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
eval "${VALIDATE_LANGUAGE}='true'"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Print which linters we are enabling #
|
|
||||||
#######################################
|
|
||||||
# Loop through all languages
|
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
|
||||||
# build the variable
|
|
||||||
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
|
||||||
if [[ ${!VALIDATE_LANGUAGE} == "true" ]]; then
|
|
||||||
# We need to validate
|
|
||||||
PRINT_ARRAY+=("- Validating [$LANGUAGE] files in code base...")
|
|
||||||
else
|
|
||||||
# We are skipping the language
|
|
||||||
PRINT_ARRAY+=("- Excluding [$LANGUAGE] files in code base...")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Validate Ansible Directory #
|
|
||||||
##############################
|
|
||||||
if [ -z "${ANSIBLE_DIRECTORY}" ]; then
|
|
||||||
# No Value, need to default
|
|
||||||
ANSIBLE_DIRECTORY="${DEFAULT_ANSIBLE_DIRECTORY}"
|
|
||||||
else
|
else
|
||||||
# Check if first char is '/'
|
# Its false
|
||||||
if [[ ${ANSIBLE_DIRECTORY:0:1} == "/" ]]; then
|
info "- Only validating [new], or [edited] files in code base..."
|
||||||
# Remove first char
|
|
||||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:1}"
|
|
||||||
fi
|
|
||||||
# Need to give it full path
|
|
||||||
TEMP_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/${ANSIBLE_DIRECTORY}"
|
|
||||||
# Set the value
|
|
||||||
ANSIBLE_DIRECTORY="${TEMP_ANSIBLE_DIRECTORY}"
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
###############################
|
######################
|
||||||
# Get the disable errors flag #
|
# Create Print Array #
|
||||||
###############################
|
######################
|
||||||
if [ -z "${DISABLE_ERRORS}" ]; then
|
PRINT_ARRAY=()
|
||||||
##################################
|
|
||||||
# No flag passed, set to default #
|
################################
|
||||||
##################################
|
# Convert strings to lowercase #
|
||||||
DISABLE_ERRORS="${DEFAULT_DISABLE_ERRORS}"
|
################################
|
||||||
|
# Loop through all languages
|
||||||
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
|
# build the variable
|
||||||
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
|
# Set the value of the var to lowercase
|
||||||
|
eval "${VALIDATE_LANGUAGE}=${!VALIDATE_LANGUAGE,,}"
|
||||||
|
done
|
||||||
|
|
||||||
|
################################################
|
||||||
|
# Determine if any linters were explicitly set #
|
||||||
|
################################################
|
||||||
|
ANY_SET="false"
|
||||||
|
# Loop through all languages
|
||||||
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
|
# build the variable
|
||||||
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
|
# Check to see if the variable was set
|
||||||
|
if [ -n "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
|
# It was set, need to set flag
|
||||||
|
ANY_SET="true"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
###############################
|
###################################################
|
||||||
# Convert string to lowercase #
|
# Validate if we should check individual lanuages #
|
||||||
###############################
|
###################################################
|
||||||
DISABLE_ERRORS="${DISABLE_ERRORS,,}"
|
# Loop through all languages
|
||||||
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
############################
|
# build the variable
|
||||||
# Set to false if not true #
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
############################
|
# Check if ANY_SET was set
|
||||||
if [ "${DISABLE_ERRORS}" != "true" ]; then
|
if [[ ${ANY_SET} == "true" ]]; then
|
||||||
DISABLE_ERRORS="false"
|
# Check to see if the variable was set
|
||||||
|
if [ -z "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
|
# Flag was not set, default to false
|
||||||
|
eval "${VALIDATE_LANGUAGE}='false'"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No linter flags were set - default all to true
|
||||||
|
eval "${VALIDATE_LANGUAGE}='true'"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
############################
|
#######################################
|
||||||
# Get the run verbose flag #
|
# Print which linters we are enabling #
|
||||||
############################
|
#######################################
|
||||||
if [ -z "${ACTIONS_RUNNER_DEBUG}" ]; then
|
# Loop through all languages
|
||||||
##################################
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
# No flag passed, set to default #
|
# build the variable
|
||||||
##################################
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
ACTIONS_RUNNER_DEBUG="${DEFAULT_ACTIONS_RUNNER_DEBUG}"
|
if [[ ${!VALIDATE_LANGUAGE} == "true" ]]; then
|
||||||
|
# We need to validate
|
||||||
|
PRINT_ARRAY+=("- Validating [$LANGUAGE] files in code base...")
|
||||||
|
else
|
||||||
|
# We are skipping the language
|
||||||
|
PRINT_ARRAY+=("- Excluding [$LANGUAGE] files in code base...")
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
###############################
|
##############################
|
||||||
# Convert string to lowercase #
|
# Validate Ansible Directory #
|
||||||
###############################
|
##############################
|
||||||
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG,,}"
|
if [ -z "${ANSIBLE_DIRECTORY}" ]; then
|
||||||
|
# No Value, need to default
|
||||||
############################
|
ANSIBLE_DIRECTORY="${DEFAULT_ANSIBLE_DIRECTORY}"
|
||||||
# Set to true if not false #
|
else
|
||||||
############################
|
# Check if first char is '/'
|
||||||
if [ "${ACTIONS_RUNNER_DEBUG}" != "false" ]; then
|
if [[ ${ANSIBLE_DIRECTORY:0:1} == "/" ]]; then
|
||||||
ACTIONS_RUNNER_DEBUG="true"
|
# Remove first char
|
||||||
|
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:1}"
|
||||||
fi
|
fi
|
||||||
|
# Need to give it full path
|
||||||
|
TEMP_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/${ANSIBLE_DIRECTORY}"
|
||||||
|
# Set the value
|
||||||
|
ANSIBLE_DIRECTORY="${TEMP_ANSIBLE_DIRECTORY}"
|
||||||
|
fi
|
||||||
|
|
||||||
###########################
|
###############################
|
||||||
# Print the validate info #
|
# Get the disable errors flag #
|
||||||
###########################
|
###############################
|
||||||
for LINE in "${PRINT_ARRAY[@]}"; do
|
if [ -z "${DISABLE_ERRORS}" ]; then
|
||||||
debug "${LINE}"
|
##################################
|
||||||
done
|
# No flag passed, set to default #
|
||||||
|
##################################
|
||||||
|
DISABLE_ERRORS="${DEFAULT_DISABLE_ERRORS}"
|
||||||
|
fi
|
||||||
|
|
||||||
debug "--- DEBUG INFO ---"
|
###############################
|
||||||
debug "---------------------------------------------"
|
# Convert string to lowercase #
|
||||||
RUNNER=$(whoami)
|
###############################
|
||||||
debug "Runner:[${RUNNER}]"
|
DISABLE_ERRORS="${DISABLE_ERRORS,,}"
|
||||||
PRINTENV=$(printenv)
|
|
||||||
debug "ENV:"
|
############################
|
||||||
debug "${PRINTENV}"
|
# Set to false if not true #
|
||||||
debug "---------------------------------------------"
|
############################
|
||||||
|
if [ "${DISABLE_ERRORS}" != "true" ]; then
|
||||||
|
DISABLE_ERRORS="false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Get the run verbose flag #
|
||||||
|
############################
|
||||||
|
if [ -z "${ACTIONS_RUNNER_DEBUG}" ]; then
|
||||||
|
##################################
|
||||||
|
# No flag passed, set to default #
|
||||||
|
##################################
|
||||||
|
ACTIONS_RUNNER_DEBUG="${DEFAULT_ACTIONS_RUNNER_DEBUG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Convert string to lowercase #
|
||||||
|
###############################
|
||||||
|
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG,,}"
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Set to true if not false #
|
||||||
|
############################
|
||||||
|
if [ "${ACTIONS_RUNNER_DEBUG}" != "false" ]; then
|
||||||
|
ACTIONS_RUNNER_DEBUG="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Print the validate info #
|
||||||
|
###########################
|
||||||
|
for LINE in "${PRINT_ARRAY[@]}"; do
|
||||||
|
debug "${LINE}"
|
||||||
|
done
|
||||||
|
|
||||||
|
debug "--- DEBUG INFO ---"
|
||||||
|
debug "---------------------------------------------"
|
||||||
|
RUNNER=$(whoami)
|
||||||
|
debug "Runner:[${RUNNER}]"
|
||||||
|
PRINTENV=$(printenv)
|
||||||
|
debug "ENV:"
|
||||||
|
debug "${PRINTENV}"
|
||||||
|
debug "---------------------------------------------"
|
||||||
}
|
}
|
||||||
|
|
1596
lib/worker.sh
1596
lib/worker.sh
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue