mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 21:50:59 -05:00
fixed code
This commit is contained in:
parent
518dca2ff4
commit
8371d35cb5
2 changed files with 114 additions and 77 deletions
13
Dockerfile
13
Dockerfile
|
@ -22,10 +22,10 @@ LABEL com.github.actions.name="GitHub Super-Linter" \
|
|||
# Run APK installs #
|
||||
####################
|
||||
RUN apk add --no-cache \
|
||||
bash git musl-dev curl gcc jq\
|
||||
bash git musl-dev curl gcc jq \
|
||||
npm nodejs \
|
||||
libxml2-utils perl \
|
||||
ruby ruby-bundler \
|
||||
ruby ruby-dev ruby-bundler ruby-rdoc make\
|
||||
py3-setuptools ansible-lint
|
||||
|
||||
#####################
|
||||
|
@ -38,7 +38,14 @@ RUN pip3 install --upgrade --no-cache-dir \
|
|||
# Run NPM Installs #
|
||||
####################
|
||||
RUN npm -g install \
|
||||
markdownlint-cli jsonlint prettyjson
|
||||
markdownlint-cli \
|
||||
jsonlint prettyjson \
|
||||
coffeelint
|
||||
|
||||
####################
|
||||
# Run GEM installs #
|
||||
####################
|
||||
RUN gem install rubocop
|
||||
|
||||
######################
|
||||
# Install shellcheck #
|
||||
|
|
|
@ -26,7 +26,7 @@ COFFEE_FILE_NAME='.coffee-lint.json' # Name of the fi
|
|||
COFFEE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffescript lint rules
|
||||
# Ansible Vars
|
||||
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
|
||||
ANSIBLE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffescript lint rules
|
||||
ANSIBLE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$ANSIBLE_FILE_NAME" # Path to the coffescript lint rules
|
||||
|
||||
###################
|
||||
# GitHub ENV Vars #
|
||||
|
@ -67,6 +67,13 @@ Header()
|
|||
GetLinterRules()
|
||||
{
|
||||
# Need to validate the rules files exist
|
||||
################
|
||||
# print header #
|
||||
################
|
||||
echo ""
|
||||
echo "----------------------------------------------"
|
||||
echo "Gathering Linter rules from repository, or defaulting..."
|
||||
echo ""
|
||||
|
||||
#####################################
|
||||
# Validate we have the linter rules #
|
||||
|
@ -92,6 +99,8 @@ GetLinterRules()
|
|||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$YAML_LINTER_RULES]"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
|
@ -118,6 +127,8 @@ GetLinterRules()
|
|||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$MD_LINTER_RULES]"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
|
@ -140,10 +151,12 @@ GetLinterRules()
|
|||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ $ERROR_CODE -ne 0 ]; then
|
||||
echo "ERROR! Failed to set file:[$MD_FILE_NAME] as default!"
|
||||
echo "ERROR! Failed to set file:[$PYTHON_FILE_NAME] as default!"
|
||||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$PYTHON_LINTER_RULES]"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
|
@ -170,6 +183,8 @@ GetLinterRules()
|
|||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$RUBY_LINTER_RULES]"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
|
@ -196,6 +211,8 @@ GetLinterRules()
|
|||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$COFFEE_LINTER_RULES]"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
|
@ -222,6 +239,8 @@ GetLinterRules()
|
|||
echo "ERROR:[$MV_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Using Default rules at:[$ANSIBLE_LINTER_RULES]"
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
|
@ -271,7 +290,7 @@ LintJsonFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.json" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.json" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -475,7 +494,7 @@ LintXmlFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.xml" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.xml" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -577,7 +596,7 @@ LintMdFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.md" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.md" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -679,7 +698,7 @@ LintBashFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.sh" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.sh" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -782,7 +801,7 @@ LintPythonFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.py" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.py" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -885,7 +904,7 @@ LintPerlFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.pl" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.pl" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -988,7 +1007,7 @@ LintRubyFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.rb" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.rb" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -1091,7 +1110,7 @@ LintCoffeeFiles()
|
|||
# Get list of all files to lint #
|
||||
#################################
|
||||
# shellcheck disable=SC2207
|
||||
LIST_FILES=($(find "$GITHUB_WORKSPACE" -type f -name "*.coffee" 2>&1))
|
||||
LIST_FILES=($(cd "$GITHUB_WORKSPACE"; find . -type f -name "*.coffee" 2>&1))
|
||||
|
||||
##################
|
||||
# Lint the files #
|
||||
|
@ -1273,6 +1292,10 @@ LintAnsibleFiles()
|
|||
echo "Location:[$VALIDATE_INSTALL_CMD]"
|
||||
fi
|
||||
|
||||
######################################################
|
||||
# Only go into ansible linter if we have base folder #
|
||||
######################################################
|
||||
if [ -d "$ANSIBLE_DIR" ]; then
|
||||
#################################
|
||||
# Get list of all files to lint #
|
||||
#################################
|
||||
|
@ -1332,6 +1355,13 @@ LintAnsibleFiles()
|
|||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
||||
fi
|
||||
done
|
||||
else
|
||||
########################
|
||||
# No Ansible dir found #
|
||||
########################
|
||||
echo "WARN! No Ansible base directory found at:[$ANSIBLE_DIR]"
|
||||
echo "skipping ansible lint"
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
#### Function Footer ###########################################################
|
||||
|
|
Loading…
Reference in a new issue