Merge pull request #351 from nemchik/shfmt

shfmt files
This commit is contained in:
Lukas Gravley 2020-07-02 09:33:26 -05:00 committed by GitHub
commit bd83a8a7cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 426 additions and 445 deletions

View file

@ -28,8 +28,7 @@ DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
################################################################################
################################################################################
#### Function Header ###########################################################
Header()
{
Header() {
echo ""
echo "-------------------------------------------------------"
echo "----- GitHub Actions remove image from DockerHub ------"
@ -38,8 +37,7 @@ Header()
}
################################################################################
#### Function ValidateInput ####################################################
ValidateInput()
{
ValidateInput() {
# Need to validate we have the basic variables
################
# Print header #
@ -69,7 +67,7 @@ ValidateInput()
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}"
exit 1
elif [[ "$IMAGE_REPO" == "github/super-linter" ]]; then
elif [[ $IMAGE_REPO == "github/super-linter" ]]; then
# Found our main repo
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]"
else
@ -114,7 +112,7 @@ ValidateInput()
##################################################
# Check if we need to get the name of the branch #
##################################################
if [[ "$IMAGE_VERSION" != "latest" ]]; then
if [[ $IMAGE_VERSION != "latest" ]]; then
##################################
# Remove non alpha-numeric chars #
##################################
@ -131,8 +129,7 @@ ValidateInput()
}
################################################################################
#### Function LoginToDocker ####################################################
LoginToDocker()
{
LoginToDocker() {
################
# Print header #
################
@ -167,8 +164,7 @@ LoginToDocker()
}
################################################################################
#### Function RemoveImage ######################################################
RemoveImage()
{
RemoveImage() {
################
# Print header #
################
@ -232,8 +228,7 @@ RemoveImage()
}
################################################################################
#### Function Footer ###########################################################
Footer()
{
Footer() {
echo ""
echo "-------------------------------------------------------"
echo "The step has completed"

View file

@ -34,8 +34,7 @@ UPDATE_MAJOR_TAG=0 # Flag to deploy the major tag version a
################################################################################
################################################################################
#### Function Header ###########################################################
Header()
{
Header() {
echo ""
echo "-------------------------------------------------------"
echo "---- GitHub Actions Upload image to [$REGISTRY] ----"
@ -44,8 +43,7 @@ Header()
}
################################################################################
#### Function ValidateInput ####################################################
ValidateInput()
{
ValidateInput() {
# Need to validate we have the basic variables
################
# Print header #
@ -81,7 +79,7 @@ ValidateInput()
#####################################################
# See if we need values for GitHub package Registry #
#####################################################
if [[ "$REGISTRY" == "GPR" ]]; then
if [[ $REGISTRY == "GPR" ]]; then
#########################
# Validate GPR_USERNAME #
#########################
@ -106,7 +104,7 @@ ValidateInput()
########################################
# See if we need values for Ducker hub #
########################################
elif [[ "$REGISTRY" == "Docker" ]]; then
elif [[ $REGISTRY == "Docker" ]]; then
############################
# Validate DOCKER_USERNAME #
############################
@ -137,7 +135,6 @@ ValidateInput()
exit 1
fi
#######################
# Validate IMAGE_REPO #
#######################
@ -150,7 +147,7 @@ ValidateInput()
###############################################
# Need to see if GPR registry and update name #
###############################################
if [[ "$REGISTRY" == "GPR" ]]; then
if [[ $REGISTRY == "GPR" ]]; then
NAME="docker.pkg.github.com/$IMAGE_REPO/super-linter"
IMAGE_REPO="$NAME"
echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR"
@ -204,7 +201,7 @@ ValidateInput()
######################################################################
# Check if this is a latest to a versioned release at create new tag #
######################################################################
if [[ "$IMAGE_VERSION" =~ $REGEX ]]; then
if [[ $IMAGE_VERSION =~ $REGEX ]]; then
# Need to get the major version, and set flag to update
#####################
@ -233,8 +230,7 @@ ValidateInput()
}
################################################################################
#### Function Authenticate #####################################################
Authenticate()
{
Authenticate() {
################
# Pull in Vars #
################
@ -277,8 +273,7 @@ Authenticate()
}
################################################################################
#### Function BuildImage #######################################################
BuildImage()
{
BuildImage() {
################
# Print header #
################
@ -348,8 +343,7 @@ BuildImage()
}
################################################################################
#### Function UploadImage ######################################################
UploadImage()
{
UploadImage() {
################
# Print header #
################
@ -450,8 +444,7 @@ UploadImage()
}
################################################################################
#### Function Footer ###########################################################
Footer()
{
Footer() {
echo ""
echo "-------------------------------------------------------"
echo "The step has completed"
@ -480,14 +473,14 @@ BuildImage
######################
# Login to DockerHub #
######################
if [[ "$REGISTRY" == "Docker" ]]; then
if [[ $REGISTRY == "Docker" ]]; then
# Authenticate "Username" "Password" "Url" "Name"
Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub"
####################################
# Login to GitHub Package Registry #
####################################
elif [[ "$REGISTRY" == "GPR" ]]; then
elif [[ $REGISTRY == "GPR" ]]; then
# Authenticate "Username" "Password" "Url" "Name"
Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry"

View file

@ -9,15 +9,14 @@
################################################################################
################################################################################
#### Function BuildFileList ####################################################
function BuildFileList()
{
function BuildFileList() {
# Need to build a list of all files changed
# This can be pulled from the GITHUB_EVENT_PATH payload
################
# print header #
################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
echo ""
echo "----------------------------------------------"
echo "Pulling in code history and branches..."
@ -26,7 +25,10 @@ function BuildFileList()
#################################################################################
# Switch codebase back to the default branch to get a list of all files changed #
#################################################################################
SWITCH_CMD=$(git -C "$GITHUB_WORKSPACE" pull --quiet; git -C "$GITHUB_WORKSPACE" checkout "$DEFAULT_BRANCH" 2>&1)
SWITCH_CMD=$(
git -C "$GITHUB_WORKSPACE" pull --quiet
git -C "$GITHUB_WORKSPACE" checkout "$DEFAULT_BRANCH" 2>&1
)
#######################
# Load the error code #
@ -46,7 +48,7 @@ function BuildFileList()
################
# print header #
################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
echo ""
echo "----------------------------------------------"
echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]"
@ -78,8 +80,7 @@ function BuildFileList()
echo ""
echo "----------------------------------------------"
echo "Files that have been modified in the commit(s):"
for FILE in "${RAW_FILE_ARRAY[@]}"
do
for FILE in "${RAW_FILE_ARRAY[@]}"; do
##############
# Print file #
##############
@ -371,7 +372,7 @@ function BuildFileList()
#################
# Check if bash #
#################
if [[ "$GET_FILE_TYPE_CMD" == *"Bourne-Again shell script"* ]]; then
if [[ $GET_FILE_TYPE_CMD == *"Bourne-Again shell script"* ]]; then
#######################
# It is a bash script #
#######################
@ -385,7 +386,7 @@ function BuildFileList()
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
##########################################################
READ_ONLY_CHANGE_FLAG=1
elif [[ "$GET_FILE_TYPE_CMD" == *"Ruby script"* ]]; then
elif [[ $GET_FILE_TYPE_CMD == *"Ruby script"* ]]; then
#######################
# It is a Ruby script #
#######################

View file

@ -225,8 +225,7 @@ ERRORS_FOUND_OPENAPI=0 # Count of errors found
################################################################################
################################################################################
#### Function Header ###########################################################
Header()
{
Header() {
###############################
# Give them the possum action #
###############################
@ -247,8 +246,7 @@ Header()
}
################################################################################
#### Function GetLinterVersions ################################################
GetLinterVersions()
{
GetLinterVersions() {
#########################
# Print version headers #
#########################
@ -261,8 +259,7 @@ GetLinterVersions()
##########################################################
# Go through the array of linters and print version info #
##########################################################
for LINTER in "${LINTER_ARRAY[@]}"
do
for LINTER in "${LINTER_ARRAY[@]}"; do
echo "---------------------------------------------"
echo "[$LINTER]:"
###################
@ -292,8 +289,7 @@ GetLinterVersions()
}
################################################################################
#### Function GetLinterRules ###################################################
GetLinterRules()
{
GetLinterRules() {
# Need to validate the rules files exist
################
@ -322,15 +318,14 @@ GetLinterRules()
########################################################
# No user default provided, using the template default #
########################################################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]"
fi
fi
}
################################################################################
#### Function GetStandardRules #################################################
GetStandardRules()
{
GetStandardRules() {
################
# Pull In Vars #
################
@ -349,9 +344,9 @@ GetStandardRules()
#########################################
# Only env vars that are marked as true
GET_ENV_ARRAY=()
if [[ "$LINTER" == "javascript" ]]; then
if [[ $LINTER == "javascript" ]]; then
mapfile -t GET_ENV_ARRAY < <(yq .env "$JAVASCRIPT_LINTER_RULES" | grep true)
elif [[ "$LINTER" == "typescript" ]]; then
elif [[ $LINTER == "typescript" ]]; then
mapfile -t GET_ENV_ARRAY < <(yq .env "$TYPESCRIPT_LINTER_RULES" | grep true)
fi
@ -384,8 +379,7 @@ GetStandardRules()
#############################
# Pull out the envs to load #
#############################
for ENV in "${GET_ENV_ARRAY[@]}"
do
for ENV in "${GET_ENV_ARRAY[@]}"; do
#############################
# remove spaces from return #
#############################
@ -401,16 +395,15 @@ GetStandardRules()
#########################################
# Remove trailing and ending whitespace #
#########################################
if [[ "$LINTER" == "javascript" ]]; then
if [[ $LINTER == "javascript" ]]; then
JAVASCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
elif [[ "$LINTER" == "typescript" ]]; then
elif [[ $LINTER == "typescript" ]]; then
TYPESCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
fi
}
################################################################################
#### Function DetectOpenAPIFile ################################################
DetectOpenAPIFile()
{
DetectOpenAPIFile() {
################
# Pull in vars #
################
@ -443,8 +436,7 @@ DetectOpenAPIFile()
}
################################################################################
#### Function DetectCloudFormationFile #########################################
DetectCloudFormationFile()
{
DetectCloudFormationFile() {
################
# Pull in Vars #
################
@ -495,8 +487,7 @@ DetectCloudFormationFile()
################################################################################
#### Function GetGitHubVars ####################################################
GetGitHubVars()
{
GetGitHubVars() {
##########
# Prints #
##########
@ -536,7 +527,7 @@ GetGitHubVars()
#################################
# Check if were running locally #
#################################
if [[ "$RUN_LOCAL" != "false" ]]; then
if [[ $RUN_LOCAL != "false" ]]; then
##########################################
# We are running locally for a debug run #
##########################################
@ -557,7 +548,6 @@ GetGitHubVars()
# No need to touch or set the GITHUB_ORG
# No need to touch or set the GITHUB_REPO
#################################
# Set the VALIDATE_ALL_CODEBASE #
#################################
@ -635,11 +625,10 @@ GetGitHubVars()
}
################################################################################
#### Function ValidatePowershellModules ########################################
function ValidatePowershellModules()
{
function ValidatePowershellModules() {
VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1)
# If module found, ensure Invoke-ScriptAnalyzer command is available
if [[ "$VALIDATE_PSSA_MODULE" == "PSScriptAnalyzer" ]]; then
if [[ $VALIDATE_PSSA_MODULE == "PSScriptAnalyzer" ]]; then
VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1)
else
# Failed to find module
@ -649,7 +638,7 @@ function ValidatePowershellModules()
#########################################
# validate we found the script analyzer #
#########################################
if [[ "$VALIDATE_PSSA_CMD" != "Invoke-ScriptAnalyzer" ]]; then
if [[ $VALIDATE_PSSA_CMD != "Invoke-ScriptAnalyzer" ]]; then
# Failed to find module
exit 1
fi
@ -669,7 +658,7 @@ function ValidatePowershellModules()
exit 1
else
# Success
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
echo -e "${NC}${F[B]}Successfully found module ${F[W]}[$VALIDATE_PSSA_MODULE]${F[B]} in system${NC}"
echo -e "${NC}${F[B]}Successfully found command ${F[W]}[$VALIDATE_PSSA_CMD]${F[B]} in system${NC}"
fi
@ -677,8 +666,7 @@ function ValidatePowershellModules()
}
################################################################################
#### Function Footer ###########################################################
Footer()
{
Footer() {
echo ""
echo "----------------------------------------------"
echo "----------------------------------------------"
@ -690,8 +678,7 @@ Footer()
##############################
# Prints for errors if found #
##############################
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"
do
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
###########################
# Build the error counter #
###########################
@ -715,31 +702,31 @@ Footer()
###############################
# Exit with 1 if errors found #
###############################
elif [ "$ERRORS_FOUND_YML" -ne 0 ] || \
[ "$ERRORS_FOUND_JSON" -ne 0 ] || \
[ "$ERRORS_FOUND_XML" -ne 0 ] || \
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] || \
[ "$ERRORS_FOUND_BASH" -ne 0 ] || \
[ "$ERRORS_FOUND_PERL" -ne 0 ] || \
[ "$ERRORS_FOUND_PHP" -ne 0 ] || \
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] || \
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] || \
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] || \
[ "$ERRORS_FOUND_JAVASCRIPT_ES" -ne 0 ] || \
[ "$ERRORS_FOUND_JAVASCRIPT_STANDARD" -ne 0 ] || \
[ "$ERRORS_FOUND_TYPESCRIPT_ES" -ne 0 ] || \
[ "$ERRORS_FOUND_TYPESCRIPT_STANDARD" -ne 0 ] || \
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \
[ "$ERRORS_FOUND_GO" -ne 0 ] || \
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] || \
[ "$ERRORS_FOUND_RUBY" -ne 0 ] || \
[ "$ERRORS_FOUND_CSS" -ne 0 ] || \
[ "$ERRORS_FOUND_CFN" -ne 0 ] || \
[ "$ERRORS_FOUND_ENV" -ne 0 ] || \
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] || \
[ "$ERRORS_FOUND_PROTOBUF" -ne 0 ] || \
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] || \
elif [ "$ERRORS_FOUND_YML" -ne 0 ] ||
[ "$ERRORS_FOUND_JSON" -ne 0 ] ||
[ "$ERRORS_FOUND_XML" -ne 0 ] ||
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] ||
[ "$ERRORS_FOUND_BASH" -ne 0 ] ||
[ "$ERRORS_FOUND_PERL" -ne 0 ] ||
[ "$ERRORS_FOUND_PHP" -ne 0 ] ||
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] ||
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] ||
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] ||
[ "$ERRORS_FOUND_JAVASCRIPT_ES" -ne 0 ] ||
[ "$ERRORS_FOUND_JAVASCRIPT_STANDARD" -ne 0 ] ||
[ "$ERRORS_FOUND_TYPESCRIPT_ES" -ne 0 ] ||
[ "$ERRORS_FOUND_TYPESCRIPT_STANDARD" -ne 0 ] ||
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] ||
[ "$ERRORS_FOUND_GO" -ne 0 ] ||
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] ||
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] ||
[ "$ERRORS_FOUND_RUBY" -ne 0 ] ||
[ "$ERRORS_FOUND_CSS" -ne 0 ] ||
[ "$ERRORS_FOUND_CFN" -ne 0 ] ||
[ "$ERRORS_FOUND_ENV" -ne 0 ] ||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] ||
[ "$ERRORS_FOUND_PROTOBUF" -ne 0 ] ||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] ||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then
# Failed exit
echo -e "${NC}${F[R]}Exiting with errors found!${NC}"
@ -812,7 +799,7 @@ GetLinterRules "CFN"
#################################
# Check if were in verbose mode #
#################################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
##################################
# Get and print all version info #
##################################
@ -822,7 +809,7 @@ fi
###########################################
# Check to see if this is a test case run #
###########################################
if [[ "$TEST_CASE_RUN" != "false" ]]; then
if [[ $TEST_CASE_RUN != "false" ]]; then
###########################
# Run only the test cases #
###########################
@ -1146,8 +1133,7 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then
IFS=$'\n'
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"
do
for FILE in "${LIST_FILES[@]}"; do
if DetectOpenAPIFile "$FILE"; then
FILE_ARRAY_OPENAPI+=("$FILE")
fi

View file

@ -9,8 +9,7 @@
################################################################################
################################################################################
#### Function GetValidationInfo ################################################
function GetValidationInfo()
{
function GetValidationInfo() {
############################################
# Print headers for user provided env vars #
############################################
@ -21,7 +20,7 @@ function GetValidationInfo()
###########################################
# Skip validation if were running locally #
###########################################
if [[ "$RUN_LOCAL" != "true" ]]; then
if [[ $RUN_LOCAL != "true" ]]; then
###############################
# Convert string to lowercase #
###############################
@ -29,7 +28,7 @@ function GetValidationInfo()
######################################
# Validate we should check all files #
######################################
if [[ "$VALIDATE_ALL_CODEBASE" != "false" ]]; then
if [[ $VALIDATE_ALL_CODEBASE != "false" ]]; then
# Set to true
VALIDATE_ALL_CODEBASE="$DEFAULT_VALIDATE_ALL_CODEBASE"
echo "- Validating ALL files in code base..."
@ -77,40 +76,40 @@ function GetValidationInfo()
# Determine if any linters were explicitly set #
################################################
ANY_SET="false"
if [[ -n "$VALIDATE_YAML" || \
-n "$VALIDATE_JSON" || \
-n "$VALIDATE_XML" || \
-n "$VALIDATE_MD" || \
-n "$VALIDATE_BASH" || \
-n "$VALIDATE_PERL" || \
-n "$VALIDATE_PHP" || \
-n "$VALIDATE_PYTHON" || \
-n "$VALIDATE_RUBY" || \
-n "$VALIDATE_COFFEE" || \
-n "$VALIDATE_ANSIBLE" || \
-n "$VALIDATE_JAVASCRIPT_ES" || \
-n "$VALIDATE_JAVASCRIPT_STANDARD" || \
-n "$VALIDATE_TYPESCRIPT_ES" || \
-n "$VALIDATE_TYPESCRIPT_STANDARD" || \
-n "$VALIDATE_DOCKER" || \
-n "$VALIDATE_GO" || \
-n "$VALIDATE_TERRAFORM" || \
-n "$VALIDATE_POWERSHELL" || \
-n "$VALIDATE_CSS" || \
-n "$VALIDATE_ENV" || \
-n "$VALIDATE_CLOJURE" || \
-n "$VALIDATE_PROTOBUF" || \
-n "$VALIDATE_OPENAPI" || \
-n "$VALIDATE_KOTLIN" ]]; then
if [[ -n $VALIDATE_YAML || -n \
$VALIDATE_JSON || -n \
$VALIDATE_XML || -n \
$VALIDATE_MD || -n \
$VALIDATE_BASH || -n \
$VALIDATE_PERL || -n \
$VALIDATE_PHP || -n \
$VALIDATE_PYTHON || -n \
$VALIDATE_RUBY || -n \
$VALIDATE_COFFEE || -n \
$VALIDATE_ANSIBLE || -n \
$VALIDATE_JAVASCRIPT_ES || -n \
$VALIDATE_JAVASCRIPT_STANDARD || -n \
$VALIDATE_TYPESCRIPT_ES || -n \
$VALIDATE_TYPESCRIPT_STANDARD || -n \
$VALIDATE_DOCKER || -n \
$VALIDATE_GO || -n \
$VALIDATE_TERRAFORM || -n \
$VALIDATE_POWERSHELL || -n \
$VALIDATE_CSS || -n \
$VALIDATE_ENV || -n \
$VALIDATE_CLOJURE || -n \
$VALIDATE_PROTOBUF || -n \
$VALIDATE_OPENAPI || -n \
$VALIDATE_KOTLIN ]]; then
ANY_SET="true"
fi
####################################
# Validate if we should check YAML #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_YAML" ]]; then
if [[ -z $VALIDATE_YAML ]]; then
# YAML flag was not set - default to false
VALIDATE_YAML="false"
fi
@ -122,9 +121,9 @@ function GetValidationInfo()
####################################
# Validate if we should check JSON #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_JSON" ]]; then
if [[ -z $VALIDATE_JSON ]]; then
# JSON flag was not set - default to false
VALIDATE_JSON="false"
fi
@ -136,9 +135,9 @@ function GetValidationInfo()
###################################
# Validate if we should check XML #
###################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_XML" ]]; then
if [[ -z $VALIDATE_XML ]]; then
# XML flag was not set - default to false
VALIDATE_XML="false"
fi
@ -150,9 +149,9 @@ function GetValidationInfo()
########################################
# Validate if we should check MARKDOWN #
########################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_MD" ]]; then
if [[ -z $VALIDATE_MD ]]; then
# MD flag was not set - default to false
VALIDATE_MD="false"
fi
@ -164,9 +163,9 @@ function GetValidationInfo()
####################################
# Validate if we should check BASH #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_BASH" ]]; then
if [[ -z $VALIDATE_BASH ]]; then
# BASH flag was not set - default to false
VALIDATE_BASH="false"
fi
@ -178,9 +177,9 @@ function GetValidationInfo()
####################################
# Validate if we should check PERL #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_PERL" ]]; then
if [[ -z $VALIDATE_PERL ]]; then
# PERL flag was not set - default to false
VALIDATE_PERL="false"
fi
@ -192,9 +191,9 @@ function GetValidationInfo()
####################################
# Validate if we should check PHP #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_PHP" ]]; then
if [[ -z $VALIDATE_PHP ]]; then
# PHP flag was not set - default to false
VALIDATE_PHP="false"
fi
@ -206,9 +205,9 @@ function GetValidationInfo()
######################################
# Validate if we should check PYTHON #
######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_PYTHON" ]]; then
if [[ -z $VALIDATE_PYTHON ]]; then
# PYTHON flag was not set - default to false
VALIDATE_PYTHON="false"
fi
@ -220,9 +219,9 @@ function GetValidationInfo()
####################################
# Validate if we should check RUBY #
####################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_RUBY" ]]; then
if [[ -z $VALIDATE_RUBY ]]; then
# RUBY flag was not set - default to false
VALIDATE_RUBY="false"
fi
@ -234,9 +233,9 @@ function GetValidationInfo()
######################################
# Validate if we should check COFFEE #
######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_COFFEE" ]]; then
if [[ -z $VALIDATE_COFFEE ]]; then
# COFFEE flag was not set - default to false
VALIDATE_COFFEE="false"
fi
@ -248,9 +247,9 @@ function GetValidationInfo()
#######################################
# Validate if we should check ANSIBLE #
#######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_ANSIBLE" ]]; then
if [[ -z $VALIDATE_ANSIBLE ]]; then
# ANSIBLE flag was not set - default to false
VALIDATE_ANSIBLE="false"
fi
@ -262,9 +261,9 @@ function GetValidationInfo()
#############################################
# Validate if we should check JAVASCRIPT_ES #
#############################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_JAVASCRIPT_ES" ]]; then
if [[ -z $VALIDATE_JAVASCRIPT_ES ]]; then
# JAVASCRIPT_ES flag was not set - default to false
VALIDATE_JAVASCRIPT_ES="false"
fi
@ -276,9 +275,9 @@ function GetValidationInfo()
###################################################
# Validate if we should check JAVASCRIPT_STANDARD #
###################################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_JAVASCRIPT_STANDARD" ]]; then
if [[ -z $VALIDATE_JAVASCRIPT_STANDARD ]]; then
# JAVASCRIPT_STANDARD flag was not set - default to false
VALIDATE_JAVASCRIPT_STANDARD="false"
fi
@ -290,9 +289,9 @@ function GetValidationInfo()
#############################################
# Validate if we should check TYPESCRIPT_ES #
#############################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_TYPESCRIPT_ES" ]]; then
if [[ -z $VALIDATE_TYPESCRIPT_ES ]]; then
# TYPESCRIPT_ES flag was not set - default to false
VALIDATE_TYPESCRIPT_ES="false"
fi
@ -304,9 +303,9 @@ function GetValidationInfo()
###################################################
# Validate if we should check TYPESCRIPT_STANDARD #
###################################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_TYPESCRIPT_STANDARD" ]]; then
if [[ -z $VALIDATE_TYPESCRIPT_STANDARD ]]; then
# TYPESCRIPT_STANDARD flag was not set - default to false
VALIDATE_TYPESCRIPT_STANDARD="false"
fi
@ -318,9 +317,9 @@ function GetValidationInfo()
######################################
# Validate if we should check DOCKER #
######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_DOCKER" ]]; then
if [[ -z $VALIDATE_DOCKER ]]; then
# DOCKER flag was not set - default to false
VALIDATE_DOCKER="false"
fi
@ -332,9 +331,9 @@ function GetValidationInfo()
##################################
# Validate if we should check GO #
##################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_GO" ]]; then
if [[ -z $VALIDATE_GO ]]; then
# GO flag was not set - default to false
VALIDATE_GO="false"
fi
@ -346,9 +345,9 @@ function GetValidationInfo()
#########################################
# Validate if we should check TERRAFORM #
#########################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_TERRAFORM" ]]; then
if [[ -z $VALIDATE_TERRAFORM ]]; then
# TERRAFORM flag was not set - default to false
VALIDATE_TERRAFORM="false"
fi
@ -360,9 +359,9 @@ function GetValidationInfo()
#########################################
# Validate if we should check POWERSHELL #
#########################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_POWERSHELL" ]]; then
if [[ -z $VALIDATE_POWERSHELL ]]; then
# POWERSHELL flag was not set - default to false
VALIDATE_POWERSHELL="false"
fi
@ -374,9 +373,9 @@ function GetValidationInfo()
###################################
# Validate if we should check CSS #
###################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_CSS" ]]; then
if [[ -z $VALIDATE_CSS ]]; then
# CSS flag was not set - default to false
VALIDATE_CSS="false"
fi
@ -388,9 +387,9 @@ function GetValidationInfo()
###################################
# Validate if we should check ENV #
###################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_ENV" ]]; then
if [[ -z $VALIDATE_ENV ]]; then
# ENV flag was not set - default to false
VALIDATE_ENV="false"
fi
@ -402,9 +401,9 @@ function GetValidationInfo()
######################################
# Validate if we should check KOTLIN #
######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_KOTLIN" ]]; then
if [[ -z $VALIDATE_KOTLIN ]]; then
# ENV flag was not set - default to false
VALIDATE_KOTLIN="false"
fi
@ -416,9 +415,9 @@ function GetValidationInfo()
#######################################
# Validate if we should check OPENAPI #
#######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_OPENAPI" ]]; then
if [[ -z $VALIDATE_OPENAPI ]]; then
# OPENAPI flag was not set - default to false
VALIDATE_OPENAPI="false"
fi
@ -430,9 +429,9 @@ function GetValidationInfo()
#######################################
# Validate if we should check PROTOBUF #
#######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_PROTOBUF" ]]; then
if [[ -z $VALIDATE_PROTOBUF ]]; then
# PROTOBUF flag was not set - default to false
VALIDATE_PROTOBUF="false"
fi
@ -444,9 +443,9 @@ function GetValidationInfo()
#######################################
# Validate if we should check Clojure #
#######################################
if [[ "$ANY_SET" == "true" ]]; then
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_CLOJURE" ]]; then
if [[ -z $VALIDATE_CLOJURE ]]; then
# Clojure flag was not set - default to false
VALIDATE_CLOJURE="false"
fi
@ -458,127 +457,127 @@ function GetValidationInfo()
#######################################
# Print which linters we are enabling #
#######################################
if [[ "$VALIDATE_YAML" == "true" ]]; then
if [[ $VALIDATE_YAML == "true" ]]; then
PRINT_ARRAY+=("- Validating [YAML] files in code base...")
else
PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
fi
if [[ "$VALIDATE_JSON" == "true" ]]; then
if [[ $VALIDATE_JSON == "true" ]]; then
PRINT_ARRAY+=("- Validating [JSON] files in code base...")
else
PRINT_ARRAY+=("- Excluding [JSON] files in code base...")
fi
if [[ "$VALIDATE_XML" == "true" ]]; then
if [[ $VALIDATE_XML == "true" ]]; then
PRINT_ARRAY+=("- Validating [XML] files in code base...")
else
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
fi
if [[ "$VALIDATE_MD" == "true" ]]; then
if [[ $VALIDATE_MD == "true" ]]; then
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
else
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
fi
if [[ "$VALIDATE_BASH" == "true" ]]; then
if [[ $VALIDATE_BASH == "true" ]]; then
PRINT_ARRAY+=("- Validating [BASH] files in code base...")
else
PRINT_ARRAY+=("- Excluding [BASH] files in code base...")
fi
if [[ "$VALIDATE_PERL" == "true" ]]; then
if [[ $VALIDATE_PERL == "true" ]]; then
PRINT_ARRAY+=("- Validating [PERL] files in code base...")
else
PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
fi
if [[ "$VALIDATE_PHP" == "true" ]]; then
if [[ $VALIDATE_PHP == "true" ]]; then
PRINT_ARRAY+=("- Validating [PHP] files in code base...")
else
PRINT_ARRAY+=("- Excluding [PHP] files in code base...")
fi
if [[ "$VALIDATE_PYTHON" == "true" ]]; then
if [[ $VALIDATE_PYTHON == "true" ]]; then
PRINT_ARRAY+=("- Validating [PYTHON] files in code base...")
else
PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...")
fi
if [[ "$VALIDATE_RUBY" == "true" ]]; then
if [[ $VALIDATE_RUBY == "true" ]]; then
PRINT_ARRAY+=("- Validating [RUBY] files in code base...")
else
PRINT_ARRAY+=("- Excluding [RUBY] files in code base...")
fi
if [[ "$VALIDATE_COFFEE" == "true" ]]; then
if [[ $VALIDATE_COFFEE == "true" ]]; then
PRINT_ARRAY+=("- Validating [COFFEE] files in code base...")
else
PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...")
fi
if [[ "$VALIDATE_ANSIBLE" == "true" ]]; then
if [[ $VALIDATE_ANSIBLE == "true" ]]; then
PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...")
else
PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...")
fi
if [[ "$VALIDATE_JAVASCRIPT_ES" == "true" ]]; then
if [[ $VALIDATE_JAVASCRIPT_ES == "true" ]]; then
PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...")
else
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...")
fi
if [[ "$VALIDATE_JAVASCRIPT_STANDARD" == "true" ]]; then
if [[ $VALIDATE_JAVASCRIPT_STANDARD == "true" ]]; then
PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...")
else
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...")
fi
if [[ "$VALIDATE_TYPESCRIPT_ES" == "true" ]]; then
if [[ $VALIDATE_TYPESCRIPT_ES == "true" ]]; then
PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...")
else
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...")
fi
if [[ "$VALIDATE_TYPESCRIPT_STANDARD" == "true" ]]; then
if [[ $VALIDATE_TYPESCRIPT_STANDARD == "true" ]]; then
PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...")
else
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...")
fi
if [[ "$VALIDATE_DOCKER" == "true" ]]; then
if [[ $VALIDATE_DOCKER == "true" ]]; then
PRINT_ARRAY+=("- Validating [DOCKER] files in code base...")
else
PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...")
fi
if [[ "$VALIDATE_GO" == "true" ]]; then
if [[ $VALIDATE_GO == "true" ]]; then
PRINT_ARRAY+=("- Validating [GOLANG] files in code base...")
else
PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...")
fi
if [[ "$VALIDATE_TERRAFORM" == "true" ]]; then
if [[ $VALIDATE_TERRAFORM == "true" ]]; then
PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...")
else
PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...")
fi
if [[ "$VALIDATE_POWERSHELL" == "true" ]]; then
if [[ $VALIDATE_POWERSHELL == "true" ]]; then
PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...")
else
PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...")
fi
if [[ "$VALIDATE_CSS" == "true" ]]; then
if [[ $VALIDATE_CSS == "true" ]]; then
PRINT_ARRAY+=("- Validating [CSS] files in code base...")
else
PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
fi
if [[ "$VALIDATE_CLOJURE" == "true" ]]; then
if [[ $VALIDATE_CLOJURE == "true" ]]; then
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
else
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
fi
if [[ "$VALIDATE_ENV" == "true" ]]; then
if [[ $VALIDATE_ENV == "true" ]]; then
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
else
PRINT_ARRAY+=("- Excluding [ENV] files in code base...")
fi
if [[ "$VALIDATE_KOTLIN" == "true" ]]; then
if [[ $VALIDATE_KOTLIN == "true" ]]; then
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
else
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
fi
if [[ "$VALIDATE_OPENAPI" == "true" ]]; then
if [[ $VALIDATE_OPENAPI == "true" ]]; then
PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...")
else
PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...")
fi
if [[ "$VALIDATE_PROTOBUF" == "true" ]]; then
if [[ $VALIDATE_PROTOBUF == "true" ]]; then
PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...")
else
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
@ -649,12 +648,11 @@ function GetValidationInfo()
###################
# Debug on runner #
###################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
###########################
# Print the validate info #
###########################
for LINE in "${PRINT_ARRAY[@]}"
do
for LINE in "${PRINT_ARRAY[@]}"; do
echo "$LINE"
done

View file

@ -9,8 +9,7 @@
################################################################################
################################################################################
#### Function LintCodebase #####################################################
function LintCodebase()
{
function LintCodebase() {
####################
# Pull in the vars #
####################
@ -55,7 +54,7 @@ function LintCodebase()
exit 1
else
# Success
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
echo -e "${NC}${F[B]}Successfully found binary for ${F[W]}[$LINTER_NAME]${F[B]} in system${NC}"
echo "Location:[$VALIDATE_INSTALL_CMD]"
fi
@ -119,8 +118,7 @@ function LintCodebase()
######################
# Print Header array #
######################
for LINE in "${PRINT_ARRAY[@]}"
do
for LINE in "${PRINT_ARRAY[@]}"; do
#########################
# Print the header info #
#########################
@ -130,8 +128,7 @@ function LintCodebase()
##################
# Lint the files #
##################
for FILE in "${LIST_FILES[@]}"
do
for FILE in "${LIST_FILES[@]}"; do
#####################
# Get the file name #
#####################
@ -162,17 +159,24 @@ function LintCodebase()
#######################################
# Corner case for Powershell subshell #
#######################################
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
if [[ $FILE_TYPE == "POWERSHELL" ]]; then
################################
# Lint the file with the rules #
################################
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; pwsh -c "($LINTER_COMMAND $FILE)"; exit $? 2>&1)
LINT_CMD=$(
cd "$GITHUB_WORKSPACE" || exit
pwsh -c "($LINTER_COMMAND $FILE)"
exit $? 2>&1
)
else
################################
# Lint the file with the rules #
################################
LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE" 2>&1)
LINT_CMD=$(
cd "$GITHUB_WORKSPACE" || exit
$LINTER_COMMAND "$FILE" 2>&1
)
fi
#######################
@ -202,8 +206,7 @@ function LintCodebase()
}
################################################################################
#### Function TestCodebase #####################################################
function TestCodebase()
{
function TestCodebase() {
####################
# Pull in the vars #
####################
@ -262,8 +265,7 @@ function TestCodebase()
##################
# Lint the files #
##################
for FILE in "${LIST_FILES[@]}"
do
for FILE in "${LIST_FILES[@]}"; do
#####################
# Get the file name #
#####################
@ -278,7 +280,7 @@ function TestCodebase()
#########################################################
# If not found, assume it should be linted successfully #
#########################################################
if [ -z "$FILE_STATUS" ] || [[ "$FILE" == *"README"* ]]; then
if [ -z "$FILE_STATUS" ] || [[ $FILE == *"README"* ]]; then
##################################
# Set to good for proper linting #
##################################
@ -299,8 +301,8 @@ function TestCodebase()
#######################################
# Check if docker and get folder name #
#######################################
if [[ "$FILE_TYPE" == "DOCKER" ]]; then
if [[ "$FILE" == *"good"* ]]; then
if [[ $FILE_TYPE == "DOCKER" ]]; then
if [[ $FILE == *"good"* ]]; then
#############
# Good file #
#############
@ -316,7 +318,7 @@ function TestCodebase()
#####################
# Check for ansible #
#####################
if [[ "$FILE_TYPE" == "ANSIBLE" ]]; then
if [[ $FILE_TYPE == "ANSIBLE" ]]; then
########################################
# Make sure we dont lint certain files #
########################################
@ -328,18 +330,28 @@ function TestCodebase()
################################
# Lint the file with the rules #
################################
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" || exit; $LINTER_COMMAND "$FILE" 2>&1)
elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" || exit
$LINTER_COMMAND "$FILE" 2>&1
)
elif [[ $FILE_TYPE == "POWERSHELL" ]]; then
################################
# Lint the file with the rules #
################################
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; pwsh -c "($LINTER_COMMAND $FILE)"; exit $? 2>&1)
LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit
pwsh -c "($LINTER_COMMAND $FILE)"
exit $? 2>&1
)
else
################################
# Lint the file with the rules #
################################
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; $LINTER_COMMAND "$FILE" 2>&1)
LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit
$LINTER_COMMAND "$FILE" 2>&1
)
fi
#######################
@ -350,7 +362,7 @@ function TestCodebase()
########################################
# Check for if it was supposed to pass #
########################################
if [[ "$FILE_STATUS" == "good" ]]; then
if [[ $FILE_STATUS == "good" ]]; then
##############################
# Check the shell for errors #
##############################
@ -417,8 +429,7 @@ function TestCodebase()
}
################################################################################
#### Function RunTestCases #####################################################
function RunTestCases()
{
function RunTestCases() {
# This loop will run the test cases and exclude user code
# This is called from the automation process to validate new code
# When a PR is opened, the new code is validated with the default branch
@ -476,8 +487,7 @@ function RunTestCases()
}
################################################################################
#### Function LintAnsibleFiles #################################################
function LintAnsibleFiles()
{
function LintAnsibleFiles() {
######################
# Create Print Array #
######################
@ -518,7 +528,7 @@ function LintAnsibleFiles()
exit 1
else
# Success
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
# Success
echo -e "${NC}${F[B]}Successfully found binary in system${NC}"
echo "Location:[$VALIDATE_INSTALL_CMD]"
@ -568,8 +578,7 @@ function LintAnsibleFiles()
# Check if we have data to look at #
####################################
if [ $SKIP_FLAG -eq 0 ]; then
for LINE in "${PRINT_ARRAY[@]}"
do
for LINE in "${PRINT_ARRAY[@]}"; do
#########################
# Print the header line #
#########################
@ -580,8 +589,7 @@ function LintAnsibleFiles()
##################
# Lint the files #
##################
for FILE in "${LIST_FILES[@]}"
do
for FILE in "${LIST_FILES[@]}"; do
########################################
# Make sure we dont lint certain files #
@ -634,7 +642,7 @@ function LintAnsibleFiles()
###############################
# Check to see if debug is on #
###############################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
########################
# No Ansible dir found #
########################