mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 02:01:02 -05:00
cleaning
This commit is contained in:
parent
9967630273
commit
91f6a0fa23
2 changed files with 289 additions and 62 deletions
22
Dockerfile
22
Dockerfile
|
@ -22,17 +22,11 @@ LABEL com.github.actions.name="GitHub Super-Linter" \
|
||||||
# Run APK installs #
|
# Run APK installs #
|
||||||
####################
|
####################
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
bash git musl-dev curl gcc cabal \
|
bash git musl-dev curl gcc \
|
||||||
npm nodejs \
|
npm nodejs \
|
||||||
libxml2-utils \
|
libxml2-utils \
|
||||||
ruby ruby-bundler \
|
ruby ruby-bundler \
|
||||||
py3-setuptools
|
py3-setuptools ansible-lint
|
||||||
|
|
||||||
####################
|
|
||||||
# Run Pip installs #
|
|
||||||
####################
|
|
||||||
RUN pip install --upgrade --no-cache-dir \
|
|
||||||
pip ansible-lint
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Run Pip3 Installs #
|
# Run Pip3 Installs #
|
||||||
|
@ -43,13 +37,14 @@ RUN pip3 install --upgrade --no-cache-dir \
|
||||||
####################
|
####################
|
||||||
# Run NPM Installs #
|
# Run NPM Installs #
|
||||||
####################
|
####################
|
||||||
RUN npm -g install markdownlint-cli jsonlint prettyjson
|
RUN npm -g install \
|
||||||
|
markdownlint-cli jsonlint prettyjson
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Run Cabal installs #
|
# Install shellcheck #
|
||||||
######################
|
######################
|
||||||
RUN cabal update \
|
RUN wget -qO- "https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv \
|
||||||
&& cabal install ShellCheck
|
&& cp "shellcheck-stable/shellcheck" /usr/bin/
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Load GitHub Env Vars for Github Actions #
|
# Load GitHub Env Vars for Github Actions #
|
||||||
|
@ -61,7 +56,8 @@ ENV GITHUB_WORKSPACE=${GITHUB_WORKSPACE}
|
||||||
###########################
|
###########################
|
||||||
# Copy files to container #
|
# Copy files to container #
|
||||||
###########################
|
###########################
|
||||||
COPY lib /action/lib
|
COPY lib /action/lib \
|
||||||
|
&& TEMPLATES /action/lib/.automation
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Set the entrypoint #
|
# Set the entrypoint #
|
||||||
|
|
317
lib/entrypoint.sh
Normal file → Executable file
317
lib/entrypoint.sh
Normal file → Executable file
|
@ -7,11 +7,30 @@
|
||||||
###########
|
###########
|
||||||
# GLOBALS #
|
# GLOBALS #
|
||||||
###########
|
###########
|
||||||
YAML_LINTER_RULES='.automation/yaml-linter-rules.yml' # Path to the yaml lint rules
|
# Default Vars
|
||||||
MD_LINTER_RULES='.automation/md-linter-rules.yml' # Path to the markdown lint rules
|
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||||
PYTHON_LINTER_FILE=".automation/pylintrc" # Name of the Linter file
|
# YAML Vars
|
||||||
RUBY_LINTER_FILE=".automation/.rubocop.yml" # Name of the Linter file
|
YAML_FILE_NAME='yaml-linter-rules.yml' # Name of the file
|
||||||
COFFEE_LINTER_FILE="Automation/coffeelint.json" # name of the Linter file
|
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
|
||||||
|
# MD Vars
|
||||||
|
MD_FILE_NAME='md-linter-rules.yml' # Name of the file
|
||||||
|
MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to the markdown lint rules
|
||||||
|
# Python Vars
|
||||||
|
PYTHON_FILE_NAME='pylint.rc' # Name of the file
|
||||||
|
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
||||||
|
# Ruby Vars
|
||||||
|
RUBY_FILE_NAME='.rubocop.yml' # Name of the file
|
||||||
|
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
||||||
|
# Coffee Vars
|
||||||
|
COFFEE_FILE_NAME='coffeelint.json' # Name of the file
|
||||||
|
COFFEE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffescript lint rules
|
||||||
|
|
||||||
|
###################
|
||||||
|
# GitHub ENV Vars #
|
||||||
|
###################
|
||||||
|
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||||
|
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||||
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||||
|
|
||||||
############
|
############
|
||||||
# Counters #
|
# Counters #
|
||||||
|
@ -20,13 +39,12 @@ ERRORS_FOUND_YML=0 # Count of errors found
|
||||||
ERRORS_FOUND_JSON=0 # Count of errors found
|
ERRORS_FOUND_JSON=0 # Count of errors found
|
||||||
ERRORS_FOUND_XML=0 # Count of errors found
|
ERRORS_FOUND_XML=0 # Count of errors found
|
||||||
ERRORS_FOUND_MD=0 # Count of errors found
|
ERRORS_FOUND_MD=0 # Count of errors found
|
||||||
|
|
||||||
ERRORS_FOUND_BASH=0 # Count of errors found
|
ERRORS_FOUND_BASH=0 # Count of errors found
|
||||||
ERRORS_FOUND_PERL=0 # Count of errors found
|
ERRORS_FOUND_PERL=0 # Count of errors found
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||||
|
|
||||||
ERRORS_FOUND_COFFEE=0 # Count of errors found
|
ERRORS_FOUND_COFFEE=0 # Count of errors found
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -36,7 +54,7 @@ Header()
|
||||||
{
|
{
|
||||||
echo ""
|
echo ""
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo "---- Markup and Markdown Language Linter ----"
|
echo "------ Github Actions Language Linter -------"
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
@ -49,18 +67,132 @@ GetLinterRules()
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ ! -f "$YAML_LINTER_RULES" ]; then
|
if [ -s "$GITHUB_WORKSPACE/.github/$YAML_FILE_NAME" ]; then
|
||||||
echo "ERROR! Failed to find:[$YAML_LINTER_RULES] in root of code base!"
|
echo "User provided file:[$YAML_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Move users into default location #
|
||||||
|
####################################
|
||||||
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$YAML_FILE_NAME" "$YAML_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Load Error code #
|
||||||
|
###################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
|
echo "ERROR! Failed to set file:[$YAML_FILE_NAME] as default!"
|
||||||
|
echo "ERROR:[$MV_CMD]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
if [ ! -f "$MD_LINTER_RULES" ]; then
|
if [ -s "$GITHUB_WORKSPACE/.github/$MD_FILE_NAME" ]; then
|
||||||
echo "ERROR! Failed to find:[$MD_LINTER_RULES] in root of code base!"
|
echo "User provided file:[$MD_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Move users into default location #
|
||||||
|
####################################
|
||||||
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$MD_FILE_NAME" "$MD_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Load Error code #
|
||||||
|
###################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
|
echo "ERROR! Failed to set file:[$MD_FILE_NAME] as default!"
|
||||||
|
echo "ERROR:[$MV_CMD]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Validate we have the linter rules #
|
||||||
|
#####################################
|
||||||
|
if [ -s "$GITHUB_WORKSPACE/.github/$PYTHON_FILE_NAME" ]; then
|
||||||
|
echo "User provided file:[$PYTHON_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Move users into default location #
|
||||||
|
####################################
|
||||||
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$PYTHON_FILE_NAME" "$PYTHON_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Load Error code #
|
||||||
|
###################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
|
echo "ERROR! Failed to set file:[$MD_FILE_NAME] as default!"
|
||||||
|
echo "ERROR:[$MV_CMD]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Validate we have the linter rules #
|
||||||
|
#####################################
|
||||||
|
if [ -s "$GITHUB_WORKSPACE/.github/$RUBY_FILE_NAME" ]; then
|
||||||
|
echo "User provided file:[$RUBY_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Move users into default location #
|
||||||
|
####################################
|
||||||
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$RUBY_FILE_NAME" "$RUBY_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Load Error code #
|
||||||
|
###################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
|
echo "ERROR! Failed to set file:[$RUBY_FILE_NAME] as default!"
|
||||||
|
echo "ERROR:[$MV_CMD]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Validate we have the linter rules #
|
||||||
|
#####################################
|
||||||
|
if [ -s "$GITHUB_WORKSPACE/.github/$COFFEE_FILE_NAME" ]; then
|
||||||
|
echo "User provided file:[$COFFEE_FILE_NAME], setting rules file..."
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Move users into default location #
|
||||||
|
####################################
|
||||||
|
MV_CMD=$(mv "$GITHUB_WORKSPACE/.github/$COFFEE_FILE_NAME" "$COFFEE_LINTER_RULES" 2>&1)
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Load Error code #
|
||||||
|
###################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ $ERROR_CODE -ne 0 ]; then
|
||||||
|
echo "ERROR! Failed to set file:[$COFFEE_FILE_NAME] as default!"
|
||||||
|
echo "ERROR:[$MV_CMD]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function LintJsonFiles ####################################################
|
#### Function LintJsonFiles ####################################################
|
||||||
|
@ -70,9 +202,9 @@ LintJsonFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting JSON files..."
|
echo "Linting JSON files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -109,7 +241,7 @@ LintJsonFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.json" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.json" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -172,9 +304,9 @@ LintYmlFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting YAML files..."
|
echo "Linting YAML files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -211,7 +343,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 . -type f \( -name "*.yml" -or -name "*.yaml" \) 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f \( -name "*.yml" -or -name "*.yaml" \) 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -274,9 +406,9 @@ LintXmlFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting XML files..."
|
echo "Linting XML files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -313,7 +445,7 @@ LintXmlFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.xml" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.xml" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -376,9 +508,9 @@ LintMdFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Markdown files..."
|
echo "Linting Markdown files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -415,7 +547,7 @@ LintMdFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.md" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.md" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -478,9 +610,9 @@ LintBashFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Bash files..."
|
echo "Linting Bash files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -517,7 +649,7 @@ LintBashFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.sh" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.sh" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -581,9 +713,9 @@ LintPythonFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Python files..."
|
echo "Linting Python files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -620,7 +752,7 @@ LintPythonFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.py" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.py" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -650,7 +782,7 @@ LintPythonFiles()
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
LINT_CMD=$("$LINTER_NAME" --rcfile "$PYTHON_LINTER_FILE" -E "$FILE" 2>&1)
|
LINT_CMD=$("$LINTER_NAME" --rcfile "$PYTHON_LINTER_RULES" -E "$FILE" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -684,9 +816,9 @@ LintPerlFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Perl files..."
|
echo "Linting Perl files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -723,7 +855,7 @@ LintPerlFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.pl" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.pl" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -787,9 +919,9 @@ LintRubyFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Ruby files..."
|
echo "Linting Ruby files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -826,7 +958,7 @@ LintRubyFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.rb" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.rb" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -856,7 +988,7 @@ LintRubyFiles()
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
LINT_CMD=$("$LINTER_NAME" -c "$RUBY_LINTER_FILE" "$FILE" 2>&1)
|
LINT_CMD=$("$LINTER_NAME" -c "$RUBY_LINTER_RULES" "$FILE" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -890,9 +1022,9 @@ LintCoffeeFiles()
|
||||||
# print header #
|
# print header #
|
||||||
################
|
################
|
||||||
echo ""
|
echo ""
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Linting Coffee files..."
|
echo "Linting Coffee files..."
|
||||||
echo "--------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -929,7 +1061,7 @@ LintCoffeeFiles()
|
||||||
# Get list of all files to lint #
|
# Get list of all files to lint #
|
||||||
#################################
|
#################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
LIST_FILES=($(find . -type f -name "*.coffee" 2>&1))
|
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.coffee" 2>&1))
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
|
@ -959,7 +1091,7 @@ LintCoffeeFiles()
|
||||||
################################
|
################################
|
||||||
# Lint the file with the rules #
|
# Lint the file with the rules #
|
||||||
################################
|
################################
|
||||||
LINT_CMD=$("$LINTER_NAME" -f "$COFFEE_LINTER_FILE" "$FILE" 2>&1)
|
LINT_CMD=$("$LINTER_NAME" -f "$COFFEE_LINTER_RULES" "$FILE" 2>&1)
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Load the error code #
|
# Load the error code #
|
||||||
|
@ -986,6 +1118,87 @@ LintCoffeeFiles()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
|
#### Function GetGitHubVars ####################################################
|
||||||
|
GetGitHubVars()
|
||||||
|
{
|
||||||
|
##########
|
||||||
|
# Prints #
|
||||||
|
##########
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
echo "Gathering GitHub information..."
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_SHA" ]; then
|
||||||
|
echo "ERROR! Failed to get [GITHUB_SHA]!"
|
||||||
|
echo "ERROR:[$GITHUB_SHA]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Successfully found:[GITHUB_SHA]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_WORKSPACE" ]; then
|
||||||
|
echo "ERROR! Failed to get [GITHUB_WORKSPACE]!"
|
||||||
|
echo "ERROR:[$GITHUB_WORKSPACE]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Successfully found:[GITHUB_WORKSPACE]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_EVENT_PATH" ]; then
|
||||||
|
echo "ERROR! Failed to get [GITHUB_EVENT_PATH]!"
|
||||||
|
echo "ERROR:[$GITHUB_EVENT_PATH]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Successfully found:[GITHUB_EVENT_PATH]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Need to pull the GitHub Vars from the env file #
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
######################
|
||||||
|
# Get the GitHub Org #
|
||||||
|
######################
|
||||||
|
# shellcheck disable=SC2002
|
||||||
|
GITHUB_ORG=$(cat "$GITHUB_EVENT_PATH" | jq -r '.repository.owner.login' )
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_ORG" ]; then
|
||||||
|
echo "ERROR! Failed to get [GITHUB_ORG]!"
|
||||||
|
echo "ERROR:[$GITHUB_ORG]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Successfully found:[GITHUB_ORG]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Get the GitHub Repo #
|
||||||
|
#######################
|
||||||
|
# shellcheck disable=SC2002
|
||||||
|
GITHUB_REPO=$(cat "$GITHUB_EVENT_PATH"| jq -r '.repository.name' )
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_REPO" ]; then
|
||||||
|
echo "ERROR! Failed to get [GITHUB_REPO]!"
|
||||||
|
echo "ERROR:[$GITHUB_REPO]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Successfully found:[GITHUB_REPO]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Footer ###########################################################
|
||||||
Footer()
|
Footer()
|
||||||
{
|
{
|
||||||
|
@ -1006,7 +1219,14 @@ Footer()
|
||||||
###############################
|
###############################
|
||||||
# Exit with 1 if errors found #
|
# 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 ] || [ $ERRORS_FOUND_BASH -ne 0 ] || [ $ERRORS_FOUND_PERL -ne 0 ] || [ $ERRORS_FOUND_PYTHON -ne 0 ] || [ $ERRORS_FOUND_RUBY -ne 0 ]; then
|
if [ $ERRORS_FOUND_YML -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_JSON -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_XML -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_MD -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_BASH -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_PERL -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_PYTHON -ne 0 ] || \
|
||||||
|
[ $ERRORS_FOUND_RUBY -ne 0 ]; then
|
||||||
# Failed exit
|
# Failed exit
|
||||||
echo "Exiting with errors found!"
|
echo "Exiting with errors found!"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1024,11 +1244,22 @@ Footer()
|
||||||
##########
|
##########
|
||||||
Header
|
Header
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Get Github Env Vars #
|
||||||
|
#######################
|
||||||
|
# Need to pull in all the Github variables
|
||||||
|
# needed to connect back and update checks
|
||||||
|
GetGitHubVars
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# Get the linter rules #
|
# Get the linter rules #
|
||||||
########################
|
########################
|
||||||
GetLinterRules
|
GetLinterRules
|
||||||
|
|
||||||
|
######################
|
||||||
|
# Validate workspace #
|
||||||
|
######################
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Lint the Yml Files #
|
# Lint the Yml Files #
|
||||||
######################
|
######################
|
||||||
|
|
Loading…
Reference in a new issue