mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-24 23:21:12 -05:00
Merge pull request #343 from github/MinorFixGrabBag
Were going to fix it all
This commit is contained in:
commit
97e64a47e9
5 changed files with 47 additions and 52 deletions
2
.github/workflows/deploy-DEV.yml
vendored
2
.github/workflows/deploy-DEV.yml
vendored
|
@ -31,6 +31,8 @@ jobs:
|
|||
name: Deploy Docker Image - DEV
|
||||
# Set the agent to run on
|
||||
runs-on: ubuntu-latest
|
||||
# Prevent duplicate run from happening when a forked push is committed
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
##################
|
||||
# Load all steps #
|
||||
##################
|
||||
|
|
|
@ -125,7 +125,8 @@ jobs:
|
|||
uses: docker://github/super-linter:v3
|
||||
env:
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
VALIDATE_ANSIBLE: false
|
||||
DEFAULT_BRANCH: master
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// https://github.com/terraform-linters/tflint/blob/master/docs/guides/config.md
|
||||
config {
|
||||
module = true
|
||||
module = false
|
||||
deep_check = false
|
||||
force = false
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ function BuildFileList()
|
|||
#################################################################################
|
||||
# Switch codebase back to the default branch to get a list of all files changed #
|
||||
#################################################################################
|
||||
SWITCH_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git pull --quiet; git checkout "$DEFAULT_BRANCH" 2>&1)
|
||||
SWITCH_CMD=$(git -C "$GITHUB_WORKSPACE" pull --quiet; git -C "$GITHUB_WORKSPACE" checkout "$DEFAULT_BRANCH" 2>&1)
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
|
@ -100,11 +100,11 @@ function BuildFileList()
|
|||
#####################
|
||||
# Get the CFN files #
|
||||
#####################
|
||||
if [ "$FILE_TYPE" == "json" ] || [ "$FILE_TYPE" == "yml" ] || [ "$FILE_TYPE" == "yaml" ] && DetectCloudFormationFile "$FILE"; then
|
||||
if [ "$FILE_TYPE" == "yml" ] || [ "$FILE_TYPE" == "yaml" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_CFN+=("$FILE")
|
||||
FILE_ARRAY_YML+=("$FILE")
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
|
@ -118,11 +118,12 @@ function BuildFileList()
|
|||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_CFN+=("$FILE")
|
||||
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
fi
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
######################
|
||||
# Get the JSON files #
|
||||
######################
|
||||
|
@ -416,7 +417,7 @@ function BuildFileList()
|
|||
#########################################
|
||||
# Need to switch back to branch of code #
|
||||
#########################################
|
||||
SWITCH2_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git checkout --progress --force "$GITHUB_SHA" 2>&1)
|
||||
SWITCH2_CMD=$(git -C "$GITHUB_WORKSPACE" checkout --progress --force "$GITHUB_SHA" 2>&1)
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
|
|
|
@ -38,8 +38,8 @@ CFN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CFN_FILE_NAME" # Path to th
|
|||
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
||||
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
||||
# Coffee Vars
|
||||
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules
|
||||
COFFEESCRIPT_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEESCRIPT_FILE_NAME" # Path to the coffeescript lint rules
|
||||
# Javascript Vars
|
||||
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
||||
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
||||
|
@ -297,40 +297,31 @@ GetLinterRules()
|
|||
################
|
||||
# Pull in vars #
|
||||
################
|
||||
FILE_NAME="$1" # Name fo the linter file
|
||||
FILE_LOCATION="$2" # Location of the linter file
|
||||
LANGUAGE_NAME="$1" # Name of the language were looking for
|
||||
|
||||
#######################################################
|
||||
# Need to create the variables for the real variables #
|
||||
#######################################################
|
||||
LANGUAGE_FILE_NAME="${LANGUAGE_NAME}_FILE_NAME"
|
||||
LANGUAGE_LINTER_RULES="${LANGUAGE_NAME}_LINTER_RULES"
|
||||
|
||||
#####################################
|
||||
# Validate we have the linter rules #
|
||||
#####################################
|
||||
if [ -f "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" ]; then
|
||||
if [ -f "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}" ]; then
|
||||
echo "----------------------------------------------"
|
||||
echo "User provided file:[$FILE_NAME], setting rules file..."
|
||||
echo "User provided file:[${!LANGUAGE_FILE_NAME}], setting rules file..."
|
||||
|
||||
####################################
|
||||
# Copy users into default location #
|
||||
####################################
|
||||
CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1)
|
||||
|
||||
###################
|
||||
# Load Error code #
|
||||
###################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ $ERROR_CODE -ne 0 ]; then
|
||||
echo "ERROR! Failed to set file:[$FILE_NAME] as default!"
|
||||
echo "ERROR:[$CP_CMD]"
|
||||
exit 1
|
||||
fi
|
||||
########################################
|
||||
# Update the path to the file location #
|
||||
########################################
|
||||
declare "${LANGUAGE_LINTER_RULES}=$GITHUB_WORKSPACE/$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}"
|
||||
else
|
||||
########################################################
|
||||
# No user default provided, using the template default #
|
||||
########################################################
|
||||
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
|
||||
echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]"
|
||||
echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -426,7 +417,7 @@ DetectOpenAPIFile()
|
|||
###############################
|
||||
# Check the file for keywords #
|
||||
###############################
|
||||
grep -E '"openapi":|"swagger":|^openapi:|^swagger:' "$GITHUB_WORKSPACE/$FILE" > /dev/null
|
||||
grep -E '"openapi":|"swagger":|^openapi:|^swagger:' "$FILE" > /dev/null
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
|
@ -788,33 +779,33 @@ GetValidationInfo
|
|||
# Get the linter rules #
|
||||
########################
|
||||
# Get YML rules
|
||||
GetLinterRules "$YAML_FILE_NAME" "$YAML_LINTER_RULES"
|
||||
GetLinterRules "YAML"
|
||||
# Get Markdown rules
|
||||
GetLinterRules "$MD_FILE_NAME" "$MD_LINTER_RULES"
|
||||
GetLinterRules "MD"
|
||||
# Get Python rules
|
||||
GetLinterRules "$PYTHON_FILE_NAME" "$PYTHON_LINTER_RULES"
|
||||
GetLinterRules "PYTHON"
|
||||
# Get Ruby rules
|
||||
GetLinterRules "$RUBY_FILE_NAME" "$RUBY_LINTER_RULES"
|
||||
GetLinterRules "RUBY"
|
||||
# Get Coffeescript rules
|
||||
GetLinterRules "$COFFEE_FILE_NAME" "$COFFEESCRIPT_LINTER_RULES"
|
||||
GetLinterRules "COFFEESCRIPT"
|
||||
# Get Ansible rules
|
||||
GetLinterRules "$ANSIBLE_FILE_NAME" "$ANSIBLE_LINTER_RULES"
|
||||
GetLinterRules "ANSIBLE"
|
||||
# Get JavaScript rules
|
||||
GetLinterRules "$JAVASCRIPT_FILE_NAME" "$JAVASCRIPT_LINTER_RULES"
|
||||
GetLinterRules "JAVASCRIPT"
|
||||
# Get TypeScript rules
|
||||
GetLinterRules "$TYPESCRIPT_FILE_NAME" "$TYPESCRIPT_LINTER_RULES"
|
||||
GetLinterRules "TYPESCRIPT"
|
||||
# Get Golang rules
|
||||
GetLinterRules "$GO_FILE_NAME" "$GO_LINTER_RULES"
|
||||
GetLinterRules "GO"
|
||||
# Get Docker rules
|
||||
GetLinterRules "$DOCKER_FILE_NAME" "$DOCKER_LINTER_RULES"
|
||||
GetLinterRules "DOCKER"
|
||||
# Get Terraform rules
|
||||
GetLinterRules "$TERRAFORM_FILE_NAME" "$TERRAFORM_LINTER_RULES"
|
||||
GetLinterRules "TERRAFORM"
|
||||
# Get PowerShell rules
|
||||
GetLinterRules "$POWERSHELL_FILE_NAME" "$POWERSHELL_LINTER_RULES"
|
||||
GetLinterRules "POWERSHELL"
|
||||
# Get CSS rules
|
||||
GetLinterRules "$CSS_FILE_NAME" "$CSS_LINTER_RULES"
|
||||
GetLinterRules "CSS"
|
||||
# Get CFN rules
|
||||
GetLinterRules "$CFN_FILE_NAME" "$CFN_LINTER_RULES"
|
||||
GetLinterRules "CFN"
|
||||
|
||||
#################################
|
||||
# Check if were in verbose mode #
|
||||
|
@ -1000,7 +991,7 @@ if [ "$VALIDATE_ANSIBLE" == "true" ]; then
|
|||
# Due to the nature of how we want to validate Ansible, we cannot use the
|
||||
# standard loop, since it looks for an ansible folder, excludes certain
|
||||
# files, and looks for additional changes, it should be an outlier
|
||||
LintAnsibleFiles
|
||||
LintAnsibleFiles "$ANSIBLE_LINTER_RULES" # Passing rules but not needed, dont want to exclude unused var
|
||||
fi
|
||||
|
||||
######################
|
||||
|
|
Loading…
Reference in a new issue