mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-24 15:11:09 -05:00
commit
bb60988290
15 changed files with 183 additions and 1999 deletions
|
@ -1,3 +0,0 @@
|
||||||
# Automation
|
|
||||||
|
|
||||||
This folder holds all scripting and configuration to run **GitHub Actions** that validate the sanity of the source code in this repository.
|
|
|
@ -1,184 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
################## Ansible Linter @admiralawkbar ###############################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
###########
|
|
||||||
# GLOBALS #
|
|
||||||
###########
|
|
||||||
BUILD_DIR=$(pwd 2>&1) # Current Build dir
|
|
||||||
ANSIBLE_LINTER_FILE=".automation/.ansible-lint" # Name of the Linter file
|
|
||||||
ANSIBLE_DIR="$BUILD_DIR/ansible" # Ansible directory
|
|
||||||
|
|
||||||
############
|
|
||||||
# Counters #
|
|
||||||
############
|
|
||||||
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########################## FUNCTIONS BELOW #####################################
|
|
||||||
################################################################################
|
|
||||||
################################################################################
|
|
||||||
#### Function Header ###########################################################
|
|
||||||
Header()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "-----------------------------------"
|
|
||||||
echo "---------- Ansible Linter ---------"
|
|
||||||
echo "-----------------------------------"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintAnsibleFiles #################################################
|
|
||||||
LintAnsibleFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Ansible files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
# Validate we have the linter rules file #
|
|
||||||
##########################################
|
|
||||||
if [ ! -f "$ANSIBLE_LINTER_FILE" ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to find rules file at:[$ANSIBLE_LINTER_FILE]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="ansible-lint"
|
|
||||||
|
|
||||||
###########################################
|
|
||||||
# Validate we have ansible-lint installed #
|
|
||||||
###########################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find $LINTER_NAME in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2164,SC2010
|
|
||||||
LIST_FILES=($(cd "$ANSIBLE_DIR"; ls -I vault.yml -I galaxy.yml | grep ".yml" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Get the filename #
|
|
||||||
####################
|
|
||||||
FILE_NAME=$(basename "$ANSIBLE_DIR/$FILE" 2>&1)
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" -v -c "$ANSIBLE_LINTER_FILE" "$ANSIBLE_DIR/$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_ANSIBLE++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function Footer ###########################################################
|
|
||||||
Footer()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "The script has completed"
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "ERRORS FOUND in ANSIBLE:[$ERRORS_FOUND_ANSIBLE]"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Exit with 1 if errors found #
|
|
||||||
###############################
|
|
||||||
if [ $ERRORS_FOUND_ANSIBLE -ne 0 ]; then
|
|
||||||
# Failed exit
|
|
||||||
echo "Exiting with errors found!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Successful exit
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
############################### MAIN ###########################################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Header #
|
|
||||||
##########
|
|
||||||
Header
|
|
||||||
|
|
||||||
##########################
|
|
||||||
# Lint the Ansible files #
|
|
||||||
##########################
|
|
||||||
LintAnsibleFiles
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Footer #
|
|
||||||
##########
|
|
||||||
Footer
|
|
|
@ -1,347 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
################## Scripting Language Linter @admiralawkbar ####################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
###########
|
|
||||||
# GLOBALS #
|
|
||||||
###########
|
|
||||||
APT_PACKAGE_ARRAY=() # Packages to install using APT
|
|
||||||
GEM_PACKAGE_ARRAY=() # Packages to install using GEM
|
|
||||||
NPM_PACKAGE_ARRAY=() # Packages to install using NPM
|
|
||||||
PIP_PACKAGE_ARRAY=(
|
|
||||||
"ansible-lint==4.0.1") # Packages to install using PIP
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########################## FUNCTIONS BELOW #####################################
|
|
||||||
################################################################################
|
|
||||||
################################################################################
|
|
||||||
#### Function Header ###########################################################
|
|
||||||
Header()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "---- Install Dependancies ----"
|
|
||||||
echo "------------------------------"
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallAptPackages ###############################################
|
|
||||||
InstallAptPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${APT_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No APT package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing APT package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(sudo apt-get install $INSTALL_PACKAGE_STRING -y 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install APT packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all APT packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallPipPackages ###############################################
|
|
||||||
InstallPipPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${PIP_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No PIP package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing PIP package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(sudo -H pip install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install PIP packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all PIP packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallGemPackages ###############################################
|
|
||||||
InstallGemPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${GEM_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No GEM package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing GEM package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(gem install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install GEM packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all GEM packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallNPMPackages ###############################################
|
|
||||||
InstallNPMPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${NPM_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No NPM package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing NPM package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(npm -g install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install NPM packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all NPM packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function ConvertArray #####################################################
|
|
||||||
ConvertArray()
|
|
||||||
{
|
|
||||||
#####################
|
|
||||||
# Read in the array #
|
|
||||||
#####################
|
|
||||||
ARRAY=("$@")
|
|
||||||
|
|
||||||
###################################################
|
|
||||||
# Convert the array into a space seperated string #
|
|
||||||
###################################################
|
|
||||||
STRING=$(IFS=$' '; echo "${ARRAY[*]}" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to create string!"
|
|
||||||
echo "ERROR:[$STRING]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
# Need to remove whitespace on the edges #
|
|
||||||
##########################################
|
|
||||||
CLEANED_STRING=$(echo "$STRING" | xargs 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to clean string!"
|
|
||||||
echo "ERROR:[$STRING]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
############################################################
|
|
||||||
# Echo the cleaned string back to the master function call #
|
|
||||||
############################################################
|
|
||||||
echo "$CLEANED_STRING"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function Footer ###########################################################
|
|
||||||
Footer()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "The script has completed"
|
|
||||||
echo "---------------------------"
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
############################### MAIN ###########################################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Header #
|
|
||||||
##########
|
|
||||||
Header
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install APT packages #
|
|
||||||
########################
|
|
||||||
InstallAptPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install PIP packages #
|
|
||||||
########################
|
|
||||||
InstallPipPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install GEM packages #
|
|
||||||
########################
|
|
||||||
InstallGemPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install NPM packages #
|
|
||||||
########################
|
|
||||||
InstallNPMPackages
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Footer #
|
|
||||||
##########
|
|
||||||
Footer
|
|
|
@ -1,353 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
################## Scripting Language Linter @admiralawkbar ####################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
###########
|
|
||||||
# GLOBALS #
|
|
||||||
###########
|
|
||||||
APT_PACKAGE_ARRAY=(
|
|
||||||
"yamllint"
|
|
||||||
"shellcheck"
|
|
||||||
"jsonlint"
|
|
||||||
"pylint"
|
|
||||||
"libxml2-utils") # Packages to install using APT
|
|
||||||
GEM_PACKAGE_ARRAY=(
|
|
||||||
"rubocop") # Packages to install using GEM
|
|
||||||
NPM_PACKAGE_ARRAY=(
|
|
||||||
"markdownlint-cli") # Packages to install using NPM
|
|
||||||
PIP_PACKAGE_ARRAY=() # Packages to install using PIP
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########################## FUNCTIONS BELOW #####################################
|
|
||||||
################################################################################
|
|
||||||
################################################################################
|
|
||||||
#### Function Header ###########################################################
|
|
||||||
Header()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "---- Install Dependancies ----"
|
|
||||||
echo "------------------------------"
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallAptPackages ###############################################
|
|
||||||
InstallAptPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${APT_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No APT package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing APT package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(sudo apt-get install $INSTALL_PACKAGE_STRING -y 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install APT packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all APT packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallPipPackages ###############################################
|
|
||||||
InstallPipPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${PIP_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No PIP package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing PIP package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(pip install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install PIP packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all PIP packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallGemPackages ###############################################
|
|
||||||
InstallGemPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${GEM_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No GEM package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing GEM package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(gem install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install GEM packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all GEM packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function InstallNPMPackages ###############################################
|
|
||||||
InstallNPMPackages()
|
|
||||||
{
|
|
||||||
######################################################
|
|
||||||
# Convert Array to string for single pass to install #
|
|
||||||
######################################################
|
|
||||||
INSTALL_PACKAGE_STRING=$(ConvertArray "${NPM_PACKAGE_ARRAY[@]}")
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Check the string for length #
|
|
||||||
###############################
|
|
||||||
LENGTH=${#INSTALL_PACKAGE_STRING}
|
|
||||||
|
|
||||||
#############################
|
|
||||||
# Skip loop if no variables #
|
|
||||||
#############################
|
|
||||||
if [ "$LENGTH" -le 1 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "No NPM package(s) to install... skipping..."
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Headers #
|
|
||||||
###########
|
|
||||||
echo ""
|
|
||||||
echo "------------------------------"
|
|
||||||
echo "Installing NPM package(s)"
|
|
||||||
echo "Packages:[$INSTALL_PACKAGE_STRING]"
|
|
||||||
echo "This could take several moments..."
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Need to install all APT packages #
|
|
||||||
####################################
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
INSTALL_CMD=$(npm -g install $INSTALL_PACKAGE_STRING 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to install NPM packages!"
|
|
||||||
echo "ERROR:[$INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully installed all NPM packages"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function ConvertArray #####################################################
|
|
||||||
ConvertArray()
|
|
||||||
{
|
|
||||||
#####################
|
|
||||||
# Read in the array #
|
|
||||||
#####################
|
|
||||||
ARRAY=("$@")
|
|
||||||
|
|
||||||
###################################################
|
|
||||||
# Convert the array into a space seperated string #
|
|
||||||
###################################################
|
|
||||||
STRING=$(IFS=$' '; echo "${ARRAY[*]}" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to create string!"
|
|
||||||
echo "ERROR:[$STRING]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
# Need to remove whitespace on the edges #
|
|
||||||
##########################################
|
|
||||||
CLEANED_STRING=$(echo "$STRING" | xargs 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Error
|
|
||||||
echo "ERROR! Failed to clean string!"
|
|
||||||
echo "ERROR:[$STRING]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
############################################################
|
|
||||||
# Echo the cleaned string back to the master function call #
|
|
||||||
############################################################
|
|
||||||
echo "$CLEANED_STRING"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function Footer ###########################################################
|
|
||||||
Footer()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "The script has completed"
|
|
||||||
echo "---------------------------"
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
############################### MAIN ###########################################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Header #
|
|
||||||
##########
|
|
||||||
Header
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install APT packages #
|
|
||||||
########################
|
|
||||||
InstallAptPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install PIP packages #
|
|
||||||
########################
|
|
||||||
InstallPipPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install GEM packages #
|
|
||||||
########################
|
|
||||||
InstallGemPackages
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Install NPM packages #
|
|
||||||
########################
|
|
||||||
InstallNPMPackages
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Footer #
|
|
||||||
##########
|
|
||||||
Footer
|
|
|
@ -1,527 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########### Markup and Markdown Language Linter @AdmiralAwkbar #################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
###########
|
|
||||||
# GLOBALS #
|
|
||||||
###########
|
|
||||||
YAML_LINTER_RULES='.automation/yaml-linter-rules.yml' # Path to the yaml lint rules
|
|
||||||
MD_LINTER_RULES='.automation/md-linter-rules.yml' # Path to the markdown lint rules
|
|
||||||
|
|
||||||
############
|
|
||||||
# Counters #
|
|
||||||
############
|
|
||||||
ERRORS_FOUND_YML=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_JSON=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_XML=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_MD=0 # Count of errors found
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########################## FUNCTIONS BELOW #####################################
|
|
||||||
################################################################################
|
|
||||||
################################################################################
|
|
||||||
#### Function Header ###########################################################
|
|
||||||
Header()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------------------------"
|
|
||||||
echo "---- Markup and Markdown Language Linter ----"
|
|
||||||
echo "---------------------------------------------"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function GetLinterRules ###################################################
|
|
||||||
GetLinterRules()
|
|
||||||
{
|
|
||||||
# Need to validate the rules files exist
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
# Validate we have the linter rules #
|
|
||||||
#####################################
|
|
||||||
if [ ! -f "$YAML_LINTER_RULES" ]; then
|
|
||||||
echo "ERROR! Failed to find:[$YAML_LINTER_RULES] in root of code base!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
# Validate we have the linter rules #
|
|
||||||
#####################################
|
|
||||||
if [ ! -f "$MD_LINTER_RULES" ]; then
|
|
||||||
echo "ERROR! Failed to find:[$MD_LINTER_RULES] in root of code base!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintJsonFiles ####################################################
|
|
||||||
LintJsonFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting JSON files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="jsonlint-php"
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate we have yamllint installed #
|
|
||||||
#######################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find [$LINTER_NAME] in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.json" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
#####################
|
|
||||||
# Get the file name #
|
|
||||||
#####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# This is a node modules file
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_JSON++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintYmlFiles #####################################################
|
|
||||||
LintYmlFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting YAML files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="yamllint"
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate we have yamllint installed #
|
|
||||||
#######################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find [$LINTER_NAME] in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f \( -name "*.yml" -or -name "*.yaml" \) 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
#####################
|
|
||||||
# Get the file name #
|
|
||||||
#####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" "$YAML_LINTER_RULES" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_YML++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintXmlFiles #####################################################
|
|
||||||
LintXmlFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting XML files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="xmllint"
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate we have yamllint installed #
|
|
||||||
#######################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find [$LINTER_NAME] in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.xml" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
#####################
|
|
||||||
# Get the file name #
|
|
||||||
#####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_XML++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintMdFiles ######################################################
|
|
||||||
LintMdFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Markdown files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="markdownlint"
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate we have yamllint installed #
|
|
||||||
#######################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find [$LINTER_NAME] in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.md" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
#####################
|
|
||||||
# Get the file name #
|
|
||||||
#####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" -c "$MD_LINTER_RULES" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_MD++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function Footer ###########################################################
|
|
||||||
Footer()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "The script has completed"
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "ERRORS FOUND in YAML:[$ERRORS_FOUND_YML]"
|
|
||||||
echo "ERRORS FOUND in JSON:[$ERRORS_FOUND_JSON]"
|
|
||||||
echo "ERRORS FOUND in XML:[$ERRORS_FOUND_XML]"
|
|
||||||
echo "ERRORS FOUND IN MD:[$ERRORS_FOUND_MD]"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Exit with 1 if errors found #
|
|
||||||
###############################
|
|
||||||
if [ $ERRORS_FOUND_YML -ne 0 ] || [ $ERRORS_FOUND_JSON -ne 0 ] || [ $ERRORS_FOUND_XML -ne 0 ] || [ $ERRORS_FOUND_MD -ne 0 ]; then
|
|
||||||
# Failed exit
|
|
||||||
echo "Exiting with errors found!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Successful exit
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
############################### MAIN ###########################################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Header #
|
|
||||||
##########
|
|
||||||
Header
|
|
||||||
|
|
||||||
########################
|
|
||||||
# Get the linter rules #
|
|
||||||
########################
|
|
||||||
GetLinterRules
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Lint the Yml Files #
|
|
||||||
######################
|
|
||||||
LintYmlFiles
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Lint the json files #
|
|
||||||
#######################
|
|
||||||
LintJsonFiles
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Lint the XML Files #
|
|
||||||
######################
|
|
||||||
LintXmlFiles
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# Lint the Markdown Files #
|
|
||||||
###########################
|
|
||||||
LintMdFiles
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Footer #
|
|
||||||
##########
|
|
||||||
Footer
|
|
|
@ -1,504 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
################## Scripting Language Linter @admiralawkbar ####################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
###########
|
|
||||||
# GLOBALS #
|
|
||||||
###########
|
|
||||||
PYTHON_LINTER_FILE=".automation/pylintrc" # Name of the Linter file
|
|
||||||
RUBY_LINTER_FILE=".automation/.rubocop.yml" # Name of the Linter file
|
|
||||||
|
|
||||||
############
|
|
||||||
# Counters #
|
|
||||||
############
|
|
||||||
ERRORS_FOUND_BASH=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PERL=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
########################## FUNCTIONS BELOW #####################################
|
|
||||||
################################################################################
|
|
||||||
################################################################################
|
|
||||||
#### Function Header ###########################################################
|
|
||||||
Header()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "-----------------------------------"
|
|
||||||
echo "---- Scripting Language Linter ----"
|
|
||||||
echo "-----------------------------------"
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintBashFiles ####################################################
|
|
||||||
LintBashFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Bash files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="shellcheck"
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Validate we have shellcheck installed #
|
|
||||||
#########################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find $LINTER_NAME in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.sh" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Get the filename #
|
|
||||||
####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_BASH++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintPythonFiles ##################################################
|
|
||||||
LintPythonFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Python files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="pylint"
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
# Validate we have pylint installed #
|
|
||||||
#####################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find $LINTER_NAME in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.py" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Get the filename #
|
|
||||||
####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" --rcfile "$PYTHON_LINTER_FILE" -E "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_PYTHON++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintPerlFiles ####################################################
|
|
||||||
LintPerlFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Perl files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="perl"
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Validate we have perl installed #
|
|
||||||
###################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find $LINTER_NAME in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.pl" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Get the filename #
|
|
||||||
####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" -Mstrict -cw "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_PERL++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function LintRubyFiles ####################################################
|
|
||||||
LintRubyFiles()
|
|
||||||
{
|
|
||||||
################
|
|
||||||
# print header #
|
|
||||||
################
|
|
||||||
echo ""
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo "Linting Ruby files..."
|
|
||||||
echo "--------------------------------"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
######################
|
|
||||||
# Name of the linter #
|
|
||||||
######################
|
|
||||||
LINTER_NAME="rubocop"
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Validate we have perl installed #
|
|
||||||
###################################
|
|
||||||
# shellcheck disable=SC2230
|
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
# Failed
|
|
||||||
echo "ERROR! Failed to find $LINTER_NAME in system!"
|
|
||||||
echo "ERROR:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Success
|
|
||||||
echo "Successfully found binary in system"
|
|
||||||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Get list of all files to lint #
|
|
||||||
#################################
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
LIST_FILES=($(find . -type f -name "*.rb" 2>&1))
|
|
||||||
|
|
||||||
##################
|
|
||||||
# Lint the files #
|
|
||||||
##################
|
|
||||||
for FILE in "${LIST_FILES[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Make sure we dont lint node modules #
|
|
||||||
#######################################
|
|
||||||
# if [[ $FILE == *"node_modules"* ]]; then
|
|
||||||
# # This is a node modules file
|
|
||||||
# continue
|
|
||||||
# fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Get the filename #
|
|
||||||
####################
|
|
||||||
FILE_NAME=$(basename "$FILE" 2>&1)
|
|
||||||
|
|
||||||
##############
|
|
||||||
# File print #
|
|
||||||
##############
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "File:[$FILE]"
|
|
||||||
|
|
||||||
################################
|
|
||||||
# Lint the file with the rules #
|
|
||||||
################################
|
|
||||||
LINT_CMD=$("$LINTER_NAME" -c "$RUBY_LINTER_FILE" "$FILE" 2>&1)
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Load the error code #
|
|
||||||
#######################
|
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Check the shell for errors #
|
|
||||||
##############################
|
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
|
||||||
#########
|
|
||||||
# Error #
|
|
||||||
#########
|
|
||||||
echo "ERROR! Found errors in [$LINTER_NAME] linter!"
|
|
||||||
echo "ERROR:[$LINT_CMD]"
|
|
||||||
# Increment error count
|
|
||||||
((ERRORS_FOUND_RUBY++))
|
|
||||||
else
|
|
||||||
###########
|
|
||||||
# Success #
|
|
||||||
###########
|
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
#### Function Footer ###########################################################
|
|
||||||
Footer()
|
|
||||||
{
|
|
||||||
echo ""
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "The script has completed"
|
|
||||||
echo "---------------------------"
|
|
||||||
echo "ERRORS FOUND in BASH:[$ERRORS_FOUND_BASH]"
|
|
||||||
echo "ERRORS FOUND in PERL:[$ERRORS_FOUND_PERL]"
|
|
||||||
echo "ERRORS FOUND in PYTHON:[$ERRORS_FOUND_PYTHON]"
|
|
||||||
echo "ERRORS FOUND in RUBY:[$ERRORS_FOUND_RUBY]"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Exit with 1 if errors found #
|
|
||||||
###############################
|
|
||||||
if [ $ERRORS_FOUND_BASH -ne 0 ] || [ $ERRORS_FOUND_PERL -ne 0 ] || [ $ERRORS_FOUND_PYTHON -ne 0 ] || [ $ERRORS_FOUND_RUBY -ne 0 ]; then
|
|
||||||
# Failed exit
|
|
||||||
echo "Exiting with errors found!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Successful exit
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
################################################################################
|
|
||||||
############################### MAIN ###########################################
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Header #
|
|
||||||
##########
|
|
||||||
Header
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Lint the bash files #
|
|
||||||
#######################
|
|
||||||
LintBashFiles
|
|
||||||
|
|
||||||
#########################
|
|
||||||
# Lint the python files #
|
|
||||||
#########################
|
|
||||||
LintPythonFiles
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Lint the perl files #
|
|
||||||
#######################
|
|
||||||
LintPerlFiles
|
|
||||||
|
|
||||||
#######################
|
|
||||||
# Lint the ruby files #
|
|
||||||
#######################
|
|
||||||
LintRubyFiles
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Footer #
|
|
||||||
##########
|
|
||||||
Footer
|
|
135
.github/linters/.coffee-lint.json
vendored
Normal file
135
.github/linters/.coffee-lint.json
vendored
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
{
|
||||||
|
"arrow_spacing": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"braces_spacing": {
|
||||||
|
"level": "ignore",
|
||||||
|
"spaces": 0,
|
||||||
|
"empty_object_spaces": 0
|
||||||
|
},
|
||||||
|
"camel_case_classes": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"coffeescript_error": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"colon_assignment_spacing": {
|
||||||
|
"level": "ignore",
|
||||||
|
"spacing": {
|
||||||
|
"left": 0,
|
||||||
|
"right": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cyclomatic_complexity": {
|
||||||
|
"level": "ignore",
|
||||||
|
"value": 10
|
||||||
|
},
|
||||||
|
"duplicate_key": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"empty_constructor_needs_parens": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"ensure_comprehensions": {
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"eol_last": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"indentation": {
|
||||||
|
"value": 2,
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"line_endings": {
|
||||||
|
"level": "ignore",
|
||||||
|
"value": "unix"
|
||||||
|
},
|
||||||
|
"max_line_length": {
|
||||||
|
"value": 80,
|
||||||
|
"level": "ignore",
|
||||||
|
"limitComments": true
|
||||||
|
},
|
||||||
|
"missing_fat_arrows": {
|
||||||
|
"level": "ignore",
|
||||||
|
"is_strict": false
|
||||||
|
},
|
||||||
|
"newlines_after_classes": {
|
||||||
|
"value": 3,
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_backticks": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_debugger": {
|
||||||
|
"level": "warn",
|
||||||
|
"console": false
|
||||||
|
},
|
||||||
|
"no_empty_functions": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_empty_param_list": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_implicit_braces": {
|
||||||
|
"level": "ignore",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"no_implicit_parens": {
|
||||||
|
"level": "ignore",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"no_interpolation_in_single_quotes": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_nested_string_interpolation": {
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"no_plusplus": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_private_function_fat_arrows": {
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"no_stand_alone_at": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_tabs": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_this": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_throwing_strings": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_trailing_semicolons": {
|
||||||
|
"level": "error"
|
||||||
|
},
|
||||||
|
"no_trailing_whitespace": {
|
||||||
|
"level": "ignore",
|
||||||
|
"allowed_in_comments": false,
|
||||||
|
"allowed_in_empty_lines": true
|
||||||
|
},
|
||||||
|
"no_unnecessary_double_quotes": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"no_unnecessary_fat_arrows": {
|
||||||
|
"level": "warn"
|
||||||
|
},
|
||||||
|
"non_empty_constructor_needs_parens": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"prefer_english_operator": {
|
||||||
|
"level": "ignore",
|
||||||
|
"doubleNotLevel": "ignore"
|
||||||
|
},
|
||||||
|
"space_operators": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"spacing_after_comma": {
|
||||||
|
"level": "ignore"
|
||||||
|
},
|
||||||
|
"transform_messes_up_line_numbers": {
|
||||||
|
"level": "warn"
|
||||||
|
}
|
||||||
|
}
|
56
.github/workflows/stack-linter.yml
vendored
56
.github/workflows/stack-linter.yml
vendored
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
#############################
|
############################
|
||||||
#############################
|
############################
|
||||||
## CI/CT/CD GitHub Actions ##
|
## Preflight Stack Linter ##
|
||||||
#############################
|
############################
|
||||||
#############################
|
############################
|
||||||
name: Source Linter
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Documentation:
|
# Documentation:
|
||||||
|
@ -14,7 +13,7 @@ name: Source Linter
|
||||||
#############################
|
#############################
|
||||||
# Start the job on all push #
|
# Start the job on all push #
|
||||||
#############################
|
#############################
|
||||||
on: ['push']
|
on: ["push"]
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Set the Job #
|
# Set the Job #
|
||||||
|
@ -22,7 +21,7 @@ on: ['push']
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# Name the Job
|
# Name the Job
|
||||||
name: Source linter
|
name: Stack linter
|
||||||
# Set the agent to run on
|
# Set the agent to run on
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
##################
|
##################
|
||||||
|
@ -35,39 +34,8 @@ jobs:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
|
|
||||||
#####################
|
################################
|
||||||
# Install Ruby Libs #
|
# Run Linter against code base #
|
||||||
#####################
|
################################
|
||||||
- name: Set up Ruby
|
- name: Lint Code Base
|
||||||
uses: actions/setup-ruby@master
|
uses: docker://admiralawkbar/super-linter:latest
|
||||||
with:
|
|
||||||
ruby-version: 2.6.x
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Install NPM Libs #
|
|
||||||
####################
|
|
||||||
- name: Setup NPM
|
|
||||||
uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
node-version: 10.x
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# Install all base dependancies #
|
|
||||||
#################################
|
|
||||||
- name: Install Dependencies
|
|
||||||
shell: bash
|
|
||||||
run: ./.automation/install-deps.sh
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Run the markup and markdown linter script #
|
|
||||||
#############################################
|
|
||||||
- name: Run Markup and Markdown Linter
|
|
||||||
shell: bash
|
|
||||||
run: ./.automation/markup-markdown-linter.sh
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Run the scripting linter script #
|
|
||||||
###################################
|
|
||||||
- name: Run Scripting Linter
|
|
||||||
shell: bash
|
|
||||||
run: ./.automation/scripting-linter.sh
|
|
||||||
|
|
|
@ -18,15 +18,14 @@ Developers on **GitHub** can call this Action to lint their code base with the f
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
To use this **GitHub** Action you will need to complete the following:
|
To use this **GitHub** Action you will need to complete the following:
|
||||||
- Copy **any** or **all** template rules files `TEMPLATES/` to your repository in the location: `.github/`
|
- Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/`
|
||||||
- If your repository does not have rules files, they will fall back to defaults
|
- If your repository does not have rules files, they will fall back to defaults in this repositories `TEMPLATE` folder
|
||||||
- Validate all variables are correct and allow for proper permissions on **AWS**
|
|
||||||
- Add the **Github** Action: **Super-Linter** to your current **Github** Actions workflow
|
- Add the **Github** Action: **Super-Linter** to your current **Github** Actions workflow
|
||||||
- Enjoy your more stable, and cleaner code base
|
- Enjoy your more stable, and cleaner code base
|
||||||
|
|
||||||
### Example GitHub Action Workflow
|
### Example connecting GitHub Action Workflow
|
||||||
|
|
||||||
In your repository you should have a `workflows` folder similar to below:
|
In your repository you should have a `workflows` folder with **GitHub** Action similar to below:
|
||||||
|
|
||||||
- `.github/workflows/linter.yml`
|
- `.github/workflows/linter.yml`
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$YAML_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$YAML_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$YAML_FILE_NAME], setting rules file..."
|
echo "User provided file:[$YAML_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$YAML_FILE_NAME" "$YAML_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$YAML_FILE_NAME" "$YAML_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -106,13 +106,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$MD_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$MD_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$MD_FILE_NAME], setting rules file..."
|
echo "User provided file:[$MD_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$MD_FILE_NAME" "$MD_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$MD_FILE_NAME" "$MD_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -134,13 +134,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$PYTHON_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$PYTHON_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$PYTHON_FILE_NAME], setting rules file..."
|
echo "User provided file:[$PYTHON_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$PYTHON_FILE_NAME" "$PYTHON_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$PYTHON_FILE_NAME" "$PYTHON_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -162,13 +162,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$RUBY_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$RUBY_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$RUBY_FILE_NAME], setting rules file..."
|
echo "User provided file:[$RUBY_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$RUBY_FILE_NAME" "$RUBY_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$RUBY_FILE_NAME" "$RUBY_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -190,13 +190,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$COFFEE_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$COFFEE_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$COFFEE_FILE_NAME], setting rules file..."
|
echo "User provided file:[$COFFEE_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$COFFEE_FILE_NAME" "$COFFEE_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$COFFEE_FILE_NAME" "$COFFEE_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -218,13 +218,13 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ -f "$GITHUB_WORKSPACE/.github/$ANSIBLE_FILE_NAME" ]; then
|
if [ -f "$GITHUB_WORKSPACE/.github/linters/$ANSIBLE_FILE_NAME" ]; then
|
||||||
echo "User provided file:[$ANSIBLE_FILE_NAME], setting rules file..."
|
echo "User provided file:[$ANSIBLE_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Move users into default location #
|
# Move users into default location #
|
||||||
####################################
|
####################################
|
||||||
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$ANSIBLE_FILE_NAME" "$ANSIBLE_LINTER_RULES" 2>&1)
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/linters/$ANSIBLE_FILE_NAME" "$ANSIBLE_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Load Error code #
|
# Load Error code #
|
||||||
|
@ -265,7 +265,7 @@ LintJsonFiles()
|
||||||
# Validate we have yamllint installed #
|
# Validate we have yamllint installed #
|
||||||
#######################################
|
#######################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -290,7 +290,7 @@ LintJsonFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.json" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.json" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -367,7 +367,7 @@ LintYmlFiles()
|
||||||
# Validate we have yamllint installed #
|
# Validate we have yamllint installed #
|
||||||
#######################################
|
#######################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -392,7 +392,7 @@ LintYmlFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f \( -name "*.yml" -or -name "*.yaml" \) 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f \( -name "*.yml" -or -name "*.yaml" \) 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -469,7 +469,7 @@ LintXmlFiles()
|
||||||
# Validate we have yamllint installed #
|
# Validate we have yamllint installed #
|
||||||
#######################################
|
#######################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -494,7 +494,7 @@ LintXmlFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.xml" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.xml" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -571,7 +571,7 @@ LintMdFiles()
|
||||||
# Validate we have yamllint installed #
|
# Validate we have yamllint installed #
|
||||||
#######################################
|
#######################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -596,7 +596,7 @@ LintMdFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.md" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.md" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -673,7 +673,7 @@ LintBashFiles()
|
||||||
# Validate we have shellcheck installed #
|
# Validate we have shellcheck installed #
|
||||||
#########################################
|
#########################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -698,7 +698,7 @@ LintBashFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.sh" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.sh" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -776,7 +776,7 @@ LintPythonFiles()
|
||||||
# Validate we have pylint installed #
|
# Validate we have pylint installed #
|
||||||
#####################################
|
#####################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -801,7 +801,7 @@ LintPythonFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.py" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.py" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -879,7 +879,7 @@ LintPerlFiles()
|
||||||
# Validate we have perl installed #
|
# Validate we have perl installed #
|
||||||
###################################
|
###################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -904,7 +904,7 @@ LintPerlFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.pl" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.pl" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -982,7 +982,7 @@ LintRubyFiles()
|
||||||
# Validate we have perl installed #
|
# Validate we have perl installed #
|
||||||
###################################
|
###################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -1007,7 +1007,7 @@ LintRubyFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.rb" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.rb" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -1085,7 +1085,7 @@ LintCoffeeFiles()
|
||||||
# Validate we have pylint installed #
|
# Validate we have pylint installed #
|
||||||
#####################################
|
#####################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -1110,7 +1110,7 @@ LintCoffeeFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.coffee" 2>&1))
|
LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -name "*.coffee" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -1271,7 +1271,7 @@ LintAnsibleFiles()
|
||||||
# Validate we have ansible-lint installed #
|
# Validate we have ansible-lint installed #
|
||||||
###########################################
|
###########################################
|
||||||
# shellcheck disable=SC2230
|
# shellcheck disable=SC2230
|
||||||
VALIDATE_INSTALL_CMD=$(which "$LINTER_NAME" 2>&1)
|
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -1299,7 +1299,7 @@ LintAnsibleFiles()
|
||||||
#################################
|
#################################
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2164,SC2010
|
# shellcheck disable=SC2164,SC2010,SC2207
|
||||||
LIST_FILES=($(cd "$ANSIBLE_DIR"; ls -I vault.yml -I galaxy.yml | grep ".yml" 2>&1))
|
LIST_FILES=($(cd "$ANSIBLE_DIR"; ls -I vault.yml -I galaxy.yml | grep ".yml" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
|
Loading…
Reference in a new issue