Fix shfmt errors

This commit is contained in:
Marco Ferrari 2020-11-06 23:10:09 +01:00
parent e1a83d9f70
commit b7e5dfce01
11 changed files with 152 additions and 134 deletions

View file

@ -11,7 +11,7 @@ GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Git
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
TEST_FOLDER='.automation/test' # Folder where test are stored
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
############################
@ -39,7 +39,10 @@ CleanTestFiles() {
##################
# 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 #
@ -70,7 +73,10 @@ CleanTestFiles() {
################################
# 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 #
@ -96,7 +102,10 @@ CleanTestDockerFiles() {
##################
# 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 #
@ -127,7 +136,10 @@ CleanTestDockerFiles() {
################################
# 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 #
@ -153,7 +165,10 @@ CleanSHAFolder() {
##################
# 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 #
@ -178,7 +193,10 @@ RenameTestFolder() {
#####################
# 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 #
@ -205,7 +223,10 @@ CleanPowershell() {
##################
# 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 #
@ -236,7 +257,10 @@ CleanPowershell() {
################################
# 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 #

View file

@ -22,7 +22,7 @@ DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Pas
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
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
#########################

View file

@ -21,8 +21,7 @@ PROCESS_CHECK=0 # Count of times to check the process
################################################################################
################################################################################
#### Function CheckGHEPid ######################################################
CheckGHEPid()
{
CheckGHEPid() {
##################################
# Check to prevent infinite loop #
##################################
@ -75,8 +74,7 @@ CheckGHEPid()
}
################################################################################
#### Function CheckGHEProcess ##################################################
CheckGHEProcess()
{
CheckGHEProcess() {
##################################
# Check to prevent infinite loop #
##################################
@ -139,8 +137,7 @@ CheckGHEProcess()
}
################################################################################
#### Function RunConfigApply ###################################################
RunConfigApply()
{
RunConfigApply() {
##########
# Header #
##########

View file

@ -41,7 +41,7 @@ CONTAINER_URL='' # Final URL to upload
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_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
#########################

View file

@ -13,7 +13,7 @@ BUILD_DATE="${BUILD_DATE}" # Dat
BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha
BUILD_VERSION="${GITHUB_SHA}" # Version of the container
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
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR

View file

@ -279,7 +279,7 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
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
fatal "Failed to find [${LINTER_NAME}] in system!"
else
@ -288,8 +288,6 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
fi
done
################################################################################
########################## FUNCTIONS BELOW #####################################
################################################################################
@ -1271,7 +1269,6 @@ LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-esli
LINTER_COMMANDS_ARRAY['XML']="xmllint"
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES}"
debug "--- Linter commands ---"
debug "-----------------------"
for i in "${!LINTER_COMMANDS_ARRAY[@]}"; do
@ -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
else
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."
else
debug "Setting LINTER_NAME to ${LINTER_NAME}..."
fi
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."
else
debug "Setting LINTER_COMMAND to ${LINTER_COMMAND}..."

View file

@ -74,7 +74,7 @@ WriteFile() {
#################################
# Write the data to output file #
#################################
echo "${LINTER}: ${VERSION}" >> "${VERSION_FILE}" 2>&1
echo "${LINTER}: ${VERSION}" >>"${VERSION_FILE}" 2>&1
#######################
# Load the error code #

View file

@ -29,7 +29,7 @@ export NC
# Log Functions
LOG_TEMP=$(mktemp) || echo "Failed to create temporary log file."
export LOG_TEMP
echo "super-linter Log" > "${LOG_TEMP}"
echo "super-linter Log" >"${LOG_TEMP}"
log() {
local TOTERM=${1:-}
local MESSAGE=${2:-}
@ -37,7 +37,7 @@ log() {
if [[ -n ${TOTERM} ]]; then
tee -a "${LOG_TEMP}" >&2
else
cat >> "${LOG_TEMP}" 2>&1
cat >>"${LOG_TEMP}" 2>&1
fi
)
}

View file

@ -7,7 +7,7 @@
###########
# 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
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR