mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-09 18:43:34 -05:00
commit
bd83a8a7cb
8 changed files with 426 additions and 445 deletions
|
@ -16,20 +16,19 @@
|
||||||
###########
|
###########
|
||||||
# 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
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
############################ FUNCTIONS BELOW ###################################
|
############################ FUNCTIONS BELOW ###################################
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Header ###########################################################
|
#### Function Header ###########################################################
|
||||||
Header()
|
Header() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "-------------------------------------------------------"
|
echo "-------------------------------------------------------"
|
||||||
echo "----- GitHub Actions remove image from DockerHub ------"
|
echo "----- GitHub Actions remove image from DockerHub ------"
|
||||||
|
@ -38,8 +37,7 @@ Header()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function ValidateInput ####################################################
|
#### Function ValidateInput ####################################################
|
||||||
ValidateInput()
|
ValidateInput() {
|
||||||
{
|
|
||||||
# Need to validate we have the basic variables
|
# Need to validate we have the basic variables
|
||||||
################
|
################
|
||||||
# Print header #
|
# 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} Failed to get [IMAGE_REPO]!${NC}"
|
||||||
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}"
|
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ "$IMAGE_REPO" == "github/super-linter" ]]; then
|
elif [[ $IMAGE_REPO == "github/super-linter" ]]; then
|
||||||
# Found our main repo
|
# Found our main repo
|
||||||
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]"
|
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]"
|
||||||
else
|
else
|
||||||
|
@ -114,7 +112,7 @@ ValidateInput()
|
||||||
##################################################
|
##################################################
|
||||||
# Check if we need to get the name of the branch #
|
# 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 #
|
# Remove non alpha-numeric chars #
|
||||||
##################################
|
##################################
|
||||||
|
@ -131,8 +129,7 @@ ValidateInput()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function LoginToDocker ####################################################
|
#### Function LoginToDocker ####################################################
|
||||||
LoginToDocker()
|
LoginToDocker() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
################
|
################
|
||||||
|
@ -167,8 +164,7 @@ LoginToDocker()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function RemoveImage ######################################################
|
#### Function RemoveImage ######################################################
|
||||||
RemoveImage()
|
RemoveImage() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
################
|
################
|
||||||
|
@ -187,23 +183,23 @@ RemoveImage()
|
||||||
-d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" \
|
-d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" \
|
||||||
"https://hub.docker.com/v2/users/login/" | jq -r .token 2>&1)
|
"https://hub.docker.com/v2/users/login/" | jq -r .token 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the ERROR_CODE #
|
# Load the ERROR_CODE #
|
||||||
#######################
|
#######################
|
||||||
ERROR_CODE=$?
|
ERROR_CODE=$?
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Check the shell for errors #
|
# Check the shell for errors #
|
||||||
##############################
|
##############################
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
# ERROR
|
# ERROR
|
||||||
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!${NC}"
|
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!${NC}"
|
||||||
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$TOKEN]${NC}"
|
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$TOKEN]${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# SUCCESS
|
# SUCCESS
|
||||||
echo "Successfully gained auth token from DockerHub!"
|
echo "Successfully gained auth token from DockerHub!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Remove the tag from DockerHub #
|
# Remove the tag from DockerHub #
|
||||||
|
@ -232,8 +228,7 @@ RemoveImage()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Footer ###########################################################
|
||||||
Footer()
|
Footer() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "-------------------------------------------------------"
|
echo "-------------------------------------------------------"
|
||||||
echo "The step has completed"
|
echo "The step has completed"
|
||||||
|
|
|
@ -17,25 +17,24 @@
|
||||||
###########
|
###########
|
||||||
# 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
|
||||||
GPR_USERNAME="${GPR_USERNAME}" # Username to login to GitHub package registry
|
GPR_USERNAME="${GPR_USERNAME}" # Username to login to GitHub package registry
|
||||||
GPR_TOKEN="${GPR_TOKEN}" # Password to login to GitHub package registry
|
GPR_TOKEN="${GPR_TOKEN}" # Password to login to GitHub package registry
|
||||||
REGISTRY="${REGISTRY}" # What registry to upload | <GPR> or <Docker>
|
REGISTRY="${REGISTRY}" # What registry to upload | <GPR> 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
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
############################ FUNCTIONS BELOW ###################################
|
############################ FUNCTIONS BELOW ###################################
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Header ###########################################################
|
#### Function Header ###########################################################
|
||||||
Header()
|
Header() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "-------------------------------------------------------"
|
echo "-------------------------------------------------------"
|
||||||
echo "---- GitHub Actions Upload image to [$REGISTRY] ----"
|
echo "---- GitHub Actions Upload image to [$REGISTRY] ----"
|
||||||
|
@ -44,8 +43,7 @@ Header()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function ValidateInput ####################################################
|
#### Function ValidateInput ####################################################
|
||||||
ValidateInput()
|
ValidateInput() {
|
||||||
{
|
|
||||||
# Need to validate we have the basic variables
|
# Need to validate we have the basic variables
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
|
@ -81,7 +79,7 @@ ValidateInput()
|
||||||
#####################################################
|
#####################################################
|
||||||
# See if we need values for GitHub package Registry #
|
# See if we need values for GitHub package Registry #
|
||||||
#####################################################
|
#####################################################
|
||||||
if [[ "$REGISTRY" == "GPR" ]]; then
|
if [[ $REGISTRY == "GPR" ]]; then
|
||||||
#########################
|
#########################
|
||||||
# Validate GPR_USERNAME #
|
# Validate GPR_USERNAME #
|
||||||
#########################
|
#########################
|
||||||
|
@ -106,7 +104,7 @@ ValidateInput()
|
||||||
########################################
|
########################################
|
||||||
# See if we need values for Ducker hub #
|
# See if we need values for Ducker hub #
|
||||||
########################################
|
########################################
|
||||||
elif [[ "$REGISTRY" == "Docker" ]]; then
|
elif [[ $REGISTRY == "Docker" ]]; then
|
||||||
############################
|
############################
|
||||||
# Validate DOCKER_USERNAME #
|
# Validate DOCKER_USERNAME #
|
||||||
############################
|
############################
|
||||||
|
@ -137,7 +135,6 @@ ValidateInput()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Validate IMAGE_REPO #
|
# Validate IMAGE_REPO #
|
||||||
#######################
|
#######################
|
||||||
|
@ -150,7 +147,7 @@ ValidateInput()
|
||||||
###############################################
|
###############################################
|
||||||
# Need to see if GPR registry and update name #
|
# 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"
|
NAME="docker.pkg.github.com/$IMAGE_REPO/super-linter"
|
||||||
IMAGE_REPO="$NAME"
|
IMAGE_REPO="$NAME"
|
||||||
echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR"
|
echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR"
|
||||||
|
@ -166,7 +163,7 @@ ValidateInput()
|
||||||
##############################
|
##############################
|
||||||
# Get the name of the branch #
|
# Get the name of the branch #
|
||||||
##############################
|
##############################
|
||||||
BRANCH_NAME=$(git -C "$GITHUB_WORKSPACE" branch --contains "$GITHUB_SHA" |awk '{print $2}' 2>&1)
|
BRANCH_NAME=$(git -C "$GITHUB_WORKSPACE" branch --contains "$GITHUB_SHA" | awk '{print $2}' 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -204,7 +201,7 @@ ValidateInput()
|
||||||
######################################################################
|
######################################################################
|
||||||
# Check if this is a latest to a versioned release at create new tag #
|
# 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
|
# Need to get the major version, and set flag to update
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
|
@ -233,15 +230,14 @@ ValidateInput()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Authenticate #####################################################
|
#### Function Authenticate #####################################################
|
||||||
Authenticate()
|
Authenticate() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Pull in Vars #
|
# Pull in Vars #
|
||||||
################
|
################
|
||||||
USERNAME="$1" # Name to auth with
|
USERNAME="$1" # Name to auth with
|
||||||
PASSWORD="$2" # Password to auth with
|
PASSWORD="$2" # Password to auth with
|
||||||
URL="$3" # Url to auth towards
|
URL="$3" # Url to auth towards
|
||||||
NAME="$4" # name of the service
|
NAME="$4" # name of the service
|
||||||
|
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
|
@ -277,8 +273,7 @@ Authenticate()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function BuildImage #######################################################
|
#### Function BuildImage #######################################################
|
||||||
BuildImage()
|
BuildImage() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
################
|
################
|
||||||
|
@ -348,8 +343,7 @@ BuildImage()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function UploadImage ######################################################
|
#### Function UploadImage ######################################################
|
||||||
UploadImage()
|
UploadImage() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Print header #
|
# Print header #
|
||||||
################
|
################
|
||||||
|
@ -450,8 +444,7 @@ UploadImage()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Footer ###########################################################
|
||||||
Footer()
|
Footer() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "-------------------------------------------------------"
|
echo "-------------------------------------------------------"
|
||||||
echo "The step has completed"
|
echo "The step has completed"
|
||||||
|
@ -480,14 +473,14 @@ BuildImage
|
||||||
######################
|
######################
|
||||||
# Login to DockerHub #
|
# Login to DockerHub #
|
||||||
######################
|
######################
|
||||||
if [[ "$REGISTRY" == "Docker" ]]; then
|
if [[ $REGISTRY == "Docker" ]]; then
|
||||||
# Authenticate "Username" "Password" "Url" "Name"
|
# Authenticate "Username" "Password" "Url" "Name"
|
||||||
Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub"
|
Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub"
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Login to GitHub Package Registry #
|
# Login to GitHub Package Registry #
|
||||||
####################################
|
####################################
|
||||||
elif [[ "$REGISTRY" == "GPR" ]]; then
|
elif [[ $REGISTRY == "GPR" ]]; then
|
||||||
# Authenticate "Username" "Password" "Url" "Name"
|
# Authenticate "Username" "Password" "Url" "Name"
|
||||||
Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry"
|
Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry"
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,14 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function BuildFileList ####################################################
|
#### Function BuildFileList ####################################################
|
||||||
function BuildFileList()
|
function BuildFileList() {
|
||||||
{
|
|
||||||
# Need to build a list of all files changed
|
# Need to build a list of all files changed
|
||||||
# This can be pulled from the GITHUB_EVENT_PATH payload
|
# This can be pulled from the GITHUB_EVENT_PATH payload
|
||||||
|
|
||||||
################
|
################
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Pulling in code history and branches..."
|
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 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 #
|
# Load the error code #
|
||||||
|
@ -46,7 +48,7 @@ function BuildFileList()
|
||||||
################
|
################
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]"
|
echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]"
|
||||||
|
@ -78,8 +80,7 @@ function BuildFileList()
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Files that have been modified in the commit(s):"
|
echo "Files that have been modified in the commit(s):"
|
||||||
for FILE in "${RAW_FILE_ARRAY[@]}"
|
for FILE in "${RAW_FILE_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
##############
|
##############
|
||||||
# Print file #
|
# Print file #
|
||||||
##############
|
##############
|
||||||
|
@ -371,7 +372,7 @@ function BuildFileList()
|
||||||
#################
|
#################
|
||||||
# Check if bash #
|
# 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 #
|
# It is a bash script #
|
||||||
#######################
|
#######################
|
||||||
|
@ -385,7 +386,7 @@ function BuildFileList()
|
||||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||||
##########################################################
|
##########################################################
|
||||||
READ_ONLY_CHANGE_FLAG=1
|
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 #
|
# It is a Ruby script #
|
||||||
#######################
|
#######################
|
||||||
|
@ -412,7 +413,7 @@ function BuildFileList()
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ${READ_ONLY_CHANGE_FLAG} > /dev/null 2>&1 || true # Workaround SC2034
|
echo ${READ_ONLY_CHANGE_FLAG} > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
# Need to switch back to branch of code #
|
# Need to switch back to branch of code #
|
||||||
|
|
390
lib/linter.sh
390
lib/linter.sh
|
@ -10,35 +10,35 @@
|
||||||
# Source Function Files #
|
# Source Function Files #
|
||||||
#########################
|
#########################
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/termColors.sh # Source the function script(s)
|
source /action/lib/termColors.sh # Source the function script(s)
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/buildFileList.sh # Source the function script(s)
|
source /action/lib/buildFileList.sh # Source the function script(s)
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/validation.sh # Source the function script(s)
|
source /action/lib/validation.sh # Source the function script(s)
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source /action/lib/worker.sh # Source the function script(s)
|
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
|
||||||
# YAML Vars
|
# YAML Vars
|
||||||
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file
|
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file
|
||||||
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
|
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
|
||||||
# MD Vars
|
# MD Vars
|
||||||
MD_FILE_NAME='.markdown-lint.yml' # Name of the file
|
MD_FILE_NAME='.markdown-lint.yml' # Name of the file
|
||||||
MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to the markdown lint rules
|
MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to the markdown lint rules
|
||||||
# Python Vars
|
# Python Vars
|
||||||
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
||||||
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
||||||
# Cloudformation Vars
|
# Cloudformation Vars
|
||||||
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||||
CFN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CFN_FILE_NAME" # Path to the python lint rules
|
CFN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CFN_FILE_NAME" # Path to the python lint rules
|
||||||
# Ruby Vars
|
# Ruby Vars
|
||||||
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
||||||
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
||||||
# Coffee Vars
|
# Coffee Vars
|
||||||
COFFEESCRIPT_FILE_NAME='.coffee-lint.json' # Name of the file
|
COFFEESCRIPT_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEESCRIPT_FILE_NAME" # Path to the coffeescript lint rules
|
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEESCRIPT_FILE_NAME" # Path to the coffeescript lint rules
|
||||||
|
@ -51,29 +51,29 @@ TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name o
|
||||||
TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules
|
TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules
|
||||||
TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||||
# Ansible Vars
|
# Ansible Vars
|
||||||
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
|
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
|
||||||
ANSIBLE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$ANSIBLE_FILE_NAME" # Path to the Ansible lint rules
|
ANSIBLE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$ANSIBLE_FILE_NAME" # Path to the Ansible lint rules
|
||||||
# Docker Vars
|
# Docker Vars
|
||||||
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
|
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
|
||||||
DOCKER_LINTER_RULES="$DEFAULT_RULES_LOCATION/$DOCKER_FILE_NAME" # Path to the Docker lint rules
|
DOCKER_LINTER_RULES="$DEFAULT_RULES_LOCATION/$DOCKER_FILE_NAME" # Path to the Docker lint rules
|
||||||
# Golang Vars
|
# Golang Vars
|
||||||
GO_FILE_NAME='.golangci.yml' # Name of the file
|
GO_FILE_NAME='.golangci.yml' # Name of the file
|
||||||
GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to the Go lint rules
|
GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to the Go lint rules
|
||||||
# Terraform Vars
|
# Terraform Vars
|
||||||
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
|
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
|
||||||
TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules
|
TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules
|
||||||
# Powershell Vars
|
# Powershell Vars
|
||||||
POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file
|
POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file
|
||||||
POWERSHELL_LINTER_RULES="$DEFAULT_RULES_LOCATION/$POWERSHELL_FILE_NAME" # Path to the Powershell lint rules
|
POWERSHELL_LINTER_RULES="$DEFAULT_RULES_LOCATION/$POWERSHELL_FILE_NAME" # Path to the Powershell lint rules
|
||||||
# CSS Vars
|
# CSS Vars
|
||||||
CSS_FILE_NAME='.stylelintrc.json' # Name of the file
|
CSS_FILE_NAME='.stylelintrc.json' # Name of the file
|
||||||
CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules
|
CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules
|
||||||
# OpenAPI Vars
|
# OpenAPI Vars
|
||||||
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
||||||
OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI lint rules
|
OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI lint rules
|
||||||
# Protocol Buffers Vars
|
# Protocol Buffers Vars
|
||||||
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
|
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
|
||||||
PROTOBUF_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PROTOBUF_FILE_NAME" # Path to the Protocol Buffers lint rules
|
PROTOBUF_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PROTOBUF_FILE_NAME" # Path to the Protocol Buffers lint rules
|
||||||
# Clojure Vars
|
# Clojure Vars
|
||||||
CLOJURE_FILE_NAME='.clj-kondo/config.edn'
|
CLOJURE_FILE_NAME='.clj-kondo/config.edn'
|
||||||
CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME"
|
CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME"
|
||||||
|
@ -98,135 +98,134 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'PHP' 'RUBY' 'PYTHON
|
||||||
###################
|
###################
|
||||||
# GitHub ENV Vars #
|
# GitHub ENV Vars #
|
||||||
###################
|
###################
|
||||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||||
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)
|
||||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||||
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
||||||
VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
||||||
VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language
|
VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language
|
||||||
VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language
|
VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language
|
||||||
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
||||||
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
|
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
|
||||||
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
|
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
|
||||||
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
|
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
|
||||||
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
||||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||||
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
||||||
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
||||||
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language
|
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language
|
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language
|
||||||
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language
|
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
|
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
|
||||||
VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language
|
VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language
|
||||||
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
|
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
|
||||||
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
||||||
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
|
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
|
||||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
||||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||||
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
|
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
|
||||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||||
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
||||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||||
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
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Debug Vars #
|
# Debug Vars #
|
||||||
##############
|
##############
|
||||||
RUN_LOCAL="${RUN_LOCAL}" # Boolean to see if we are running locally
|
RUN_LOCAL="${RUN_LOCAL}" # Boolean to see if we are running locally
|
||||||
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-false}" # Boolean to see even more info (debug)
|
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-false}" # Boolean to see even more info (debug)
|
||||||
|
|
||||||
################
|
################
|
||||||
# Default Vars #
|
# Default Vars #
|
||||||
################
|
################
|
||||||
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
|
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
|
||||||
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
|
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
|
||||||
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
|
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
|
||||||
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
|
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
|
||||||
DEFAULT_IFS="$IFS" # Get the Default IFS for updating
|
DEFAULT_IFS="$IFS" # Get the Default IFS for updating
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
# 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
|
||||||
echo "${DEFAULT_DISABLE_ERRORS}" > /dev/null 2>&1 || true # Workaround SC2034
|
echo "${DEFAULT_DISABLE_ERRORS}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
RAW_FILE_ARRAY=() # Array of all files that were changed
|
RAW_FILE_ARRAY=() # Array of all files that were changed
|
||||||
echo "${RAW_FILE_ARRAY[*]}" > /dev/null 2>&1 || true # Workaround SC2034
|
echo "${RAW_FILE_ARRAY[*]}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
||||||
echo "${READ_ONLY_CHANGE_FLAG}" > /dev/null 2>&1 || true # Workaround SC2034
|
echo "${READ_ONLY_CHANGE_FLAG}" > /dev/null 2>&1 || true # 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
|
||||||
echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034
|
echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
||||||
echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034
|
echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Array of changed files #
|
# Array of changed files #
|
||||||
##########################
|
##########################
|
||||||
FILE_ARRAY_YML=() # Array of files to check
|
FILE_ARRAY_YML=() # Array of files to check
|
||||||
FILE_ARRAY_JSON=() # Array of files to check
|
FILE_ARRAY_JSON=() # Array of files to check
|
||||||
FILE_ARRAY_XML=() # Array of files to check
|
FILE_ARRAY_XML=() # Array of files to check
|
||||||
FILE_ARRAY_MD=() # Array of files to check
|
FILE_ARRAY_MD=() # Array of files to check
|
||||||
FILE_ARRAY_BASH=() # Array of files to check
|
FILE_ARRAY_BASH=() # Array of files to check
|
||||||
FILE_ARRAY_PERL=() # Array of files to check
|
FILE_ARRAY_PERL=() # Array of files to check
|
||||||
FILE_ARRAY_PHP=() # Array of files to check
|
FILE_ARRAY_PHP=() # Array of files to check
|
||||||
FILE_ARRAY_RUBY=() # Array of files to check
|
FILE_ARRAY_RUBY=() # Array of files to check
|
||||||
FILE_ARRAY_PYTHON=() # Array of files to check
|
FILE_ARRAY_PYTHON=() # Array of files to check
|
||||||
FILE_ARRAY_CFN=() # Array of files to check
|
FILE_ARRAY_CFN=() # Array of files to check
|
||||||
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
||||||
FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check
|
FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check
|
||||||
FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check
|
FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check
|
||||||
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
||||||
FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
|
FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
|
||||||
FILE_ARRAY_DOCKER=() # Array of files to check
|
FILE_ARRAY_DOCKER=() # Array of files to check
|
||||||
FILE_ARRAY_GO=() # Array of files to check
|
FILE_ARRAY_GO=() # Array of files to check
|
||||||
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
||||||
FILE_ARRAY_POWERSHELL=() # Array of files to check
|
FILE_ARRAY_POWERSHELL=() # Array of files to check
|
||||||
FILE_ARRAY_CSS=() # Array of files to check
|
FILE_ARRAY_CSS=() # Array of files to check
|
||||||
FILE_ARRAY_ENV=() # Array of files to check
|
FILE_ARRAY_ENV=() # Array of files to check
|
||||||
FILE_ARRAY_CLOJURE=() # Array of files to check
|
FILE_ARRAY_CLOJURE=() # Array of files to check
|
||||||
FILE_ARRAY_KOTLIN=() # Array of files to check
|
FILE_ARRAY_KOTLIN=() # Array of files to check
|
||||||
FILE_ARRAY_PROTOBUF=() # Array of files to check
|
FILE_ARRAY_PROTOBUF=() # Array of files to check
|
||||||
FILE_ARRAY_OPENAPI=() # Array of files to check
|
FILE_ARRAY_OPENAPI=() # Array of files to check
|
||||||
|
|
||||||
############
|
############
|
||||||
# Counters #
|
# Counters #
|
||||||
############
|
############
|
||||||
ERRORS_FOUND_YML=0 # Count of errors found
|
ERRORS_FOUND_YML=0 # Count of errors found
|
||||||
ERRORS_FOUND_JSON=0 # Count of errors found
|
ERRORS_FOUND_JSON=0 # Count of errors found
|
||||||
ERRORS_FOUND_XML=0 # Count of errors found
|
ERRORS_FOUND_XML=0 # Count of errors found
|
||||||
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
||||||
ERRORS_FOUND_BASH=0 # Count of errors found
|
ERRORS_FOUND_BASH=0 # Count of errors found
|
||||||
ERRORS_FOUND_PERL=0 # Count of errors found
|
ERRORS_FOUND_PERL=0 # Count of errors found
|
||||||
ERRORS_FOUND_PHP=0 # Count of errors found
|
ERRORS_FOUND_PHP=0 # Count of errors found
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||||
ERRORS_FOUND_CFN=0 # Count of errors found
|
ERRORS_FOUND_CFN=0 # Count of errors found
|
||||||
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
||||||
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
||||||
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
||||||
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
||||||
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
||||||
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
||||||
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
||||||
ERRORS_FOUND_GO=0 # Count of errors found
|
ERRORS_FOUND_GO=0 # Count of errors found
|
||||||
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
||||||
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
||||||
ERRORS_FOUND_CSS=0 # Count of errors found
|
ERRORS_FOUND_CSS=0 # Count of errors found
|
||||||
ERRORS_FOUND_ENV=0 # Count of errors found
|
ERRORS_FOUND_ENV=0 # Count of errors found
|
||||||
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
||||||
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
||||||
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
||||||
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Header ###########################################################
|
#### Function Header ###########################################################
|
||||||
Header()
|
Header() {
|
||||||
{
|
|
||||||
###############################
|
###############################
|
||||||
# Give them the possum action #
|
# Give them the possum action #
|
||||||
###############################
|
###############################
|
||||||
|
@ -247,8 +246,7 @@ Header()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetLinterVersions ################################################
|
#### Function GetLinterVersions ################################################
|
||||||
GetLinterVersions()
|
GetLinterVersions() {
|
||||||
{
|
|
||||||
#########################
|
#########################
|
||||||
# Print version headers #
|
# Print version headers #
|
||||||
#########################
|
#########################
|
||||||
|
@ -261,8 +259,7 @@ GetLinterVersions()
|
||||||
##########################################################
|
##########################################################
|
||||||
# Go through the array of linters and print version info #
|
# Go through the array of linters and print version info #
|
||||||
##########################################################
|
##########################################################
|
||||||
for LINTER in "${LINTER_ARRAY[@]}"
|
for LINTER in "${LINTER_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo "[$LINTER]:"
|
echo "[$LINTER]:"
|
||||||
###################
|
###################
|
||||||
|
@ -292,14 +289,13 @@ GetLinterVersions()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetLinterRules ###################################################
|
#### Function GetLinterRules ###################################################
|
||||||
GetLinterRules()
|
GetLinterRules() {
|
||||||
{
|
|
||||||
# Need to validate the rules files exist
|
# Need to validate the rules files exist
|
||||||
|
|
||||||
################
|
################
|
||||||
# Pull in vars #
|
# Pull in vars #
|
||||||
################
|
################
|
||||||
LANGUAGE_NAME="$1" # Name of the language were looking for
|
LANGUAGE_NAME="$1" # Name of the language were looking for
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
# Need to create the variables for the real variables #
|
# Need to create the variables for the real variables #
|
||||||
|
@ -322,15 +318,14 @@ GetLinterRules()
|
||||||
########################################################
|
########################################################
|
||||||
# No user default provided, using the template default #
|
# 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}]"
|
echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetStandardRules #################################################
|
#### Function GetStandardRules #################################################
|
||||||
GetStandardRules()
|
GetStandardRules() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Pull In Vars #
|
# Pull In Vars #
|
||||||
################
|
################
|
||||||
|
@ -349,9 +344,9 @@ GetStandardRules()
|
||||||
#########################################
|
#########################################
|
||||||
# Only env vars that are marked as true
|
# Only env vars that are marked as true
|
||||||
GET_ENV_ARRAY=()
|
GET_ENV_ARRAY=()
|
||||||
if [[ "$LINTER" == "javascript" ]]; then
|
if [[ $LINTER == "javascript" ]]; then
|
||||||
mapfile -t GET_ENV_ARRAY < <(yq .env "$JAVASCRIPT_LINTER_RULES" | grep true)
|
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)
|
mapfile -t GET_ENV_ARRAY < <(yq .env "$TYPESCRIPT_LINTER_RULES" | grep true)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -384,8 +379,7 @@ GetStandardRules()
|
||||||
#############################
|
#############################
|
||||||
# Pull out the envs to load #
|
# Pull out the envs to load #
|
||||||
#############################
|
#############################
|
||||||
for ENV in "${GET_ENV_ARRAY[@]}"
|
for ENV in "${GET_ENV_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
#############################
|
#############################
|
||||||
# remove spaces from return #
|
# remove spaces from return #
|
||||||
#############################
|
#############################
|
||||||
|
@ -401,16 +395,15 @@ GetStandardRules()
|
||||||
#########################################
|
#########################################
|
||||||
# Remove trailing and ending whitespace #
|
# 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:]]*$//')"
|
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:]]*$//')"
|
TYPESCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function DetectOpenAPIFile ################################################
|
#### Function DetectOpenAPIFile ################################################
|
||||||
DetectOpenAPIFile()
|
DetectOpenAPIFile() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Pull in vars #
|
# Pull in vars #
|
||||||
################
|
################
|
||||||
|
@ -433,18 +426,17 @@ DetectOpenAPIFile()
|
||||||
########################
|
########################
|
||||||
# Found string in file #
|
# Found string in file #
|
||||||
########################
|
########################
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
###################
|
###################
|
||||||
# No string match #
|
# No string match #
|
||||||
###################
|
###################
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function DetectCloudFormationFile #########################################
|
#### Function DetectCloudFormationFile #########################################
|
||||||
DetectCloudFormationFile()
|
DetectCloudFormationFile() {
|
||||||
{
|
|
||||||
################
|
################
|
||||||
# Pull in Vars #
|
# Pull in Vars #
|
||||||
################
|
################
|
||||||
|
@ -473,7 +465,7 @@ DetectCloudFormationFile()
|
||||||
###############################
|
###############################
|
||||||
if jq -e 'has("Resources")' > /dev/null 2>&1 < "$FILE"; then
|
if jq -e 'has("Resources")' > /dev/null 2>&1 < "$FILE"; then
|
||||||
# Check if AWS Alexa or custom
|
# Check if AWS Alexa or custom
|
||||||
if jq ".Resources[].Type" 2>/dev/null | grep -q -E "(AWS|Alexa|Custom)" < "$FILE"; then
|
if jq ".Resources[].Type" 2> /dev/null | grep -q -E "(AWS|Alexa|Custom)" < "$FILE"; then
|
||||||
# Found it
|
# Found it
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -495,8 +487,7 @@ DetectCloudFormationFile()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetGitHubVars ####################################################
|
#### Function GetGitHubVars ####################################################
|
||||||
GetGitHubVars()
|
GetGitHubVars() {
|
||||||
{
|
|
||||||
##########
|
##########
|
||||||
# Prints #
|
# Prints #
|
||||||
##########
|
##########
|
||||||
|
@ -536,7 +527,7 @@ GetGitHubVars()
|
||||||
#################################
|
#################################
|
||||||
# Check if were running locally #
|
# Check if were running locally #
|
||||||
#################################
|
#################################
|
||||||
if [[ "$RUN_LOCAL" != "false" ]]; then
|
if [[ $RUN_LOCAL != "false" ]]; then
|
||||||
##########################################
|
##########################################
|
||||||
# We are running locally for a debug run #
|
# 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_ORG
|
||||||
# No need to touch or set the GITHUB_REPO
|
# No need to touch or set the GITHUB_REPO
|
||||||
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Set the VALIDATE_ALL_CODEBASE #
|
# Set the VALIDATE_ALL_CODEBASE #
|
||||||
#################################
|
#################################
|
||||||
|
@ -603,7 +593,7 @@ GetGitHubVars()
|
||||||
######################
|
######################
|
||||||
# Get the GitHub Org #
|
# Get the GitHub Org #
|
||||||
######################
|
######################
|
||||||
GITHUB_ORG=$(jq -r '.repository.owner.login' < "$GITHUB_EVENT_PATH" )
|
GITHUB_ORG=$(jq -r '.repository.owner.login' < "$GITHUB_EVENT_PATH")
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Validate we have a value #
|
# Validate we have a value #
|
||||||
|
@ -619,7 +609,7 @@ GetGitHubVars()
|
||||||
#######################
|
#######################
|
||||||
# Get the GitHub Repo #
|
# Get the GitHub Repo #
|
||||||
#######################
|
#######################
|
||||||
GITHUB_REPO=$(jq -r '.repository.name' < "$GITHUB_EVENT_PATH" )
|
GITHUB_REPO=$(jq -r '.repository.name' < "$GITHUB_EVENT_PATH")
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Validate we have a value #
|
# Validate we have a value #
|
||||||
|
@ -635,11 +625,10 @@ GetGitHubVars()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function ValidatePowershellModules ########################################
|
#### Function ValidatePowershellModules ########################################
|
||||||
function ValidatePowershellModules()
|
function ValidatePowershellModules() {
|
||||||
{
|
|
||||||
VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1)
|
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 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)
|
VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1)
|
||||||
else
|
else
|
||||||
# Failed to find module
|
# Failed to find module
|
||||||
|
@ -649,7 +638,7 @@ function ValidatePowershellModules()
|
||||||
#########################################
|
#########################################
|
||||||
# validate we found the script analyzer #
|
# validate we found the script analyzer #
|
||||||
#########################################
|
#########################################
|
||||||
if [[ "$VALIDATE_PSSA_CMD" != "Invoke-ScriptAnalyzer" ]]; then
|
if [[ $VALIDATE_PSSA_CMD != "Invoke-ScriptAnalyzer" ]]; then
|
||||||
# Failed to find module
|
# Failed to find module
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -669,7 +658,7 @@ function ValidatePowershellModules()
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Success
|
# 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 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}"
|
echo -e "${NC}${F[B]}Successfully found command ${F[W]}[$VALIDATE_PSSA_CMD]${F[B]} in system${NC}"
|
||||||
fi
|
fi
|
||||||
|
@ -677,8 +666,7 @@ function ValidatePowershellModules()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Footer ###########################################################
|
||||||
Footer()
|
Footer() {
|
||||||
{
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
|
@ -690,8 +678,7 @@ Footer()
|
||||||
##############################
|
##############################
|
||||||
# Prints for errors if found #
|
# Prints for errors if found #
|
||||||
##############################
|
##############################
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
###########################
|
###########################
|
||||||
# Build the error counter #
|
# Build the error counter #
|
||||||
###########################
|
###########################
|
||||||
|
@ -715,32 +702,32 @@ Footer()
|
||||||
###############################
|
###############################
|
||||||
# Exit with 1 if errors found #
|
# Exit with 1 if errors found #
|
||||||
###############################
|
###############################
|
||||||
elif [ "$ERRORS_FOUND_YML" -ne 0 ] || \
|
elif [ "$ERRORS_FOUND_YML" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_JSON" -ne 0 ] || \
|
[ "$ERRORS_FOUND_JSON" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_XML" -ne 0 ] || \
|
[ "$ERRORS_FOUND_XML" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] || \
|
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_BASH" -ne 0 ] || \
|
[ "$ERRORS_FOUND_BASH" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_PERL" -ne 0 ] || \
|
[ "$ERRORS_FOUND_PERL" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_PHP" -ne 0 ] || \
|
[ "$ERRORS_FOUND_PHP" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] || \
|
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] || \
|
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] || \
|
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_JAVASCRIPT_ES" -ne 0 ] || \
|
[ "$ERRORS_FOUND_JAVASCRIPT_ES" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_JAVASCRIPT_STANDARD" -ne 0 ] || \
|
[ "$ERRORS_FOUND_JAVASCRIPT_STANDARD" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_TYPESCRIPT_ES" -ne 0 ] || \
|
[ "$ERRORS_FOUND_TYPESCRIPT_ES" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_TYPESCRIPT_STANDARD" -ne 0 ] || \
|
[ "$ERRORS_FOUND_TYPESCRIPT_STANDARD" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \
|
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_GO" -ne 0 ] || \
|
[ "$ERRORS_FOUND_GO" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \
|
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] || \
|
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_RUBY" -ne 0 ] || \
|
[ "$ERRORS_FOUND_RUBY" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_CSS" -ne 0 ] || \
|
[ "$ERRORS_FOUND_CSS" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_CFN" -ne 0 ] || \
|
[ "$ERRORS_FOUND_CFN" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_ENV" -ne 0 ] || \
|
[ "$ERRORS_FOUND_ENV" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] || \
|
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_PROTOBUF" -ne 0 ] || \
|
[ "$ERRORS_FOUND_PROTOBUF" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] || \
|
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] ||
|
||||||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then
|
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then
|
||||||
# Failed exit
|
# Failed exit
|
||||||
echo -e "${NC}${F[R]}Exiting with errors found!${NC}"
|
echo -e "${NC}${F[R]}Exiting with errors found!${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -812,7 +799,7 @@ GetLinterRules "CFN"
|
||||||
#################################
|
#################################
|
||||||
# Check if were in verbose mode #
|
# Check if were in verbose mode #
|
||||||
#################################
|
#################################
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
##################################
|
##################################
|
||||||
# Get and print all version info #
|
# Get and print all version info #
|
||||||
##################################
|
##################################
|
||||||
|
@ -822,7 +809,7 @@ fi
|
||||||
###########################################
|
###########################################
|
||||||
# Check to see if this is a test case run #
|
# 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 #
|
# Run only the test cases #
|
||||||
###########################
|
###########################
|
||||||
|
@ -1146,8 +1133,7 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
||||||
for FILE in "${LIST_FILES[@]}"
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
do
|
|
||||||
if DetectOpenAPIFile "$FILE"; then
|
if DetectOpenAPIFile "$FILE"; then
|
||||||
FILE_ARRAY_OPENAPI+=("$FILE")
|
FILE_ARRAY_OPENAPI+=("$FILE")
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cat <<EOF
|
cat << EOF
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
/@@#///////@@/(@//@%/(@.@( @@
|
/@@#///////@@/(@//@%/(@.@( @@
|
||||||
|
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function GetValidationInfo ################################################
|
#### Function GetValidationInfo ################################################
|
||||||
function GetValidationInfo()
|
function GetValidationInfo() {
|
||||||
{
|
|
||||||
############################################
|
############################################
|
||||||
# Print headers for user provided env vars #
|
# Print headers for user provided env vars #
|
||||||
############################################
|
############################################
|
||||||
|
@ -21,7 +20,7 @@ function GetValidationInfo()
|
||||||
###########################################
|
###########################################
|
||||||
# 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 #
|
||||||
###############################
|
###############################
|
||||||
|
@ -29,7 +28,7 @@ function GetValidationInfo()
|
||||||
######################################
|
######################################
|
||||||
# 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"
|
||||||
echo "- Validating ALL files in code base..."
|
echo "- Validating ALL files in code base..."
|
||||||
|
@ -77,40 +76,40 @@ function GetValidationInfo()
|
||||||
# Determine if any linters were explicitly set #
|
# Determine if any linters were explicitly set #
|
||||||
################################################
|
################################################
|
||||||
ANY_SET="false"
|
ANY_SET="false"
|
||||||
if [[ -n "$VALIDATE_YAML" || \
|
if [[ -n $VALIDATE_YAML || -n \
|
||||||
-n "$VALIDATE_JSON" || \
|
$VALIDATE_JSON || -n \
|
||||||
-n "$VALIDATE_XML" || \
|
$VALIDATE_XML || -n \
|
||||||
-n "$VALIDATE_MD" || \
|
$VALIDATE_MD || -n \
|
||||||
-n "$VALIDATE_BASH" || \
|
$VALIDATE_BASH || -n \
|
||||||
-n "$VALIDATE_PERL" || \
|
$VALIDATE_PERL || -n \
|
||||||
-n "$VALIDATE_PHP" || \
|
$VALIDATE_PHP || -n \
|
||||||
-n "$VALIDATE_PYTHON" || \
|
$VALIDATE_PYTHON || -n \
|
||||||
-n "$VALIDATE_RUBY" || \
|
$VALIDATE_RUBY || -n \
|
||||||
-n "$VALIDATE_COFFEE" || \
|
$VALIDATE_COFFEE || -n \
|
||||||
-n "$VALIDATE_ANSIBLE" || \
|
$VALIDATE_ANSIBLE || -n \
|
||||||
-n "$VALIDATE_JAVASCRIPT_ES" || \
|
$VALIDATE_JAVASCRIPT_ES || -n \
|
||||||
-n "$VALIDATE_JAVASCRIPT_STANDARD" || \
|
$VALIDATE_JAVASCRIPT_STANDARD || -n \
|
||||||
-n "$VALIDATE_TYPESCRIPT_ES" || \
|
$VALIDATE_TYPESCRIPT_ES || -n \
|
||||||
-n "$VALIDATE_TYPESCRIPT_STANDARD" || \
|
$VALIDATE_TYPESCRIPT_STANDARD || -n \
|
||||||
-n "$VALIDATE_DOCKER" || \
|
$VALIDATE_DOCKER || -n \
|
||||||
-n "$VALIDATE_GO" || \
|
$VALIDATE_GO || -n \
|
||||||
-n "$VALIDATE_TERRAFORM" || \
|
$VALIDATE_TERRAFORM || -n \
|
||||||
-n "$VALIDATE_POWERSHELL" || \
|
$VALIDATE_POWERSHELL || -n \
|
||||||
-n "$VALIDATE_CSS" || \
|
$VALIDATE_CSS || -n \
|
||||||
-n "$VALIDATE_ENV" || \
|
$VALIDATE_ENV || -n \
|
||||||
-n "$VALIDATE_CLOJURE" || \
|
$VALIDATE_CLOJURE || -n \
|
||||||
-n "$VALIDATE_PROTOBUF" || \
|
$VALIDATE_PROTOBUF || -n \
|
||||||
-n "$VALIDATE_OPENAPI" || \
|
$VALIDATE_OPENAPI || -n \
|
||||||
-n "$VALIDATE_KOTLIN" ]]; then
|
$VALIDATE_KOTLIN ]]; then
|
||||||
ANY_SET="true"
|
ANY_SET="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check YAML #
|
# 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
|
# 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
|
# YAML flag was not set - default to false
|
||||||
VALIDATE_YAML="false"
|
VALIDATE_YAML="false"
|
||||||
fi
|
fi
|
||||||
|
@ -122,9 +121,9 @@ function GetValidationInfo()
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check JSON #
|
# 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
|
# 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
|
# JSON flag was not set - default to false
|
||||||
VALIDATE_JSON="false"
|
VALIDATE_JSON="false"
|
||||||
fi
|
fi
|
||||||
|
@ -136,9 +135,9 @@ function GetValidationInfo()
|
||||||
###################################
|
###################################
|
||||||
# Validate if we should check XML #
|
# 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
|
# 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
|
# XML flag was not set - default to false
|
||||||
VALIDATE_XML="false"
|
VALIDATE_XML="false"
|
||||||
fi
|
fi
|
||||||
|
@ -150,9 +149,9 @@ function GetValidationInfo()
|
||||||
########################################
|
########################################
|
||||||
# Validate if we should check MARKDOWN #
|
# 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
|
# 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
|
# MD flag was not set - default to false
|
||||||
VALIDATE_MD="false"
|
VALIDATE_MD="false"
|
||||||
fi
|
fi
|
||||||
|
@ -164,9 +163,9 @@ function GetValidationInfo()
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check BASH #
|
# 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
|
# 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
|
# BASH flag was not set - default to false
|
||||||
VALIDATE_BASH="false"
|
VALIDATE_BASH="false"
|
||||||
fi
|
fi
|
||||||
|
@ -178,9 +177,9 @@ function GetValidationInfo()
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check PERL #
|
# 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
|
# 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
|
# PERL flag was not set - default to false
|
||||||
VALIDATE_PERL="false"
|
VALIDATE_PERL="false"
|
||||||
fi
|
fi
|
||||||
|
@ -192,9 +191,9 @@ function GetValidationInfo()
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check PHP #
|
# 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
|
# 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
|
# PHP flag was not set - default to false
|
||||||
VALIDATE_PHP="false"
|
VALIDATE_PHP="false"
|
||||||
fi
|
fi
|
||||||
|
@ -206,9 +205,9 @@ function GetValidationInfo()
|
||||||
######################################
|
######################################
|
||||||
# Validate if we should check PYTHON #
|
# 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
|
# 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
|
# PYTHON flag was not set - default to false
|
||||||
VALIDATE_PYTHON="false"
|
VALIDATE_PYTHON="false"
|
||||||
fi
|
fi
|
||||||
|
@ -220,9 +219,9 @@ function GetValidationInfo()
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check RUBY #
|
# 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
|
# 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
|
# RUBY flag was not set - default to false
|
||||||
VALIDATE_RUBY="false"
|
VALIDATE_RUBY="false"
|
||||||
fi
|
fi
|
||||||
|
@ -234,9 +233,9 @@ function GetValidationInfo()
|
||||||
######################################
|
######################################
|
||||||
# Validate if we should check COFFEE #
|
# 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
|
# 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
|
# COFFEE flag was not set - default to false
|
||||||
VALIDATE_COFFEE="false"
|
VALIDATE_COFFEE="false"
|
||||||
fi
|
fi
|
||||||
|
@ -248,9 +247,9 @@ function GetValidationInfo()
|
||||||
#######################################
|
#######################################
|
||||||
# Validate if we should check ANSIBLE #
|
# 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
|
# 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
|
# ANSIBLE flag was not set - default to false
|
||||||
VALIDATE_ANSIBLE="false"
|
VALIDATE_ANSIBLE="false"
|
||||||
fi
|
fi
|
||||||
|
@ -262,9 +261,9 @@ function GetValidationInfo()
|
||||||
#############################################
|
#############################################
|
||||||
# Validate if we should check JAVASCRIPT_ES #
|
# 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
|
# 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
|
# JAVASCRIPT_ES flag was not set - default to false
|
||||||
VALIDATE_JAVASCRIPT_ES="false"
|
VALIDATE_JAVASCRIPT_ES="false"
|
||||||
fi
|
fi
|
||||||
|
@ -276,9 +275,9 @@ function GetValidationInfo()
|
||||||
###################################################
|
###################################################
|
||||||
# Validate if we should check JAVASCRIPT_STANDARD #
|
# 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
|
# 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
|
# JAVASCRIPT_STANDARD flag was not set - default to false
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="false"
|
VALIDATE_JAVASCRIPT_STANDARD="false"
|
||||||
fi
|
fi
|
||||||
|
@ -290,9 +289,9 @@ function GetValidationInfo()
|
||||||
#############################################
|
#############################################
|
||||||
# Validate if we should check TYPESCRIPT_ES #
|
# 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
|
# 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
|
# TYPESCRIPT_ES flag was not set - default to false
|
||||||
VALIDATE_TYPESCRIPT_ES="false"
|
VALIDATE_TYPESCRIPT_ES="false"
|
||||||
fi
|
fi
|
||||||
|
@ -304,9 +303,9 @@ function GetValidationInfo()
|
||||||
###################################################
|
###################################################
|
||||||
# Validate if we should check TYPESCRIPT_STANDARD #
|
# 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
|
# 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
|
# TYPESCRIPT_STANDARD flag was not set - default to false
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="false"
|
VALIDATE_TYPESCRIPT_STANDARD="false"
|
||||||
fi
|
fi
|
||||||
|
@ -318,9 +317,9 @@ function GetValidationInfo()
|
||||||
######################################
|
######################################
|
||||||
# Validate if we should check DOCKER #
|
# 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
|
# 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
|
# DOCKER flag was not set - default to false
|
||||||
VALIDATE_DOCKER="false"
|
VALIDATE_DOCKER="false"
|
||||||
fi
|
fi
|
||||||
|
@ -332,9 +331,9 @@ function GetValidationInfo()
|
||||||
##################################
|
##################################
|
||||||
# Validate if we should check GO #
|
# 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
|
# 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
|
# GO flag was not set - default to false
|
||||||
VALIDATE_GO="false"
|
VALIDATE_GO="false"
|
||||||
fi
|
fi
|
||||||
|
@ -346,9 +345,9 @@ function GetValidationInfo()
|
||||||
#########################################
|
#########################################
|
||||||
# Validate if we should check TERRAFORM #
|
# 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
|
# 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
|
# TERRAFORM flag was not set - default to false
|
||||||
VALIDATE_TERRAFORM="false"
|
VALIDATE_TERRAFORM="false"
|
||||||
fi
|
fi
|
||||||
|
@ -360,9 +359,9 @@ function GetValidationInfo()
|
||||||
#########################################
|
#########################################
|
||||||
# Validate if we should check POWERSHELL #
|
# 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
|
# 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
|
# POWERSHELL flag was not set - default to false
|
||||||
VALIDATE_POWERSHELL="false"
|
VALIDATE_POWERSHELL="false"
|
||||||
fi
|
fi
|
||||||
|
@ -374,9 +373,9 @@ function GetValidationInfo()
|
||||||
###################################
|
###################################
|
||||||
# Validate if we should check CSS #
|
# 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
|
# 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
|
# CSS flag was not set - default to false
|
||||||
VALIDATE_CSS="false"
|
VALIDATE_CSS="false"
|
||||||
fi
|
fi
|
||||||
|
@ -388,9 +387,9 @@ function GetValidationInfo()
|
||||||
###################################
|
###################################
|
||||||
# Validate if we should check ENV #
|
# 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
|
# 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
|
# ENV flag was not set - default to false
|
||||||
VALIDATE_ENV="false"
|
VALIDATE_ENV="false"
|
||||||
fi
|
fi
|
||||||
|
@ -402,9 +401,9 @@ function GetValidationInfo()
|
||||||
######################################
|
######################################
|
||||||
# Validate if we should check KOTLIN #
|
# 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
|
# 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
|
# ENV flag was not set - default to false
|
||||||
VALIDATE_KOTLIN="false"
|
VALIDATE_KOTLIN="false"
|
||||||
fi
|
fi
|
||||||
|
@ -416,9 +415,9 @@ function GetValidationInfo()
|
||||||
#######################################
|
#######################################
|
||||||
# Validate if we should check OPENAPI #
|
# 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
|
# 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
|
# OPENAPI flag was not set - default to false
|
||||||
VALIDATE_OPENAPI="false"
|
VALIDATE_OPENAPI="false"
|
||||||
fi
|
fi
|
||||||
|
@ -430,9 +429,9 @@ function GetValidationInfo()
|
||||||
#######################################
|
#######################################
|
||||||
# Validate if we should check PROTOBUF #
|
# 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
|
# 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
|
# PROTOBUF flag was not set - default to false
|
||||||
VALIDATE_PROTOBUF="false"
|
VALIDATE_PROTOBUF="false"
|
||||||
fi
|
fi
|
||||||
|
@ -444,9 +443,9 @@ function GetValidationInfo()
|
||||||
#######################################
|
#######################################
|
||||||
# Validate if we should check Clojure #
|
# 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
|
# 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
|
# Clojure flag was not set - default to false
|
||||||
VALIDATE_CLOJURE="false"
|
VALIDATE_CLOJURE="false"
|
||||||
fi
|
fi
|
||||||
|
@ -458,127 +457,127 @@ function GetValidationInfo()
|
||||||
#######################################
|
#######################################
|
||||||
# Print which linters we are enabling #
|
# Print which linters we are enabling #
|
||||||
#######################################
|
#######################################
|
||||||
if [[ "$VALIDATE_YAML" == "true" ]]; then
|
if [[ $VALIDATE_YAML == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [YAML] files in code base...")
|
PRINT_ARRAY+=("- Validating [YAML] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
|
PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_JSON" == "true" ]]; then
|
if [[ $VALIDATE_JSON == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [JSON] files in code base...")
|
PRINT_ARRAY+=("- Validating [JSON] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [JSON] files in code base...")
|
PRINT_ARRAY+=("- Excluding [JSON] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_XML" == "true" ]]; then
|
if [[ $VALIDATE_XML == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [XML] files in code base...")
|
PRINT_ARRAY+=("- Validating [XML] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
|
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_MD" == "true" ]]; then
|
if [[ $VALIDATE_MD == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
|
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
|
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_BASH" == "true" ]]; then
|
if [[ $VALIDATE_BASH == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [BASH] files in code base...")
|
PRINT_ARRAY+=("- Validating [BASH] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [BASH] files in code base...")
|
PRINT_ARRAY+=("- Excluding [BASH] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_PERL" == "true" ]]; then
|
if [[ $VALIDATE_PERL == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [PERL] files in code base...")
|
PRINT_ARRAY+=("- Validating [PERL] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
|
PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_PHP" == "true" ]]; then
|
if [[ $VALIDATE_PHP == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [PHP] files in code base...")
|
PRINT_ARRAY+=("- Validating [PHP] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [PHP] files in code base...")
|
PRINT_ARRAY+=("- Excluding [PHP] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_PYTHON" == "true" ]]; then
|
if [[ $VALIDATE_PYTHON == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [PYTHON] files in code base...")
|
PRINT_ARRAY+=("- Validating [PYTHON] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...")
|
PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_RUBY" == "true" ]]; then
|
if [[ $VALIDATE_RUBY == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [RUBY] files in code base...")
|
PRINT_ARRAY+=("- Validating [RUBY] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [RUBY] files in code base...")
|
PRINT_ARRAY+=("- Excluding [RUBY] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_COFFEE" == "true" ]]; then
|
if [[ $VALIDATE_COFFEE == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [COFFEE] files in code base...")
|
PRINT_ARRAY+=("- Validating [COFFEE] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...")
|
PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_ANSIBLE" == "true" ]]; then
|
if [[ $VALIDATE_ANSIBLE == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...")
|
PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...")
|
PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_JAVASCRIPT_ES" == "true" ]]; then
|
if [[ $VALIDATE_JAVASCRIPT_ES == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...")
|
PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...")
|
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_JAVASCRIPT_STANDARD" == "true" ]]; then
|
if [[ $VALIDATE_JAVASCRIPT_STANDARD == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...")
|
PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...")
|
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_TYPESCRIPT_ES" == "true" ]]; then
|
if [[ $VALIDATE_TYPESCRIPT_ES == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...")
|
PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...")
|
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_TYPESCRIPT_STANDARD" == "true" ]]; then
|
if [[ $VALIDATE_TYPESCRIPT_STANDARD == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...")
|
PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...")
|
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_DOCKER" == "true" ]]; then
|
if [[ $VALIDATE_DOCKER == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [DOCKER] files in code base...")
|
PRINT_ARRAY+=("- Validating [DOCKER] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...")
|
PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_GO" == "true" ]]; then
|
if [[ $VALIDATE_GO == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [GOLANG] files in code base...")
|
PRINT_ARRAY+=("- Validating [GOLANG] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...")
|
PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_TERRAFORM" == "true" ]]; then
|
if [[ $VALIDATE_TERRAFORM == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...")
|
PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...")
|
PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_POWERSHELL" == "true" ]]; then
|
if [[ $VALIDATE_POWERSHELL == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...")
|
PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...")
|
PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_CSS" == "true" ]]; then
|
if [[ $VALIDATE_CSS == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [CSS] files in code base...")
|
PRINT_ARRAY+=("- Validating [CSS] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
|
PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_CLOJURE" == "true" ]]; then
|
if [[ $VALIDATE_CLOJURE == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
|
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
|
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_ENV" == "true" ]]; then
|
if [[ $VALIDATE_ENV == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
|
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [ENV] files in code base...")
|
PRINT_ARRAY+=("- Excluding [ENV] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_KOTLIN" == "true" ]]; then
|
if [[ $VALIDATE_KOTLIN == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
|
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
|
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_OPENAPI" == "true" ]]; then
|
if [[ $VALIDATE_OPENAPI == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...")
|
PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...")
|
PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ "$VALIDATE_PROTOBUF" == "true" ]]; then
|
if [[ $VALIDATE_PROTOBUF == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...")
|
PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
|
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
|
||||||
|
@ -649,12 +648,11 @@ function GetValidationInfo()
|
||||||
###################
|
###################
|
||||||
# Debug on runner #
|
# Debug on runner #
|
||||||
###################
|
###################
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
###########################
|
###########################
|
||||||
# Print the validate info #
|
# Print the validate info #
|
||||||
###########################
|
###########################
|
||||||
for LINE in "${PRINT_ARRAY[@]}"
|
for LINE in "${PRINT_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
echo "$LINE"
|
echo "$LINE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function LintCodebase #####################################################
|
#### Function LintCodebase #####################################################
|
||||||
function LintCodebase()
|
function LintCodebase() {
|
||||||
{
|
|
||||||
####################
|
####################
|
||||||
# Pull in the vars #
|
# Pull in the vars #
|
||||||
####################
|
####################
|
||||||
|
@ -55,7 +54,7 @@ function LintCodebase()
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Success
|
# 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 -e "${NC}${F[B]}Successfully found binary for ${F[W]}[$LINTER_NAME]${F[B]} in system${NC}"
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
||||||
fi
|
fi
|
||||||
|
@ -119,8 +118,7 @@ function LintCodebase()
|
||||||
######################
|
######################
|
||||||
# Print Header array #
|
# Print Header array #
|
||||||
######################
|
######################
|
||||||
for LINE in "${PRINT_ARRAY[@]}"
|
for LINE in "${PRINT_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
#########################
|
#########################
|
||||||
# Print the header info #
|
# Print the header info #
|
||||||
#########################
|
#########################
|
||||||
|
@ -130,8 +128,7 @@ function LintCodebase()
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
##################
|
##################
|
||||||
for FILE in "${LIST_FILES[@]}"
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
do
|
|
||||||
#####################
|
#####################
|
||||||
# Get the file name #
|
# Get the file name #
|
||||||
#####################
|
#####################
|
||||||
|
@ -162,17 +159,24 @@ function LintCodebase()
|
||||||
#######################################
|
#######################################
|
||||||
# Corner case for Powershell subshell #
|
# Corner case for Powershell subshell #
|
||||||
#######################################
|
#######################################
|
||||||
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
if [[ $FILE_TYPE == "POWERSHELL" ]]; then
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
|
# 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
|
else
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# 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
|
fi
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -202,17 +206,16 @@ function LintCodebase()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function TestCodebase #####################################################
|
#### Function TestCodebase #####################################################
|
||||||
function TestCodebase()
|
function TestCodebase() {
|
||||||
{
|
|
||||||
####################
|
####################
|
||||||
# Pull in the vars #
|
# Pull in the vars #
|
||||||
####################
|
####################
|
||||||
FILE_TYPE="$1" # Pull the variable and remove from array path (Example: JSON)
|
FILE_TYPE="$1" # Pull the variable and remove from array path (Example: JSON)
|
||||||
LINTER_NAME="$2" # Pull the variable and remove from array path (Example: jsonlint)
|
LINTER_NAME="$2" # Pull the variable and remove from array path (Example: jsonlint)
|
||||||
LINTER_COMMAND="$3" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
|
LINTER_COMMAND="$3" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
|
||||||
FILE_EXTENSIONS="$4" # Pull the variable and remove from array path (Example: *.json)
|
FILE_EXTENSIONS="$4" # Pull the variable and remove from array path (Example: *.json)
|
||||||
INDVIDUAL_TEST_FOLDER="$5" # Folder for specific tests
|
INDVIDUAL_TEST_FOLDER="$5" # Folder for specific tests
|
||||||
TESTS_RAN=0 # Incremented when tests are ran, this will help find failed finds
|
TESTS_RAN=0 # Incremented when tests are ran, this will help find failed finds
|
||||||
|
|
||||||
################
|
################
|
||||||
# print header #
|
# print header #
|
||||||
|
@ -262,8 +265,7 @@ function TestCodebase()
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
##################
|
##################
|
||||||
for FILE in "${LIST_FILES[@]}"
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
do
|
|
||||||
#####################
|
#####################
|
||||||
# Get the file name #
|
# Get the file name #
|
||||||
#####################
|
#####################
|
||||||
|
@ -273,12 +275,12 @@ function TestCodebase()
|
||||||
# Get the file pass status #
|
# Get the file pass status #
|
||||||
############################
|
############################
|
||||||
# Example: markdown_good_1.md -> good
|
# Example: markdown_good_1.md -> good
|
||||||
FILE_STATUS=$(echo "$FILE_NAME" |cut -f2 -d'_')
|
FILE_STATUS=$(echo "$FILE_NAME" | cut -f2 -d'_')
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# If not found, assume it should be linted successfully #
|
# 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 #
|
# Set to good for proper linting #
|
||||||
##################################
|
##################################
|
||||||
|
@ -299,8 +301,8 @@ function TestCodebase()
|
||||||
#######################################
|
#######################################
|
||||||
# Check if docker and get folder name #
|
# Check if docker and get folder name #
|
||||||
#######################################
|
#######################################
|
||||||
if [[ "$FILE_TYPE" == "DOCKER" ]]; then
|
if [[ $FILE_TYPE == "DOCKER" ]]; then
|
||||||
if [[ "$FILE" == *"good"* ]]; then
|
if [[ $FILE == *"good"* ]]; then
|
||||||
#############
|
#############
|
||||||
# Good file #
|
# Good file #
|
||||||
#############
|
#############
|
||||||
|
@ -316,7 +318,7 @@ function TestCodebase()
|
||||||
#####################
|
#####################
|
||||||
# Check for ansible #
|
# Check for ansible #
|
||||||
#####################
|
#####################
|
||||||
if [[ "$FILE_TYPE" == "ANSIBLE" ]]; then
|
if [[ $FILE_TYPE == "ANSIBLE" ]]; then
|
||||||
########################################
|
########################################
|
||||||
# Make sure we dont lint certain files #
|
# Make sure we dont lint certain files #
|
||||||
########################################
|
########################################
|
||||||
|
@ -328,18 +330,28 @@ function TestCodebase()
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" || exit; $LINTER_COMMAND "$FILE" 2>&1)
|
LINT_CMD=$(
|
||||||
elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
|
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 #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
|
# 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
|
else
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# 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
|
fi
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -350,7 +362,7 @@ function TestCodebase()
|
||||||
########################################
|
########################################
|
||||||
# Check for if it was supposed to pass #
|
# Check for if it was supposed to pass #
|
||||||
########################################
|
########################################
|
||||||
if [[ "$FILE_STATUS" == "good" ]]; then
|
if [[ $FILE_STATUS == "good" ]]; then
|
||||||
##############################
|
##############################
|
||||||
# Check the shell for errors #
|
# Check the shell for errors #
|
||||||
##############################
|
##############################
|
||||||
|
@ -417,8 +429,7 @@ function TestCodebase()
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function RunTestCases #####################################################
|
#### Function RunTestCases #####################################################
|
||||||
function RunTestCases()
|
function RunTestCases() {
|
||||||
{
|
|
||||||
# This loop will run the test cases and exclude user code
|
# This loop will run the test cases and exclude user code
|
||||||
# This is called from the automation process to validate new 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
|
# 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()
|
function LintAnsibleFiles() {
|
||||||
{
|
|
||||||
######################
|
######################
|
||||||
# Create Print Array #
|
# Create Print Array #
|
||||||
######################
|
######################
|
||||||
|
@ -518,7 +528,7 @@ function LintAnsibleFiles()
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Success
|
# Success
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
# Success
|
# Success
|
||||||
echo -e "${NC}${F[B]}Successfully found binary in system${NC}"
|
echo -e "${NC}${F[B]}Successfully found binary in system${NC}"
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
||||||
|
@ -568,8 +578,7 @@ function LintAnsibleFiles()
|
||||||
# Check if we have data to look at #
|
# Check if we have data to look at #
|
||||||
####################################
|
####################################
|
||||||
if [ $SKIP_FLAG -eq 0 ]; then
|
if [ $SKIP_FLAG -eq 0 ]; then
|
||||||
for LINE in "${PRINT_ARRAY[@]}"
|
for LINE in "${PRINT_ARRAY[@]}"; do
|
||||||
do
|
|
||||||
#########################
|
#########################
|
||||||
# Print the header line #
|
# Print the header line #
|
||||||
#########################
|
#########################
|
||||||
|
@ -580,8 +589,7 @@ function LintAnsibleFiles()
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
##################
|
##################
|
||||||
for FILE in "${LIST_FILES[@]}"
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
do
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# Make sure we dont lint certain files #
|
# Make sure we dont lint certain files #
|
||||||
|
@ -634,7 +642,7 @@ function LintAnsibleFiles()
|
||||||
###############################
|
###############################
|
||||||
# Check to see if debug is on #
|
# Check to see if debug is on #
|
||||||
###############################
|
###############################
|
||||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then
|
||||||
########################
|
########################
|
||||||
# No Ansible dir found #
|
# No Ansible dir found #
|
||||||
########################
|
########################
|
||||||
|
|
Loading…
Reference in a new issue