Merge branch 'master' into stateLinter

This commit is contained in:
Lukas Gravley 2020-07-21 14:21:05 -05:00 committed by GitHub
commit c03ad1866e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 1240 additions and 853 deletions

View file

@ -1,23 +1,28 @@
# .automation # .automation
This folder holds automation scripts to help `deploy` and `cleanup` **DockerHub** images of the **Super-Linter** This folder holds automation scripts to help `deploy` and `cleanup` **DockerHub** images of the **Super-Linter**
## cleanup-docker.sh ## cleanup-docker.sh
This script uses **GitHub Actions** so that when a PR is merged and closed, the **GitHub Action** is triggered. This script uses **GitHub Actions** so that when a PR is merged and closed, the **GitHub Action** is triggered.
It will then search **DockerHub** for the image that was deployed during the development, and remove it. It will then search **DockerHub** for the image that was deployed during the development, and remove it.
## upload-docker.sh ## upload-docker.sh
This script uses **GitHub Actions** so that when a push to the repository is committed, it will complete the following: This script uses **GitHub Actions** so that when a push to the repository is committed, it will complete the following:
- Checkout the source code - Checkout the source code
- Build the **Docker** container for **Super-Linter** using that source code - Build the **Docker** container for **Super-Linter** using that source code
- Upload the container to **DockerHub** - Upload the container to **DockerHub**
When the script is triggered on master, it will push with the tag:**latest** which is used by all scripting for general availability. When the script is triggered on master, it will push with the tag:**latest** which is used by all scripting for general availability.
When the script is triggered in a branch, it will push with the tag:**NameOfBranch** which can be used for: When the script is triggered in a branch, it will push with the tag:**NameOfBranch** which can be used for:
- *testing*
- *troubleshooting* - _testing_
- *debugging* - _troubleshooting_
- _debugging_
- **Note:** The branch name will be reduced to alphanumeric for consistency and uploading - **Note:** The branch name will be reduced to alphanumeric for consistency and uploading
## test ## test
This folder holds all **Test Cases** to help run the *CI/CT/CD* process for the **Super-Linter**. This folder holds all **Test Cases** to help run the _CI/CT/CD_ process for the **Super-Linter**.

View file

@ -51,25 +51,25 @@ ValidateInput() {
############################ ############################
# Validate GITHUB_WORKSPACE # # Validate GITHUB_WORKSPACE #
############################ ############################
if [ -z "$GITHUB_WORKSPACE" ]; then if [ -z "${GITHUB_WORKSPACE}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GITHUB_WORKSPACE}]${NC}"
exit 1 exit 1
else else
echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" echo "Successfully found:[GITHUB_WORKSPACE], value:[${GITHUB_WORKSPACE}]"
fi fi
####################### #######################
# Validate IMAGE_REPO # # Validate IMAGE_REPO #
####################### #######################
if [ -z "$IMAGE_REPO" ]; then if [ -z "${IMAGE_REPO}" ]; then
# No repo was pulled # No repo was pulled
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${IMAGE_REPO}]${NC}"
exit 1 exit 1
elif [[ $IMAGE_REPO == "github/super-linter" ]]; then elif [[ ${IMAGE_REPO} == "github/super-linter" ]]; then
# Found our main repo # Found our main repo
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" echo "Successfully found:[IMAGE_REPO], value:[${IMAGE_REPO}]"
else else
# This is a fork and we cant pull vars or any info # This is a fork and we cant pull vars or any info
echo -e "${NC}${F[Y]}WARN!${NC} No image to cleanup as this is a forked branch, and not being built with current automation!${NC}" echo -e "${NC}${F[Y]}WARN!${NC} No image to cleanup as this is a forked branch, and not being built with current automation!${NC}"
@ -79,31 +79,31 @@ ValidateInput() {
########################## ##########################
# Validate IMAGE_VERSION # # Validate IMAGE_VERSION #
########################## ##########################
if [ -z "$IMAGE_VERSION" ]; then if [ -z "${IMAGE_VERSION}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_VERSION]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_VERSION]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_VERSION]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${IMAGE_VERSION}]${NC}"
exit 1 exit 1
else else
echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" echo "Successfully found:[IMAGE_VERSION], value:[${IMAGE_VERSION}]"
fi fi
############################ ############################
# Validate DOCKER_USERNAME # # Validate DOCKER_USERNAME #
############################ ############################
if [ -z "$DOCKER_USERNAME" ]; then if [ -z "${DOCKER_USERNAME}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${DOCKER_USERNAME}]${NC}"
exit 1 exit 1
else else
echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" echo "Successfully found:[DOCKER_USERNAME], value:[${DOCKER_USERNAME}]"
fi fi
############################ ############################
# Validate DOCKER_PASSWORD # # Validate DOCKER_PASSWORD #
############################ ############################
if [ -z "$DOCKER_PASSWORD" ]; then if [ -z "${DOCKER_PASSWORD}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${DOCKER_PASSWORD}]${NC}"
exit 1 exit 1
else else
echo "Successfully found:[DOCKER_PASSWORD], value:[********]" echo "Successfully found:[DOCKER_PASSWORD], value:[********]"
@ -112,11 +112,11 @@ ValidateInput() {
################################################## ##################################################
# Check if we need to get the name of the branch # # Check if we need to get the name of the branch #
################################################## ##################################################
if [[ $IMAGE_VERSION != "latest" ]]; then if [[ ${IMAGE_VERSION} != "latest" ]]; then
################################## ##################################
# Remove non alpha-numeric chars # # Remove non alpha-numeric chars #
################################## ##################################
IMAGE_VERSION=$(echo "$IMAGE_VERSION" | tr -cd '[:alnum:]') IMAGE_VERSION=$(echo "${IMAGE_VERSION}" | tr -cd '[:alnum:]')
else else
############################################# #############################################
# Image is 'latest' and we will not destroy # # Image is 'latest' and we will not destroy #
@ -142,7 +142,7 @@ LoginToDocker() {
###################### ######################
# Login to DockerHub # # Login to DockerHub #
###################### ######################
LOGIN_CMD=$(docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" 2>&1) LOGIN_CMD=$(docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -152,10 +152,10 @@ LoginToDocker() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to DockerHub!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LOGIN_CMD}]${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
@ -170,7 +170,7 @@ RemoveImage() {
################ ################
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Removing the DockerFile image:[$IMAGE_REPO:$IMAGE_VERSION]" echo "Removing the DockerFile image:[${IMAGE_REPO}:${IMAGE_VERSION}]"
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
@ -180,7 +180,7 @@ RemoveImage() {
TOKEN=$(curl -s -k \ TOKEN=$(curl -s -k \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-X POST \ -X POST \
-d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" \ -d "{\"username\": \"${DOCKER_USERNAME}\", \"password\": \"${DOCKER_PASSWORD}\"}" \
"https://hub.docker.com/v2/users/login/" | jq -r .token 2>&1) "https://hub.docker.com/v2/users/login/" | jq -r .token 2>&1)
####################### #######################
@ -191,10 +191,10 @@ RemoveImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain token from DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$TOKEN]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${TOKEN}]${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
@ -204,9 +204,9 @@ RemoveImage() {
################################# #################################
# Remove the tag from DockerHub # # Remove the tag from DockerHub #
################################# #################################
REMOVE_CMD=$(curl "https://hub.docker.com/v2/repositories/$IMAGE_REPO/tags/$IMAGE_VERSION/" \ REMOVE_CMD=$(curl "https://hub.docker.com/v2/repositories/${IMAGE_REPO}/tags/${IMAGE_VERSION}/" \
-X DELETE \ -X DELETE \
-H "Authorization: JWT $TOKEN" 2>&1) -H "Authorization: JWT ${TOKEN}" 2>&1)
####################### #######################
# Load the ERROR_CODE # # Load the ERROR_CODE #
@ -216,14 +216,14 @@ RemoveImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to remove tag from DockerHub!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to remove tag from DockerHub!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REMOVE_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${REMOVE_CMD}]${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo "Successfully [removed] Docker image tag:[$IMAGE_VERSION] from DockerHub!" echo "Successfully [removed] Docker image tag:[${IMAGE_VERSION}] from DockerHub!"
fi fi
} }
################################################################################ ################################################################################

View file

@ -1,6 +1,8 @@
# Test Cases # Test Cases
This folder holds `test cases` that are used to validate the sanity of the **Super-Linter**. This folder holds `test cases` that are used to validate the sanity of the **Super-Linter**.
The format: The format:
- Each **Super-Linter** language should have its own folder - Each **Super-Linter** language should have its own folder
- Folder(s) containing test cases for each language supported - Folder(s) containing test cases for each language supported
- Passing test case(s) per language denoted in naming scheme - Passing test case(s) per language denoted in naming scheme

View file

@ -1,13 +1,19 @@
# Ansible Test Cases # Ansible Test Cases
This folder holds the test cases for **Ansible**. This folder holds the test cases for **Ansible**.
## Additional Docs ## Additional Docs
The folder **ghe-initialize** is pulled from the **GitHub-Demo-Stack** and is a valid **Ansible** role. The folder **ghe-initialize** is pulled from the **GitHub-Demo-Stack** and is a valid **Ansible** role.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -26,23 +26,23 @@ CheckGHEPid()
################################## ##################################
# Check to prevent infinite loop # # Check to prevent infinite loop #
################################## ##################################
if [ $PID_CHECK -gt $PID_CHECK_LIMIT ]; then if [ ${PID_CHECK} -gt ${PID_CHECK_LIMIT} ]; then
# Over the limit, move on # Over the limit, move on
echo "We have checked the pid $PID_CHECK times, moving on..." echo "We have checked the pid ${PID_CHECK} times, moving on..."
else else
################################################ ################################################
# Check to see if the PID is alive and running # # Check to see if the PID is alive and running #
################################################ ################################################
if [ ! -f "$GHE_CONFIG_PID" ]; then if [ ! -f "${GHE_CONFIG_PID}" ]; then
# File not found # File not found
echo "We're good to move forward, no .pid file found at:[$GHE_CONFIG_PID]" echo "We're good to move forward, no .pid file found at:[${GHE_CONFIG_PID}]"
else else
# Found the pid running, need to sleep # Found the pid running, need to sleep
echo "Current PID found, sleeping $SLEEP_SECONDS seconds before next check..." echo "Current PID found, sleeping ${SLEEP_SECONDS} seconds before next check..."
################ ################
# Sleep it off # # Sleep it off #
################ ################
SLEEP_CMD=$(sleep $SLEEP_SECONDS 2>&1) SLEEP_CMD=$(sleep ${SLEEP_SECONDS} 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -52,9 +52,9 @@ CheckGHEPid()
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${SLEEP_CMD}]${NC}"
echo "Will try to call apply as last effort..." echo "Will try to call apply as last effort..."
#################################### ####################################
# Call config apply as last effort # # Call config apply as last effort #
@ -80,14 +80,14 @@ CheckGHEProcess()
################################## ##################################
# Check to prevent infinite loop # # Check to prevent infinite loop #
################################## ##################################
if [ $PROCESS_CHECK -gt $PROCESS_CHECK_LIMIT ]; then if [ ${PROCESS_CHECK} -gt ${PROCESS_CHECK_LIMIT} ]; then
# Over the limit, move on # Over the limit, move on
echo "We have checked the process $PROCESS_CHECK times, moving on..." echo "We have checked the process ${PROCESS_CHECK} times, moving on..."
else else
#################################################### ####################################################
# Check to see if the process is alive and running # # Check to see if the process is alive and running #
#################################################### ####################################################
CHECK_PROCESS_CMD=$(pgrep -f "$GHE_APPLY_COMMAND" 2>&1) CHECK_PROCESS_CMD=$(pgrep -f "${GHE_APPLY_COMMAND}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -97,16 +97,16 @@ CheckGHEProcess()
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# No process running on the system # No process running on the system
echo "Were good to move forward, no process like:[$GHE_APPLY_COMMAND] running currently on the system" echo "Were good to move forward, no process like:[${GHE_APPLY_COMMAND}] running currently on the system"
else else
# Found the process running, need to sleep # Found the process running, need to sleep
echo "Current process alive:[$CHECK_PROCESS_CMD], sleeping $SLEEP_SECONDS seconds before next check..." echo "Current process alive:[${CHECK_PROCESS_CMD}], sleeping ${SLEEP_SECONDS} seconds before next check..."
################ ################
# Sleep it off # # Sleep it off #
################ ################
SLEEP_CMD=$(sleep $SLEEP_SECONDS 2>&1) SLEEP_CMD=$(sleep ${SLEEP_SECONDS} 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -116,9 +116,9 @@ CheckGHEProcess()
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to sleep!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SLEEP_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${SLEEP_CMD}]${NC}"
echo "Will try to call apply as last effort..." echo "Will try to call apply as last effort..."
#################################### ####################################
# Call config apply as last effort # # Call config apply as last effort #
@ -144,7 +144,7 @@ RunConfigApply()
########## ##########
# Header # # Header #
########## ##########
echo "Running $GHE_APPLY_COMMAND to the server..." echo "Running ${GHE_APPLY_COMMAND} to the server..."
############################################## ##############################################
# Run the command to apply changes to server # # Run the command to apply changes to server #
@ -159,14 +159,14 @@ RunConfigApply()
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Errors # Errors
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to run config apply command!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to run config apply command!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$APPLY_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${APPLY_CMD}]${NC}"
exit 1 exit 1
else else
# Success # Success
echo -e "${NC}${F[B]}Successfully ran ${F[C]}$GHE_APPLY_COMMAND${NC}" echo -e "${NC}${F[B]}Successfully ran ${F[C]}${GHE_APPLY_COMMAND}${NC}"
fi fi
} }
################################################################################ ################################################################################

View file

@ -1,13 +1,19 @@
# ARM Test Cases # ARM Test Cases
This folder holds the test cases for **Azure Resource Manager (ARM)**. This folder holds the test cases for **Azure Resource Manager (ARM)**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# AWS CloudFormation Test Cases # AWS CloudFormation Test Cases
This folder holds the test cases for **CloudFormation**. This folder holds the test cases for **CloudFormation**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Clojure Test Cases # Clojure Test Cases
This folder holds the test cases for **Clojure**. This folder holds the test cases for **Clojure**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Coffeescript Test Cases # Coffeescript Test Cases
This folder holds the test cases for **Coffeescript**. This folder holds the test cases for **Coffeescript**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# CSS Test Cases # CSS Test Cases
This folder holds the test cases for **CSS**. This folder holds the test cases for **CSS**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Dart Test Cases # Dart Test Cases
This folder holds the test cases for **Dart**. This folder holds the test cases for **Dart**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,18 @@
# Docker Test Cases # Docker Test Cases
This folder holds the test cases for **Docker**. This folder holds the test cases for **Docker**.
## Additional Docs ## Additional Docs
Due to the nature of the naming of files, we have `2` subfolders in this directory. Due to the nature of the naming of files, we have `2` subfolders in this directory.
- `good` is for working, and correct **Dockerfile**(s) - `good` is for working, and correct **Dockerfile**(s)
- `bad` is for invalid, and incorrect **Dockerfile**(s) - `bad` is for invalid, and incorrect **Dockerfile**(s)
## Good Test Cases ## Good Test Cases
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# EDITORCONFIG_CHECKER Test Cases # EDITORCONFIG_CHECKER Test Cases
This folder holds the test cases for **EDITORCONFIG_CHECKER**. This folder holds the test cases for **EDITORCONFIG_CHECKER**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# ENV Test Cases # ENV Test Cases
This folder holds the test cases for **ENV**. This folder holds the test cases for **ENV**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Golang Test Cases # Golang Test Cases
This folder holds the test cases for **Golang**. This folder holds the test cases for **Golang**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# HTML Test Cases # HTML Test Cases
This folder holds the test cases for **HTML**. This folder holds the test cases for **HTML**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Javascript Test Cases # Javascript Test Cases
This folder holds the test cases for **Javascript**. This folder holds the test cases for **Javascript**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Json Test Cases # Json Test Cases
This folder holds the test cases for **Json**. This folder holds the test cases for **Json**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Kotlin Test Cases # Kotlin Test Cases
This folder holds the test cases for **Kotlin**. This folder holds the test cases for **Kotlin**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Markdown Test Cases # Markdown Test Cases
This folder holds the test cases for **Markdown**. This folder holds the test cases for **Markdown**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,14 +1,20 @@
# OpenAPI Test Cases # OpenAPI Test Cases
This folder holds the test cases for **OpenAPI**. This folder holds the test cases for **OpenAPI**.
## Additional Docs ## Additional Docs
The `_bad_` tests are valid `.yml`/`.json` but invalid OpenAPI specs. The `_bad_` tests are valid `.yml`/`.json` but invalid OpenAPI specs.
The test extensions used are `.ymlopenapi`/`.jsonopenapi` instead of `.yml`/`.json`. This is to prevent the [YAML] and [JSON] tests from picking them up. The test extensions used are `.ymlopenapi`/`.jsonopenapi` instead of `.yml`/`.json`. This is to prevent the [YAML] and [JSON] tests from picking them up.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Perl Test Cases # Perl Test Cases
This folder holds the test cases for **Perl**. This folder holds the test cases for **Perl**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# PHP Test Cases # PHP Test Cases
This folder holds the test cases for **PHP**. This folder holds the test cases for **PHP**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# PowerShell Test Cases # PowerShell Test Cases
This folder holds the test cases for **PowerShell**. This folder holds the test cases for **PowerShell**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Python Test Cases # Python Test Cases
This folder holds the test cases for **Python**. This folder holds the test cases for **Python**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Raku Test Cases # Raku Test Cases
This folder holds the test cases for **Raku**. This folder holds the test cases for **Raku**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Ruby Test Cases # Ruby Test Cases
This folder holds the test cases for **Ruby**. This folder holds the test cases for **Ruby**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Bash Test Cases # Bash Test Cases
This folder holds the test cases for **Bash**. This folder holds the test cases for **Bash**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -7,11 +7,11 @@ HELLO_WORLD=$(echo "Hello World" | cut -f1 -d' ' 2>&1)
ERROR_CODE=$? ERROR_CODE=$?
# Check the shell # Check the shell
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
echo "We did it!" echo "We did it!"
exit 0 exit 0
else else
echo "We done goofed it..." echo "We done goofed it..."
echo "$HELLO_WORLD" echo "${HELLO_WORLD}"
exit 1 exit 1
fi fi

View file

@ -1,13 +1,19 @@
# Typescript Test Cases # Typescript Test Cases
This folder holds the test cases for **Typescript**. This folder holds the test cases for **Typescript**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# XML Test Cases # XML Test Cases
This folder holds the test cases for **XML**. This folder holds the test cases for **XML**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -1,13 +1,19 @@
# Yml Test Cases # Yml Test Cases
This folder holds the test cases for **Yml**. This folder holds the test cases for **Yml**.
## Additional Docs ## Additional Docs
No Additional information is needed for this test case. No Additional information is needed for this test case.
## Good Test Cases ## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases ## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules. - **Note:** They are linted utilizing the default linter rules.

View file

@ -37,7 +37,7 @@ UPDATE_MAJOR_TAG=0 # Flag to deploy the major tag version as
Header() { Header() {
echo "" echo ""
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "---- GitHub Actions Upload image to [$REGISTRY] ----" echo "---- GitHub Actions Upload image to [${REGISTRY}] ----"
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "" echo ""
} }
@ -57,46 +57,46 @@ ValidateInput() {
############################# #############################
# Validate GITHUB_WORKSPACE # # Validate GITHUB_WORKSPACE #
############################# #############################
if [ -z "$GITHUB_WORKSPACE" ]; then if [ -z "${GITHUB_WORKSPACE}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_WORKSPACE]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_WORKSPACE]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GITHUB_WORKSPACE}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[$GITHUB_WORKSPACE]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_WORKSPACE]${F[B]}, value:${F[W]}[${GITHUB_WORKSPACE}]${NC}"
fi fi
##################### #####################
# Validate REGISTRY # # Validate REGISTRY #
##################### #####################
if [ -z "$REGISTRY" ]; then if [ -z "${REGISTRY}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [REGISTRY]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [REGISTRY]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$REGISTRY]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${REGISTRY}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[$REGISTRY]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[REGISTRY]${F[B]}, value:${F[W]}[${REGISTRY}]${NC}"
fi fi
##################################################### #####################################################
# See if we need values for GitHub package Registry # # See if we need values for GitHub package Registry #
##################################################### #####################################################
if [[ $REGISTRY == "GPR" ]]; then if [[ ${REGISTRY} == "GPR" ]]; then
######################### #########################
# Validate GPR_USERNAME # # Validate GPR_USERNAME #
######################### #########################
if [ -z "$GPR_USERNAME" ]; then if [ -z "${GPR_USERNAME}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_USERNAME]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_USERNAME]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GPR_USERNAME}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[$GPR_USERNAME]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_USERNAME]${F[B]}, value:${F[W]}[${GPR_USERNAME}]${NC}"
fi fi
###################### ######################
# Validate GPR_TOKEN # # Validate GPR_TOKEN #
###################### ######################
if [ -z "$GPR_TOKEN" ]; then if [ -z "${GPR_TOKEN}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_TOKEN]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GPR_TOKEN]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GPR_TOKEN]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GPR_TOKEN}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[GPR_TOKEN]${F[B]}, value:${F[W]}[********]${NC}"
@ -104,24 +104,24 @@ ValidateInput() {
######################################## ########################################
# See if we need values for Ducker hub # # See if we need values for Ducker hub #
######################################## ########################################
elif [[ $REGISTRY == "Docker" ]]; then elif [[ ${REGISTRY} == "Docker" ]]; then
############################ ############################
# Validate DOCKER_USERNAME # # Validate DOCKER_USERNAME #
############################ ############################
if [ -z "$DOCKER_USERNAME" ]; then if [ -z "${DOCKER_USERNAME}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_USERNAME]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_USERNAME]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${DOCKER_USERNAME}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[$DOCKER_USERNAME]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_USERNAME]${F[B]}, value:${F[W]}[${DOCKER_USERNAME}]${NC}"
fi fi
############################ ############################
# Validate DOCKER_PASSWORD # # Validate DOCKER_PASSWORD #
############################ ############################
if [ -z "$DOCKER_PASSWORD" ]; then if [ -z "${DOCKER_PASSWORD}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKER_PASSWORD]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKER_PASSWORD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${DOCKER_PASSWORD}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKER_PASSWORD]${F[B]}, value:${F[B]}[********]${NC}"
@ -131,39 +131,39 @@ ValidateInput() {
########################################### ###########################################
else else
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find a valid registry!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find a valid registry!${NC}"
echo "Registry:[$REGISTRY]" echo "Registry:[${REGISTRY}]"
exit 1 exit 1
fi fi
####################### #######################
# Validate IMAGE_REPO # # Validate IMAGE_REPO #
####################### #######################
if [ -z "$IMAGE_REPO" ]; then if [ -z "${IMAGE_REPO}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [IMAGE_REPO]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$IMAGE_REPO]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${IMAGE_REPO}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[$IMAGE_REPO]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_REPO]${F[B]}, value:${F[W]}[${IMAGE_REPO}]${NC}"
############################################### ###############################################
# Need to see if GPR registry and update name # # Need to see if GPR registry and update name #
############################################### ###############################################
if [[ $REGISTRY == "GPR" ]]; then if [[ ${REGISTRY} == "GPR" ]]; then
NAME="docker.pkg.github.com/$IMAGE_REPO/super-linter" NAME="docker.pkg.github.com/${IMAGE_REPO}/super-linter"
IMAGE_REPO="$NAME" IMAGE_REPO="${NAME}"
echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR" echo "Updated [IMAGE_REPO] to:[${IMAGE_REPO}] for GPR"
fi fi
fi fi
########################## ##########################
# Validate IMAGE_VERSION # # Validate IMAGE_VERSION #
########################## ##########################
if [ -z "$IMAGE_VERSION" ]; then if [ -z "${IMAGE_VERSION}" ]; then
echo -e "${NC}${F[Y]}WARN!${NC} Failed to get [IMAGE_VERSION]!${NC}" echo -e "${NC}${F[Y]}WARN!${NC} Failed to get [IMAGE_VERSION]!${NC}"
echo "Pulling from Branch Name..." echo "Pulling from Branch Name..."
############################## ##############################
# Get the name of the branch # # Get the name of the branch #
############################## ##############################
BRANCH_NAME=$(git -C "$GITHUB_WORKSPACE" branch --contains "$GITHUB_SHA" | awk '{print $2}' 2>&1) BRANCH_NAME=$(git -C "${GITHUB_WORKSPACE}" branch --contains "${GITHUB_SHA}" | awk '{print ${2}}' 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -173,24 +173,24 @@ ValidateInput() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get branch name!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get branch name!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$BRANCH_NAME]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${BRANCH_NAME}]${NC}"
exit 1 exit 1
fi fi
################################## ##################################
# Remove non alpha-numeric chars # # Remove non alpha-numeric chars #
################################## ##################################
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cd '[:alnum:]') BRANCH_NAME=$(echo "${BRANCH_NAME}" | tr -cd '[:alnum:]')
############################################ ############################################
# Set the IMAGE_VERSION to the BRANCH_NAME # # Set the IMAGE_VERSION to the BRANCH_NAME #
############################################ ############################################
IMAGE_VERSION="$BRANCH_NAME" IMAGE_VERSION="${BRANCH_NAME}"
echo "Tag:[$IMAGE_VERSION]" echo "Tag:[${IMAGE_VERSION}]"
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[$IMAGE_VERSION]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[${IMAGE_VERSION}]${NC}"
fi fi
################################## ##################################
@ -201,31 +201,31 @@ ValidateInput() {
###################################################################### ######################################################################
# Check if this is a latest to a versioned release at create new tag # # Check if this is a latest to a versioned release at create new tag #
###################################################################### ######################################################################
if [[ $IMAGE_VERSION =~ $REGEX ]]; then if [[ ${IMAGE_VERSION} =~ ${REGEX} ]]; then
# Need to get the major version, and set flag to update # Need to get the major version, and set flag to update
##################### #####################
# Set the major tag # # Set the major tag #
##################### #####################
MAJOR_TAG=$(echo "$IMAGE_VERSION" | cut -d '.' -f1) MAJOR_TAG=$(echo "${IMAGE_VERSION}" | cut -d '.' -f1)
################################### ###################################
# Set flag for updating major tag # # Set flag for updating major tag #
################################### ###################################
UPDATE_MAJOR_TAG=1 UPDATE_MAJOR_TAG=1
echo "- Also deploying a major tag of:[$MAJOR_TAG]" echo "- Also deploying a major tag of:[${MAJOR_TAG}]"
fi fi
############################ ############################
# Validate DOCKERFILE_PATH # # Validate DOCKERFILE_PATH #
############################ ############################
if [ -z "$DOCKERFILE_PATH" ]; then if [ -z "${DOCKERFILE_PATH}" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKERFILE_PATH]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [DOCKERFILE_PATH]!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$DOCKERFILE_PATH]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${DOCKERFILE_PATH}]${NC}"
exit 1 exit 1
else else
echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[$DOCKERFILE_PATH]${NC}" echo -e "${NC}${F[B]}Successfully found:${F[W]}[DOCKERFILE_PATH]${F[B]}, value:${F[W]}[${DOCKERFILE_PATH}]${NC}"
fi fi
} }
################################################################################ ################################################################################
@ -234,24 +234,24 @@ Authenticate() {
################ ################
# Pull in Vars # # Pull in Vars #
################ ################
USERNAME="$1" # Name to auth with USERNAME="${1}" # Name to auth with
PASSWORD="$2" # Password to auth with PASSWORD="${2}" # Password to auth with
URL="$3" # Url to auth towards URL="${3}" # Url to auth towards
NAME="$4" # name of the service NAME="${4}" # name of the service
################ ################
# Print header # # Print header #
################ ################
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Login to $NAME..." echo "Login to ${NAME}..."
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
################### ###################
# Auth to service # # Auth to service #
################### ###################
LOGIN_CMD=$(docker login "$URL" --username "$USERNAME" --password "$PASSWORD" 2>&1) LOGIN_CMD=$(docker login "${URL}" --username "${USERNAME}" --password "${PASSWORD}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -261,14 +261,14 @@ Authenticate() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to $NAME!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to authenticate to ${NAME}!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LOGIN_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LOGIN_CMD}]${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo -e "${NC}${F[B]}Successfully authenticated to ${F[C]}$NAME${F[B]}!${NC}" echo -e "${NC}${F[B]}Successfully authenticated to ${F[C]}${NAME}${F[B]}!${NC}"
fi fi
} }
################################################################################ ################################################################################
@ -286,9 +286,9 @@ BuildImage() {
################################ ################################
# Validate the DOCKERFILE_PATH # # Validate the DOCKERFILE_PATH #
################################ ################################
if [ ! -f "$DOCKERFILE_PATH" ]; then if [ ! -f "${DOCKERFILE_PATH}" ]; then
# No file found # No file found
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to find Dockerfile at:[$DOCKERFILE_PATH]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to find Dockerfile at:[${DOCKERFILE_PATH}]${NC}"
echo "Please make sure you give full path!" echo "Please make sure you give full path!"
echo "Example:[/configs/Dockerfile] or [Dockerfile] if at root directory" echo "Example:[/configs/Dockerfile] or [Dockerfile] if at root directory"
exit 1 exit 1
@ -297,7 +297,7 @@ BuildImage() {
################### ###################
# Build the image # # Build the image #
################### ###################
docker build --no-cache -t "$IMAGE_REPO:$IMAGE_VERSION" -f "$DOCKERFILE_PATH" . 2>&1 docker build --no-cache -t "${IMAGE_REPO}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
####################### #######################
# Load the error code # # Load the error code #
@ -307,7 +307,7 @@ BuildImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [build] Dockerfile!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [build] Dockerfile!${NC}"
exit 1 exit 1
@ -319,9 +319,9 @@ BuildImage() {
######################################################## ########################################################
# Need to see if we need to tag a major update as well # # Need to see if we need to tag a major update as well #
######################################################## ########################################################
if [ $UPDATE_MAJOR_TAG -eq 1 ]; then if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
# Tag the image with the major tag as well # Tag the image with the major tag as well
docker build -t "$IMAGE_REPO:$MAJOR_TAG" -f "$DOCKERFILE_PATH" . 2>&1 docker build -t "${IMAGE_REPO}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
####################### #######################
# Load the error code # # Load the error code #
@ -331,7 +331,7 @@ BuildImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [tag] Dockerfile!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [tag] Dockerfile!${NC}"
exit 1 exit 1
@ -349,14 +349,14 @@ UploadImage() {
################ ################
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Uploading the DockerFile image to $REGISTRY..." echo "Uploading the DockerFile image to ${REGISTRY}..."
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
############################################ ############################################
# Upload the docker image that was created # # Upload the docker image that was created #
############################################ ############################################
docker push "$IMAGE_REPO:$IMAGE_VERSION" 2>&1 docker push "${IMAGE_REPO}:${IMAGE_VERSION}" 2>&1
####################### #######################
# Load the error code # # Load the error code #
@ -366,20 +366,20 @@ UploadImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] Dockerfile!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] Dockerfile!${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo -e "${NC}${F[B]}Successfully Uploaded Docker image:${F[W]}[$IMAGE_VERSION]${F[B]} to ${F[C]}$REGISTRY${F[B]}!${NC}" echo -e "${NC}${F[B]}Successfully Uploaded Docker image:${F[W]}[${IMAGE_VERSION}]${F[B]} to ${F[C]}${REGISTRY}${F[B]}!${NC}"
fi fi
######################### #########################
# Get Image information # # Get Image information #
######################### #########################
IFS=$'\n' # Set the delimit to newline IFS=$'\n' # Set the delimit to newline
GET_INFO_CMD=$(docker images | grep "$IMAGE_REPO" | grep "$IMAGE_VERSION" 2>&1) GET_INFO_CMD=$(docker images | grep "${IMAGE_REPO}" | grep "${IMAGE_VERSION}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -389,18 +389,18 @@ UploadImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get information about built Image!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get information about built Image!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GET_INFO_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${GET_INFO_CMD}]${NC}"
exit 1 exit 1
else else
################ ################
# Get the data # # Get the data #
################ ################
REPO=$(echo "$GET_INFO_CMD" | awk '{print $1}') REPO=$(echo "${GET_INFO_CMD}" | awk '{print ${1}}')
TAG=$(echo "$GET_INFO_CMD" | awk '{print $2}') TAG=$(echo "${GET_INFO_CMD}" | awk '{print ${2}}')
IMAGE_ID=$(echo "$GET_INFO_CMD" | awk '{print $3}') IMAGE_ID=$(echo "${GET_INFO_CMD}" | awk '{print ${3}}')
SIZE="${GET_INFO_CMD##* }" SIZE="${GET_INFO_CMD##* }"
################### ###################
@ -408,21 +408,21 @@ UploadImage() {
################### ###################
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Docker Image Details:" echo "Docker Image Details:"
echo "Repository:[$REPO]" echo "Repository:[${REPO}]"
echo "Tag:[$TAG]" echo "Tag:[${TAG}]"
echo "Image_ID:[$IMAGE_ID]" echo "Image_ID:[${IMAGE_ID}]"
echo "Size:[$SIZE]" echo "Size:[${SIZE}]"
echo "----------------------------------------------" echo "----------------------------------------------"
fi fi
############################################################### ###############################################################
# Check if we need to upload the major tagged version as well # # Check if we need to upload the major tagged version as well #
############################################################### ###############################################################
if [ $UPDATE_MAJOR_TAG -eq 1 ]; then if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
############################################ ############################################
# Upload the docker image that was created # # Upload the docker image that was created #
############################################ ############################################
docker push "$IMAGE_REPO:$MAJOR_TAG" 2>&1 docker push "${IMAGE_REPO}:${MAJOR_TAG}" 2>&1
####################### #######################
# Load the error code # # Load the error code #
@ -432,13 +432,13 @@ UploadImage() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# ERROR # ERROR
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] MAJOR_TAG:[$MAJOR_TAG] Dockerfile!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} failed to [upload] MAJOR_TAG:[${MAJOR_TAG}] Dockerfile!${NC}"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo -e "${NC}${F[B]}Successfully Uploaded TAG:${F[W]}[$MAJOR_TAG]${F[B]} of Docker image to ${F[C]}$REGISTRY${F[B]}!${NC}" echo -e "${NC}${F[B]}Successfully Uploaded TAG:${F[W]}[${MAJOR_TAG}]${F[B]} of Docker image to ${F[C]}${REGISTRY}${F[B]}!${NC}"
fi fi
fi fi
} }
@ -473,23 +473,23 @@ BuildImage
###################### ######################
# Login to DockerHub # # Login to DockerHub #
###################### ######################
if [[ $REGISTRY == "Docker" ]]; then if [[ ${REGISTRY} == "Docker" ]]; then
# Authenticate "Username" "Password" "Url" "Name" # Authenticate "Username" "Password" "Url" "Name"
Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub" Authenticate "${DOCKER_USERNAME}" "${DOCKER_PASSWORD}" "" "Dockerhub"
#################################### ####################################
# Login to GitHub Package Registry # # Login to GitHub Package Registry #
#################################### ####################################
elif [[ $REGISTRY == "GPR" ]]; then elif [[ ${REGISTRY} == "GPR" ]]; then
# Authenticate "Username" "Password" "Url" "Name" # Authenticate "Username" "Password" "Url" "Name"
Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry" Authenticate "${GPR_USERNAME}" "${GPR_TOKEN}" "https://docker.pkg.github.com" "GitHub Package Registry"
else else
######### #########
# ERROR # # ERROR #
######### #########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Registry not set correctly!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Registry not set correctly!${NC}"
echo "Registry:[$REGISTRY]" echo "Registry:[${REGISTRY}]"
exit 1 exit 1
fi fi

View file

@ -1,10 +1,10 @@
# Devcontainer # Devcontainer
This file specifies to vscode how to run the container This file specifies to vscode how to run the container
For format details, see [documentation](https://aka.ms/vscode-remote/devcontainer.json) or this file's [README](https://github.com/microsoft/vscode-dev-containers/tree/v0.123.0/containers/docker-existing-dockerfile) For format details, see [documentation](https://aka.ms/vscode-remote/devcontainer.json) or this file's [README](https://github.com/microsoft/vscode-dev-containers/tree/v0.123.0/containers/docker-existing-dockerfile)
context: Sets the run context to one level up instead of the .devcontainer folder. context: Sets the run context to one level up instead of the .devcontainer folder.
dockerFile: Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. dockerFile: Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
settings: Set *default* container specific settings.json values on container create. settings: Set _default_ container specific settings.json values on container create.
extensions: Add the IDs of extensions you want installed when the container is created. extensions: Add the IDs of extensions you want installed when the container is created.

View file

@ -1,11 +1,14 @@
# Contributing # Contributing
:wave: Hi there! :wave: Hi there!
We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
## Submitting a pull request ## Submitting a pull request
[Pull Requests][pulls] are used for adding new playbooks, roles, and documents to the repository, or editing the existing ones. [Pull Requests][pulls] are used for adding new playbooks, roles, and documents to the repository, or editing the existing ones.
**With write access** **With write access**
1. Clone the repository (only if you have write access) 1. Clone the repository (only if you have write access)
1. Create a new branch: `git checkout -b my-branch-name` 1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change 1. Make your change
@ -13,6 +16,7 @@ We're thrilled that you'd like to contribute to this project. Your help is essen
1. Pat yourself on the back and wait for your pull request to be reviewed and merged. 1. Pat yourself on the back and wait for your pull request to be reviewed and merged.
**Without write access** **Without write access**
1. [Fork][fork] and clone the repository 1. [Fork][fork] and clone the repository
1. Create a new branch: `git checkout -b my-branch-name` 1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change 1. Make your change
@ -30,16 +34,20 @@ Draft pull requests are also welcome to get feedback early on, or if there is so
- Open a pull request - Open a pull request
### CI/CT/CD ### CI/CT/CD
The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions.
The **Super-Linter** has _CI/CT/CD_ configured utilizing **GitHub** Actions.
- When a branch is created and code is pushed, a **GitHub** Action is triggered for building the new **Docker** container with the new codebase - When a branch is created and code is pushed, a **GitHub** Action is triggered for building the new **Docker** container with the new codebase
- The **Docker** container is then ran against the *test cases* to validate all code sanity - The **Docker** container is then ran against the _test cases_ to validate all code sanity
- `.automation/test` contains all test cases for each language that should be validated - `.automation/test` contains all test cases for each language that should be validated
- These **GitHub** Actions utilize the Checks API and Protected Branches to help follow the SDLC - These **GitHub** Actions utilize the Checks API and Protected Branches to help follow the SDLC
- When the Pull Request is merged to master, the **Super-Linter** **Docker** container is then updated and deployed with the new codebase - When the Pull Request is merged to master, the **Super-Linter** **Docker** container is then updated and deployed with the new codebase
- **Note:** The branch's **Docker** container is also removed from **DockerHub** to cleanup after itself - **Note:** The branch's **Docker** container is also removed from **DockerHub** to cleanup after itself
## Releasing ## Releasing
If you are the current maintainer of this action: If you are the current maintainer of this action:
1. If a major version number change: Update `README.md` and the wiki to reflect new version number in the example workflow file sections 1. If a major version number change: Update `README.md` and the wiki to reflect new version number in the example workflow file sections
2. Draft [Releases](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) are created automatically. They just need to be checked over for accuracy before making it official. 2. Draft [Releases](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) are created automatically. They just need to be checked over for accuracy before making it official.
3. Ensure you check the box for [publishing to the marketplace](https://help.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action) 3. Ensure you check the box for [publishing to the marketplace](https://help.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)
@ -48,6 +56,7 @@ If you are the current maintainer of this action:
6. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) 6. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners)
## Resources ## Resources
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
- [GitHub Help](https://help.github.com) - [GitHub Help](https://help.github.com)

View file

@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
**To Reproduce** **To Reproduce**
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'

View file

@ -1,16 +1,20 @@
<!-- Please ensure your PR title is brief and descriptive for a good changelog entry --> <!-- Please ensure your PR title is brief and descriptive for a good changelog entry -->
<!-- Link to issue if there is one --> <!-- Link to issue if there is one -->
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
Fixes # Fixes #
<!-- markdownlint-restore --> <!-- markdownlint-restore -->
<!-- Describe what the changes are --> <!-- Describe what the changes are -->
## Proposed Changes ## Proposed Changes
- 1. ...
- 2. ...
- 3. ...
## Readiness Checklist ## Readiness Checklist
- [ ] Label as `breaking` if this is a large fundamental change - [ ] Label as `breaking` if this is a large fundamental change
- [ ] Label as either `automation`, `bug`, `documentation`, `enhancement`, `infrastructure`, or `performance` - [ ] Label as either `automation`, `bug`, `documentation`, `enhancement`, `infrastructure`, or `performance`

View file

@ -18,9 +18,9 @@
############################# #############################
on: on:
push: push:
branches-ignore: branches-ignore: [master]
- 'master' pull_request:
pull_request: [] branches-ignore: []
############### ###############
# Set the Job # # Set the Job #

View file

@ -15,8 +15,9 @@
############################# #############################
on: on:
push: push:
branches: master branches: [master]
pull_request: [] pull_request:
branches-ignore: []
############### ###############
# Set the Job # # Set the Job #

View file

@ -12,9 +12,9 @@ CODE_PATH='/tmp/lint' # Path to code base
################## ##################
# Check the path # # Check the path #
################## ##################
if [ ! -L $CODE_PATH ]; then if [ ! -L ${CODE_PATH} ]; then
# Create symbolic link # Create symbolic link
ln -s "$PWD"/.automation/test $CODE_PATH ln -s "${PWD}"/.automation/test ${CODE_PATH}
fi fi
######################### #########################
@ -23,4 +23,4 @@ fi
export RUN_LOCAL=true export RUN_LOCAL=true
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "$PWD"/lib/linter.sh source "${PWD}"/lib/linter.sh

View file

@ -126,7 +126,7 @@ ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1"
RUN curl -sLO "${ARM_TTK_URI}" \ RUN curl -sLO "${ARM_TTK_URI}" \
&& unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \
&& rm "${ARM_TTK_NAME}" \ && rm "${ARM_TTK_NAME}" \
&& ln -sTf "$ARM_TTK_PSD1" /usr/bin/arm-ttk && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk
###################### ######################
# Install shellcheck # # Install shellcheck #

View file

@ -1,8 +1,10 @@
# Super-Linter # Super-Linter
This repository is for the **GitHub Action** to run a **Super-Linter**. This repository is for the **GitHub Action** to run a **Super-Linter**.
It is a simple combination of various linters, written in `bash`, to help validate your source code. It is a simple combination of various linters, written in `bash`, to help validate your source code.
The end goal of this tool: The end goal of this tool:
- Prevent broken code from being uploaded to the default branch (Usually `master`) - Prevent broken code from being uploaded to the default branch (Usually `master`)
- Help establish coding best practices across multiple languages - Help establish coding best practices across multiple languages
- Build guidelines for code layout and format - Build guidelines for code layout and format
@ -10,15 +12,24 @@ The end goal of this tool:
## Table of Contents ## Table of Contents
- [How it works](#how-it-works) - [Super-Linter](#super-linter)
- [Supported linters](#supported-linters) - [Table of Contents](#table-of-contents)
- [Usage](#how-to-use) - [How it Works](#how-it-works)
- [Environment variables](#environment-variables) - [Supported Linters](#supported-linters)
- [Disable rules](#disabling-rules) - [How to use](#how-to-use)
- [Docker Hub](#docker-hub) - [Example connecting GitHub Action Workflow](#example-connecting-github-action-workflow)
- [Run Super-Linter outside GitHub Actions](#run-super-linter-outside-github-actions) - [Environment variables](#environment-variables)
- [Limitations](#limitations) - [Template rules files](#template-rules-files)
- [Contributing](#how-to-contribute) - [Disabling rules](#disabling-rules)
- [Docker Hub](#docker-hub)
- [Run Super-Linter outside GitHub Actions](#run-super-linter-outside-github-actions)
- [Local (troubleshooting/debugging/enhancements)](#local-troubleshootingdebuggingenhancements)
- [Azure](#azure)
- [GitLab](#gitlab)
- [Visual Studio Code](#visual-studio-code)
- [Limitations](#limitations)
- [How to contribute](#how-to-contribute)
- [License](#license)
## How it Works ## How it Works
@ -30,12 +41,11 @@ The design of the **Super-Linter** is currently to allow linting to occur in **G
Developers on **GitHub** can call the **GitHub Action** to lint their code base with the following list of linters: Developers on **GitHub** can call the **GitHub Action** to lint their code base with the following list of linters:
| *Language* | *Linter* | | _Language_ | _Linter_ |
| --- | --- | | -------------------------------- | ------------------------------------------------------------------------------------ |
| **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) |
| **Azure Resource Manager (ARM)** | [arm-ttk](https://github.com/azure/arm-ttk) | | **Azure Resource Manager (ARM)** | [arm-ttk](https://github.com/azure/arm-ttk) |
| **AWS CloudFormation templates** | [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/) | | **AWS CloudFormation templates** | [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/) |
| **AWS States Language | [asl-validator](https://github.com/ChristopheBougere/asl-validator) |
| **CSS** | [stylelint](https://stylelint.io/) | | **CSS** | [stylelint](https://stylelint.io/) |
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) | | **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) | | **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
@ -64,19 +74,22 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
| **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | | **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) |
## How to use ## How to use
More in-depth [tutorial](https://www.youtube.com/watch?v=EDAmFKO4Zt0&t=118s) available More in-depth [tutorial](https://www.youtube.com/watch?v=EDAmFKO4Zt0&t=118s) available
To use this **GitHub** Action you will need to complete the following: To use this **GitHub** Action you will need to complete the following:
1. Create a new file in your repository called `.github/workflows/linter.yml` 1. Create a new file in your repository called `.github/workflows/linter.yml`
2. Copy the example workflow from below into that new file, no extra configuration required 2. Copy the example workflow from below into that new file, no extra configuration required
3. Commit that file to a new branch 3. Commit that file to a new branch
4. Open up a pull request and observe the action working 4. Open up a pull request and observe the action working
5. Enjoy your more *stable*, and *cleaner* code base 5. Enjoy your more _stable_, and _cleaner_ code base
6. Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options 6. Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options
**NOTE:** You will need the *Environment* variable `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` set in your workflow file to be able to use the multiple status API returns. There is no need to set the **GitHub** Secret, it only needs to be passed. **NOTE:** You will need the _Environment_ variable `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` set in your workflow file to be able to use the multiple status API returns. There is no need to set the **GitHub** Secret, it only needs to be passed.
### Example connecting GitHub Action Workflow ### Example connecting GitHub Action Workflow
In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below: In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below:
- `.github/workflows/linter.yml` - `.github/workflows/linter.yml`
@ -136,17 +149,16 @@ jobs:
VALIDATE_ALL_CODEBASE: false VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
``` ```
**NOTE:** **NOTE:**
Using the line:`uses: docker://github/super-linter:v3` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v3` will build and compile the **GitHub Super-Linter** at build time. *This can be far more costly in time...* Using the line:`uses: docker://github/super-linter:v3` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v3` will build and compile the **GitHub Super-Linter** at build time. _This can be far more costly in time..._
## Environment variables ## Environment variables
The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality.
*Note:* All the `VALIDATE_[LANGUAGE]` variables behave in a specific way. _Note:_ All the `VALIDATE_[LANGUAGE]` variables behave in a specific way.
If none of them are passed, then they all default to true. If none of them are passed, then they all default to true.
However if any one of the variables are set, we default to leaving any unset variable to false. However if any one of the variables are set, we default to leaving any unset variable to false.
This means that if you run the linter "out of the box", all languages will be checked. This means that if you run the linter "out of the box", all languages will be checked.
@ -205,44 +217,57 @@ and won't run anything unexpected.
| **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the YAML language. | | **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the YAML language. |
### Template rules files ### Template rules files
You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
You can use the **GitHub** **Super-Linter** _with_ or _without_ your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
- Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository - Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository
- If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES) - If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES)
## Disabling rules ## Disabling rules
If you need to disable certain *rules* and *functionality*, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md)
If you need to disable certain _rules_ and _functionality_, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md)
## Docker Hub ## Docker Hub
The **Docker** container that is built from this repository is located at `https://hub.docker.com/r/github/super-linter`
The **Docker** container that is built from this repository is located at [github/super-linter](https://hub.docker.com/r/github/super-linter)
## Run Super-Linter outside GitHub Actions ## Run Super-Linter outside GitHub Actions
### Local (troubleshooting/debugging/enhancements) ### Local (troubleshooting/debugging/enhancements)
If you find that you need to run super-linter locally, you can follow the documentation at [Running super-linter locally](https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md) If you find that you need to run super-linter locally, you can follow the documentation at [Running super-linter locally](https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md)
Check out the [note](#how-it-works) in **How it Works** to understand more about the **Super-Linter** linting locally versus via continuous integration. Check out the [note](#how-it-works) in **How it Works** to understand more about the **Super-Linter** linting locally versus via continuous integration.
### Azure ### Azure
Check out this [article](http://blog.tyang.org/2020/06/27/use-github-super-linter-in-azure-pipelines/) Check out this [article](http://blog.tyang.org/2020/06/27/use-github-super-linter-in-azure-pipelines/)
### GitLab ### GitLab
Check out this [snippet](https://gitlab.com/snippets/1988376) Check out this [snippet](https://gitlab.com/snippets/1988376)
### Visual Studio Code ### Visual Studio Code
You can checkout this repository using [Container Remote Development](https://code.visualstudio.com/docs/remote/containers), and debug the linter using the `Test Linter` task. You can checkout this repository using [Container Remote Development](https://code.visualstudio.com/docs/remote/containers), and debug the linter using the `Test Linter` task.
![Example](https://user-images.githubusercontent.com/15258962/85165778-2d2ce700-b21b-11ea-803e-3f6709d8e609.gif) ![Example](https://user-images.githubusercontent.com/15258962/85165778-2d2ce700-b21b-11ea-803e-3f6709d8e609.gif)
We will also support [Github Codespaces](https://github.com/features/codespaces/) once it becomes available We will also support [Github Codespaces](https://github.com/features/codespaces/) once it becomes available
## Limitations ## Limitations
Below are a list of the known limitations for the **GitHub Super-Linter**: Below are a list of the known limitations for the **GitHub Super-Linter**:
- Due to being completely packaged at run time, you will not be able to update dependencies or change versions of the enclosed linters and binaries - Due to being completely packaged at run time, you will not be able to update dependencies or change versions of the enclosed linters and binaries
- Additional details from `package.json` are not read by the **GitHub Super-Linter** - Additional details from `package.json` are not read by the **GitHub Super-Linter**
- Downloading additional codebases as dependencies from private repositories will fail due to lack of permissions - Downloading additional codebases as dependencies from private repositories will fail due to lack of permissions
## How to contribute ## How to contribute
If you would like to help contribute to this **GitHub** Action, please see [CONTRIBUTING](https://github.com/github/super-linter/blob/master/.github/CONTRIBUTING.md) If you would like to help contribute to this **GitHub** Action, please see [CONTRIBUTING](https://github.com/github/super-linter/blob/master/.github/CONTRIBUTING.md)
-------------------------------------------------------------------------------- ---
### License ### License
- [MIT License](https://github.com/github/super-linter/blob/master/LICENSE) - [MIT License](https://github.com/github/super-linter/blob/master/LICENSE)

View file

@ -6,7 +6,7 @@
# 'Error' # 'Error'
# 'Warning' # 'Warning'
#) #)
#IncludeDefaultRules=$true #IncludeDefaultRules=${true}
#ExcludeRules = @( #ExcludeRules = @(
# 'PSAvoidUsingWriteHost', # 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName' # 'MyCustomRuleName'

View file

@ -1,4 +1,5 @@
# Disabling linters and Rules # Disabling linters and Rules
Linters can often require additional configuration to ensure they work with your codebase and your team's coding style, to avoid flagging false-positives. The **GitHub Super-Linter** has set up some default configurations for each linter which should work reasonably well with common code bases, but many of the linters can be configured to disable certain rules or configure the rules to ignore certain pieces of codes. Linters can often require additional configuration to ensure they work with your codebase and your team's coding style, to avoid flagging false-positives. The **GitHub Super-Linter** has set up some default configurations for each linter which should work reasonably well with common code bases, but many of the linters can be configured to disable certain rules or configure the rules to ignore certain pieces of codes.
To run with your own configuration for a linter, copy the relevant [`TEMPLATE` configuration file for the linter you are using from this repo](https://github.com/github/super-linter/tree/master/TEMPLATES) into the `.github/linters` folder in your own repository, and then edit it to modify, disable - or even add - rules and configuration to suit how you want your code checked. To run with your own configuration for a linter, copy the relevant [`TEMPLATE` configuration file for the linter you are using from this repo](https://github.com/github/super-linter/tree/master/TEMPLATES) into the `.github/linters` folder in your own repository, and then edit it to modify, disable - or even add - rules and configuration to suit how you want your code checked.
@ -7,11 +8,12 @@ How the changes are made differ for each linter, and also how much the **Github
Where a configuration file exists in your repo, it will be used in preference to the default one in the **GitHub Super-Linter** `TEMPLATES` directory (not in addition to it), and where one doesn't exist the `TEMPLATES` version will be used. So you should copy the complete configuration file you require to change from the `TEMPLATES` directory and not just the lines of config you want to change. Where a configuration file exists in your repo, it will be used in preference to the default one in the **GitHub Super-Linter** `TEMPLATES` directory (not in addition to it), and where one doesn't exist the `TEMPLATES` version will be used. So you should copy the complete configuration file you require to change from the `TEMPLATES` directory and not just the lines of config you want to change.
It is possible to have custom configurations for some linters, and continue to use the default from `TEMPLATES` directory for others, so if you use `Python` and `JavaScript` and only need to tweak the `Python` rules, then you only need to have a custom configuration for *pylint* and continue to use the default `TEMPLATE` from the main repo for *ESLint*, for example. It is possible to have custom configurations for some linters, and continue to use the default from `TEMPLATES` directory for others, so if you use `Python` and `JavaScript` and only need to tweak the `Python` rules, then you only need to have a custom configuration for _pylint_ and continue to use the default `TEMPLATE` from the main repo for _ESLint_, for example.
For some linters it is also possible to override rules on a case by case level with directives in your code. Where this is possible we try to note how to do this in the specific linter sections below, but the official linter documentation will likely give more detail on this. For some linters it is also possible to override rules on a case by case level with directives in your code. Where this is possible we try to note how to do this in the specific linter sections below, but the official linter documentation will likely give more detail on this.
## Table of Linters ## Table of Linters
- [Ruby](#ruby) - [Ruby](#ruby)
- [Shell](#shell) - [Shell](#shell)
- [Ansible](#ansible) - [Ansible](#ansible)
@ -42,23 +44,27 @@ For some linters it is also possible to override rules on a case by case level w
<!-- toc --> <!-- toc -->
-------------------------------------------------------------------------------- ---
## Ruby ## Ruby
- [RuboCop](https://github.com/rubocop-hq/rubocop) - [RuboCop](https://github.com/rubocop-hq/rubocop)
### RuboCop Config file ### RuboCop Config file
- `.github/linters/.ruby-lint.yml` - `.github/linters/.ruby-lint.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.ruby-lint.yml` - File should be located at: `.github/linters/.ruby-lint.yml`
- **Note:** We use the Default **GitHub** Rule set from [RuboCop-GitHub](https://github.com/github/rubocop-github) - **Note:** We use the Default **GitHub** Rule set from [RuboCop-GitHub](https://github.com/github/rubocop-github)
### RuboCop disable single line ### RuboCop disable single line
```ruby ```ruby
method(argument) # rubocop:disable SomeRule, SomeOtherRule method(argument) # rubocop:disable SomeRule, SomeOtherRule
``` ```
### RuboCop disable code block ### RuboCop disable code block
```ruby ```ruby
# rubocop:disable # rubocop:disable
This is a long line This is a long line
@ -67,6 +73,7 @@ var="this is some other stuff"
``` ```
### RuboCop disable entire file ### RuboCop disable entire file
If you need to ignore an entire file, you can update the `.github/linters/.ruby-lint.yml` to ignore certain files and locations If you need to ignore an entire file, you can update the `.github/linters/.ruby-lint.yml` to ignore certain files and locations
```yml ```yml
@ -85,27 +92,31 @@ AllCops:
TargetRubyVersion: 2.5.1 TargetRubyVersion: 2.5.1
EnabledByDefault: true EnabledByDefault: true
Exclude: Exclude:
- 'db/**/*' - "db/**/*"
- 'config/**/*' - "config/**/*"
- 'script/**/*' - "script/**/*"
- 'bin/{rails,rake}' - "bin/{rails,rake}"
- !ruby/regexp /old_and_unused\.rb$/ - !ruby/regexp /old_and_unused\.rb$/
``` ```
-------------------------------------------------------------------------------- ---
## Shell ## Shell
- [Shellcheck](https://github.com/koalaman/shellcheck) - [Shellcheck](https://github.com/koalaman/shellcheck)
### Shellcheck Config file ### Shellcheck Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### Shellcheck disable single line ### Shellcheck disable single line
```bash ```bash
echo "Terrible stuff" # shellcheck disable=SC2059,SC2086 echo "Terrible stuff" # shellcheck disable=SC2059,SC2086
``` ```
### Shellcheck disable code block ### Shellcheck disable code block
```bash ```bash
# shellcheck disable=SC2059,SC2086 # shellcheck disable=SC2059,SC2086
echo "some hot garbage" echo "some hot garbage"
@ -113,7 +124,9 @@ echo "More garbage code"
``` ```
### Shellcheck disable entire file ### Shellcheck disable entire file
- **Note:** The disable must be on the second line of the code right after the shebang - **Note:** The disable must be on the second line of the code right after the shebang
```bash ```bash
#!/bin/sh #!/bin/sh
# shellcheck disable=SC2059,SC1084 # shellcheck disable=SC2059,SC1084
@ -122,23 +135,28 @@ echo "stuff"
moreThings() moreThings()
``` ```
-------------------------------------------------------------------------------- ---
## Ansible ## Ansible
- [ansible-lint](https://github.com/ansible/ansible-lint) - [ansible-lint](https://github.com/ansible/ansible-lint)
### Ansible-lint Config file ### Ansible-lint Config file
- `.github/linters/.ansible-lint.yml` - `.github/linters/.ansible-lint.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.ansible-lint.yml` - File should be located at: `.github/linters/.ansible-lint.yml`
### Ansible-lint disable single line ### Ansible-lint disable single line
```yml ```yml
- name: this would typically fire GitHasVersionRule 401 and BecomeUserWithoutBecomeRule 501 - name: this would typically fire GitHasVersionRule 401 and BecomeUserWithoutBecomeRule 501
become_user: alice # noqa 401 501 become_user: alice # noqa 401 501
git: src=/path/to/git/repo dest=checkout git: src=/path/to/git/repo dest=checkout
``` ```
### Ansible-lint disable code block ### Ansible-lint disable code block
```yml ```yml
- name: this would typically fire GitHasVersionRule 401 - name: this would typically fire GitHasVersionRule 401
git: src=/path/to/git/repo dest=checkout git: src=/path/to/git/repo dest=checkout
@ -147,38 +165,46 @@ moreThings()
``` ```
### Ansible-lint disable entire file ### Ansible-lint disable entire file
```yml ```yml
- name: this would typically fire GitHasVersionRule 401 - name: this would typically fire GitHasVersionRule 401
git: src=/path/to/git/repo dest=checkout git: src=/path/to/git/repo dest=checkout
tags: tags:
- skip_ansible_lint - skip_ansible_lint
``` ```
--------------------------------------------------------------------------------
---
## YAML ## YAML
- [YamlLint](https://github.com/adrienverge/yamllint) - [YamlLint](https://github.com/adrienverge/yamllint)
### Yamllint Config file ### Yamllint Config file
- `.github/linters/.yaml-lint.yml` - `.github/linters/.yaml-lint.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.yaml-lint.yml` - File should be located at: `.github/linters/.yaml-lint.yml`
### Yamllint disable single line ### Yamllint disable single line
```yml ```yml
This line is waaaaaaaaaay too long # yamllint disable-line This line is waaaaaaaaaay too long # yamllint disable-line
``` ```
### Yamllint disable code block ### Yamllint disable code block
```yml ```yml
# yamllint disable rule:colons # yamllint disable rule:colons
- Key : value - Key: value
dolor : sit, dolor: sit,
foo : bar foo: bar
# yamllint enable # yamllint enable
``` ```
### Yamllint disable entire file ### Yamllint disable entire file
If you need to ignore an entire file, you can update the `.github/linters/.yaml-lint.yml` to ignore certain files and locations If you need to ignore an entire file, you can update the `.github/linters/.yaml-lint.yml` to ignore certain files and locations
```yml ```yml
# For all rules # For all rules
ignore: | ignore: |
@ -197,22 +223,26 @@ rules:
/ascii-art/* /ascii-art/*
``` ```
-------------------------------------------------------------------------------- ---
## Python3 ## Python3
- [pylint](https://www.pylint.org/) - [pylint](https://www.pylint.org/)
### Pylint Config file ### Pylint Config file
- `.github/linters/.python-lint` - `.github/linters/.python-lint`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.python-lint` - File should be located at: `.github/linters/.python-lint`
### Pylint disable single line ### Pylint disable single line
```python ```python
global VAR # pylint: disable=global-statement global VAR # pylint: disable=global-statement
``` ```
### Pylint disable code block ### Pylint disable code block
```python ```python
"""pylint option block-disable""" """pylint option block-disable"""
@ -243,6 +273,7 @@ class Foo(object):
``` ```
### Pylint disable entire file ### Pylint disable entire file
```python ```python
#!/bin/python3 #!/bin/python3
# pylint: skip-file # pylint: skip-file
@ -250,21 +281,26 @@ class Foo(object):
var = "terrible code down here..." var = "terrible code down here..."
``` ```
-------------------------------------------------------------------------------- ---
## AWS CloudFormation templates ## AWS CloudFormation templates
- [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/) - [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/)
### cfn-lint Config file ### cfn-lint Config file
- `.github/linters/.cfnlintrc.yml` - `.github/linters/.cfnlintrc.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.cfnlintrc.yml` - File should be located at: `.github/linters/.cfnlintrc.yml`
### cfn-lint disable single line ### cfn-lint disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### cfn-lint disable code block ### cfn-lint disable code block
You can disable both [template](https://github.com/aws-cloudformation/cfn-python-lint/#template-based-metadata) or [resource](https://github.com/aws-cloudformation/cfn-python-lint/#resource-based-metadata) via [metadata](https://github.com/aws-cloudformation/cfn-python-lint/#metadata): You can disable both [template](https://github.com/aws-cloudformation/cfn-python-lint/#template-based-metadata) or [resource](https://github.com/aws-cloudformation/cfn-python-lint/#resource-based-metadata) via [metadata](https://github.com/aws-cloudformation/cfn-python-lint/#metadata):
```yaml ```yaml
Resources: Resources:
myInstance: myInstance:
@ -280,142 +316,189 @@ Resources:
``` ```
### cfn-lint disable entire file ### cfn-lint disable entire file
If you need to ignore an entire file, you can update the `.github/linters/.cfnlintrc.yml` to ignore certain files and locations If you need to ignore an entire file, you can update the `.github/linters/.cfnlintrc.yml` to ignore certain files and locations
```yaml ```yaml
ignore_templates: ignore_templates:
- codebuild.yaml - codebuild.yaml
``` ```
-------------------------------------------------------------------------------- ---
## JSON ## JSON
- [jsonlint](https://github.com/zaach/jsonlint) - [jsonlint](https://github.com/zaach/jsonlint)
### JsonLint Config file ### JsonLint Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### JsonLint disable single line ### JsonLint disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### JsonLint disable code block ### JsonLint disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### JsonLint disable entire file ### JsonLint disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Markdown ## Markdown
- [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli#readme) - [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli#readme)
- [markdownlint rule documentation](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md) - [markdownlint rule documentation](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md)
- [markdownlint inline comment syntax](https://github.com/DavidAnson/markdownlint#configuration) - [markdownlint inline comment syntax](https://github.com/DavidAnson/markdownlint#configuration)
### markdownlint Config file ### markdownlint Config file
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.markdown-lint.yml` - File should be located at: `.github/linters/.markdown-lint.yml`
### markdownlint disable single line ### markdownlint disable single line
```markdown ```markdown
## Here is some document ## Here is some document
Here is some random data Here is some random data
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
any violation you want any violation you want
<!-- markdownlint-restore --> <!-- markdownlint-restore -->
Here is more data Here is more data
``` ```
### markdownlint disable code block ### markdownlint disable code block
```markdown ```markdown
## Here is some document ## Here is some document
Here is some random data Here is some random data
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
any violations you want any violations you want
<!-- markdownlint-restore --> <!-- markdownlint-restore -->
Here is more data Here is more data
``` ```
### markdownlint disable entire file ### markdownlint disable entire file
- You can encapsulate the entire file with the *code block format* to disable an entire file from being parsed
-------------------------------------------------------------------------------- - You can encapsulate the entire file with the _code block format_ to disable an entire file from being parsed
---
## Perl ## Perl
- [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) - [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl)
### Perl Config file ### Perl Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### Perl disable single line ### Perl disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Perl disable code block ### Perl disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Perl disable entire file ### Perl disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Raku ## Raku
- [raku](https://raku.org) - [raku](https://raku.org)
### Raku Config file ### Raku Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### Raku disable single line ### Raku disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Raku disable code block ### Raku disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Raku disable entire file ### Raku disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
--------------------------------------------------------------------------------
---
## PHP ## PHP
- [PHP](https://www.php.net/) - [PHP](https://www.php.net/)
### PHP Config file ### PHP Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### PHP disable single line ### PHP disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### PHP disable code block ### PHP disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### PHP disable entire file ### PHP disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## XML ## XML
- [XML](http://xmlsoft.org/) - [XML](http://xmlsoft.org/)
### LibXML Config file ### LibXML Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### LibXML disable single line ### LibXML disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### LibXML disable code block ### LibXML disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### LibXML disable entire file ### LibXML disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Coffeescript ## Coffeescript
- [coffeelint](https://coffeelint.github.io/) - [coffeelint](https://coffeelint.github.io/)
### coffeelint Config file ### coffeelint Config file
- `.github/linters/.coffee-lint.yml` - `.github/linters/.coffee-lint.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.coffee.yml` - File should be located at: `.github/linters/.coffee.yml`
### coffeelint disable single line ### coffeelint disable single line
```Coffeescript ```Coffeescript
# coffeelint: disable=max_line_length # coffeelint: disable=max_line_length
foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
@ -423,6 +506,7 @@ foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/
``` ```
### coffeelint disable code block ### coffeelint disable code block
```Coffeescript ```Coffeescript
# coffeelint: disable # coffeelint: disable
foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
@ -433,181 +517,223 @@ taz = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/
``` ```
### coffeelint disable entire file ### coffeelint disable entire file
- You can encapsulate the entire file with the *code block format* to disable an entire file from being parsed
-------------------------------------------------------------------------------- - You can encapsulate the entire file with the _code block format_ to disable an entire file from being parsed
---
## Javascript eslint ## Javascript eslint
- [eslint](https://eslint.org/) - [eslint](https://eslint.org/)
### Javascript eslint Config file ### Javascript eslint Config file
- `.github/linters/.eslintrc.yml` - `.github/linters/.eslintrc.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.eslintrc.yml` - File should be located at: `.github/linters/.eslintrc.yml`
### Javascript eslint disable single line ### Javascript eslint disable single line
```javascript ```javascript
var thing = new Thing(); // eslint-disable-line no-use-before-define var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello(); thing.sayHello();
function Thing() { function Thing() {
this.sayHello = function () {
this.sayHello = function() { console.log("hello"); }; console.log("hello");
};
} }
``` ```
### Javascript eslint disable code block ### Javascript eslint disable code block
```javascript ```javascript
/*eslint-disable */ /*eslint-disable */
//suppress all warnings between comments //suppress all warnings between comments
alert('foo') alert("foo");
/*eslint-enable */ /*eslint-enable */
``` ```
### Javascript eslint disable entire file ### Javascript eslint disable entire file
- Place at the top of the file: - Place at the top of the file:
```javascript ```javascript
/* eslint-disable */ /* eslint-disable */
``` ```
-------------------------------------------------------------------------------- ---
## Javascript standard ## Javascript standard
- [standard js](https://standardjs.com/) - [standard js](https://standardjs.com/)
### Javascript standard Config file ### Javascript standard Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### Javascript standard disable single line ### Javascript standard disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Javascript standard disable code block ### Javascript standard disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Javascript standard disable entire file ### Javascript standard disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Typescript eslint ## Typescript eslint
- [eslint](https://eslint.org/) - [eslint](https://eslint.org/)
### Typescript eslint Config file ### Typescript eslint Config file
- `.github/linters/.eslintrc.yml` - `.github/linters/.eslintrc.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.eslintrc.yml` - File should be located at: `.github/linters/.eslintrc.yml`
### Typescript eslint disable single line ### Typescript eslint disable single line
```typescript ```typescript
var thing = new Thing(); // eslint-disable-line no-use-before-define var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello(); thing.sayHello();
function Thing() { function Thing() {
this.sayHello = function () {
this.sayHello = function() { console.log("hello"); }; console.log("hello");
};
} }
``` ```
### Typescript eslint disable code block ### Typescript eslint disable code block
```typescript ```typescript
/*eslint-disable */ /*eslint-disable */
//suppress all warnings between comments //suppress all warnings between comments
alert('foo') alert("foo");
/*eslint-enable */ /*eslint-enable */
``` ```
### Typescript eslint disable entire file ### Typescript eslint disable entire file
```typescript ```typescript
/* eslint-disable */ /* eslint-disable */
``` ```
-------------------------------------------------------------------------------- ---
## Typescript standard ## Typescript standard
- [standardjs](https://standardjs.com/) - [standardjs](https://standardjs.com/)
### Typescript standard Config file ### Typescript standard Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### Typescript standard disable single line ### Typescript standard disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Typescript standard disable code block ### Typescript standard disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Typescript standard disable entire file ### Typescript standard disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Golang ## Golang
- [golangci-lint](https://github.com/golangci/golangci-lint) - [golangci-lint](https://github.com/golangci/golangci-lint)
### golangci-lint standard Config file ### golangci-lint standard Config file
- `.github/linters/.golangci.yml` - `.github/linters/.golangci.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.golangci.yml` - File should be located at: `.github/linters/.golangci.yml`
### golangci-lint disable single line ### golangci-lint disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### golangci-lint disable code block ### golangci-lint disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### golangci-lint disable entire file ### golangci-lint disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Dockerfile ## Dockerfile
- [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) - [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git)
### Dockerfilelint standard Config file ### Dockerfilelint standard Config file
- `.github/linters/.dockerfilelintrc` - `.github/linters/.dockerfilelintrc`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.dockerfilelintrc` - File should be located at: `.github/linters/.dockerfilelintrc`
### Dockerfilelint disable single line ### Dockerfilelint disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Dockerfilelint disable code block ### Dockerfilelint disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### Dockerfilelint disable entire file ### Dockerfilelint disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Terraform ## Terraform
- [tflint](https://github.com/terraform-linters/tflint) - [tflint](https://github.com/terraform-linters/tflint)
### tflint standard Config file ### tflint standard Config file
- `.github/linters/.tflint.hcl` - `.github/linters/.tflint.hcl`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.tflint.hcl` - File should be located at: `.github/linters/.tflint.hcl`
### tflint disable single line ### tflint disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### tflint disable code block ### tflint disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### tflint disable entire file ### tflint disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## CSS ## CSS
- [stylelint](https://stylelint.io/) - [stylelint](https://stylelint.io/)
### stylelint standard Config file ### stylelint standard Config file
- `.github/linters/.stylelintrc.json` - `.github/linters/.stylelintrc.json`
### stylelint disable single line ### stylelint disable single line
```css ```css
#id { #id {
/* stylelint-disable-next-line declaration-no-important */ /* stylelint-disable-next-line declaration-no-important */
@ -616,14 +742,18 @@ alert('foo')
``` ```
### stylelint disable code block ### stylelint disable code block
```css ```css
/* stylelint-disable */ /* stylelint-disable */
a {} a {
}
/* stylelint-enable */ /* stylelint-enable */
``` ```
### stylelint disable entire file ### stylelint disable entire file
- You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json` - You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json`
```json ```json
{ {
"ignoreFiles": [ "ignoreFiles": [
@ -633,39 +763,48 @@ a {}
} }
``` ```
-------------------------------------------------------------------------------- ---
## ENV ## ENV
- [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) - [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter)
### dotenv-linter Config file ### dotenv-linter Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### dotenv-linter disable single line ### dotenv-linter disable single line
```env ```env
# Comment line will be ignored # Comment line will be ignored
``` ```
### dotenv-linter disable code block ### dotenv-linter disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### dotenv-linter disable entire file ### dotenv-linter disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Kotlin ## Kotlin
- [ktlint](https://github.com/pinterest/ktlint) - [ktlint](https://github.com/pinterest/ktlint)
### ktlint Config file ### ktlint Config file
- There is no top level *configuration file* available at this time
- There is no top level _configuration file_ available at this time
### ktlint disable single line ### ktlint disable single line
```kotlin ```kotlin
import package.* // ktlint-disable no-wildcard-imports import package.* // ktlint-disable no-wildcard-imports
``` ```
### ktlint disable code block ### ktlint disable code block
```kotlin ```kotlin
/* ktlint-disable no-wildcard-imports */ /* ktlint-disable no-wildcard-imports */
import package.a.* import package.a.*
@ -674,59 +813,72 @@ import package.b.*
``` ```
### ktlint disable entire file ### ktlint disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
-------------------------------------------------------------------------------- ---
## Dart ## Dart
- [dartanalyzer](https://dart.dev/tools/dartanalyzer) - [dartanalyzer](https://dart.dev/tools/dartanalyzer)
### dartanalyzer standard Config file ### dartanalyzer standard Config file
- `.github/linters/.dart-lint.yml` - `.github/linters/.dart-lint.yml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.dart-lint.yml` - File should be located at: `.github/linters/.dart-lint.yml`
### dartanalyzer disable single line ### dartanalyzer disable single line
```dart ```dart
int x = ''; // ignore: invalid_assignment int x = ''; // ignore: invalid_assignment
``` ```
### dartanalyzer disable code block ### dartanalyzer disable code block
- You can make [rule exceptions](https://dart.dev/guides/language/analysis-options#excluding-code-from-analysis) for the entire file. - You can make [rule exceptions](https://dart.dev/guides/language/analysis-options#excluding-code-from-analysis) for the entire file.
```dart ```dart
// ignore_for_file: unused_import, unused_local_variable // ignore_for_file: unused_import, unused_local_variable
``` ```
### dartanalyzer disable entire file ### dartanalyzer disable entire file
- You can disable entire files with the `analyzer.exclude` property in `.dart-lint.yml` - You can disable entire files with the `analyzer.exclude` property in `.dart-lint.yml`
```dart ```dart
analyzer: analyzer:
exclude: exclude:
- file - file
``` ```
-------------------------------------------------------------------------------- ---
## OpenAPI ## OpenAPI
- [spectral](https://github.com/stoplightio/spectral) - [spectral](https://github.com/stoplightio/spectral)
### OpenAPI Config file ### OpenAPI Config file
- `.github/linters/.openapirc.yml` - `.github/linters/.openapirc.yml`
- You can add, extend, and disable rules - You can add, extend, and disable rules
- Documentation at [Spectral Custom Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/4-custom-rulesets.md) - Documentation at [Spectral Custom Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/4-custom-rulesets.md)
- File should be located at: `.github/linters/.openapirc.yml` - File should be located at: `.github/linters/.openapirc.yml`
### OpenAPI disable single line ### OpenAPI disable single line
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### OpenAPI disable code block ### OpenAPI disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### OpenAPI disable entire file ### OpenAPI disable entire file
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
- However, you can make [rule exceptions](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/6-exceptions.md?srn=gh/stoplightio/spectral/docs/guides/6-exceptions.md) in the config for individual file(s). - However, you can make [rule exceptions](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/6-exceptions.md?srn=gh/stoplightio/spectral/docs/guides/6-exceptions.md) in the config for individual file(s).
-------------------------------------------------------------------------------- ---
## Protocol Buffers ## Protocol Buffers
@ -776,20 +928,25 @@ lint:
``` ```
## Clojure ## Clojure
- [clj-kondo](https://github.com/borkdude/clj-kondo) - [clj-kondo](https://github.com/borkdude/clj-kondo)
- Since clj-kondo approaches static analysis in a very Clojure way, it is advised to read the [configuration docs](https://github.com/borkdude/clj-kondo/blob/master/doc/config.md) - Since clj-kondo approaches static analysis in a very Clojure way, it is advised to read the [configuration docs](https://github.com/borkdude/clj-kondo/blob/master/doc/config.md)
### clj-kondo standard Config file ### clj-kondo standard Config file
- `.github/linters/.clj-kondo/config.edn` - `.github/linters/.clj-kondo/config.edn`
### clj-kondo disable single line ### clj-kondo disable single line
- There is currently **No** way to disable rules in a single line - There is currently **No** way to disable rules in a single line
### clj-kondo disable code block ### clj-kondo disable code block
- There is currently **No** way to disable rules in a code block - There is currently **No** way to disable rules in a code block
### clj-kondo disable entire file ### clj-kondo disable entire file
```clojure
````clojure
{:output {:exclude-files ["path/to/file"]}} {:output {:exclude-files ["path/to/file"]}}
## EDITORCONFIG-CHECKER ## EDITORCONFIG-CHECKER
@ -808,34 +965,42 @@ lint:
``` ```
### editorconfig-checker disable code block ### editorconfig-checker disable code block
- There is currently **No** way to disable rules inline of the file(s) - There is currently **No** way to disable rules inline of the file(s)
### editorconfig-checker disable entire file ### editorconfig-checker disable entire file
- -
```js ```js
// editorconfig-checker-disable-file // editorconfig-checker-disable-file
``` ```
- You can disable entire files with the `Exclude` property in `.ecrc` - You can disable entire files with the `Exclude` property in `.ecrc`
```json ```json
{ {
"Exclude": [ "Exclude": ["path/to/file", "^regular\\/expression\\.ext$"]
"path/to/file",
"^regular\\/expression\\.ext$"
]
} }
``` ```
## HTML ## HTML
- [htmlhint](https://htmlhint.com/) - [htmlhint](https://htmlhint.com/)
### htmlhint standard Config file ### htmlhint standard Config file
- `.github/linters/.htmlhintrc` - `.github/linters/.htmlhintrc`
### htmlhint disable single line ### htmlhint disable single line
- There is currently **No** way to disable rules in a single line - There is currently **No** way to disable rules in a single line
### htmlhint disable code block ### htmlhint disable code block
- There is currently **No** way to disable rules in a code block - There is currently **No** way to disable rules in a code block
### htmlhint disable entire file ### htmlhint disable entire file
- There is currently **No** way to disable rules in an entire file - There is currently **No** way to disable rules in an entire file
````

View file

@ -1,5 +1,7 @@
# Run Super-Linter locally to test your branch of code # Run Super-Linter locally to test your branch of code
If you want to test locally against the **Super-Linter** to test your branch of code, you will need to complete the following: If you want to test locally against the **Super-Linter** to test your branch of code, you will need to complete the following:
- Clone your testing source code to your local environment - Clone your testing source code to your local environment
- Install Docker to your local environment - Install Docker to your local environment
- Pull the container down - Pull the container down
@ -7,15 +9,19 @@ If you want to test locally against the **Super-Linter** to test your branch of
- Debug/Troubleshoot - Debug/Troubleshoot
## Install Docker to your local machine ## Install Docker to your local machine
You can follow the link below on how to install and configure **Docker** on your local machine You can follow the link below on how to install and configure **Docker** on your local machine
- [Docker Install Documentation](https://docs.docker.com/install/) - [Docker Install Documentation](https://docs.docker.com/install/)
## Download the latest Super-Linter Docker container ## Download the latest Super-Linter Docker container
- Pull the latest **Docker** container down from **DockerHub** - Pull the latest **Docker** container down from **DockerHub**
- `docker pull github/super-linter:latest` - `docker pull github/super-linter:latest`
Once the container has been downloaded to your local environment, you can then begin the process, or running the container against your codebase. Once the container has been downloaded to your local environment, you can then begin the process, or running the container against your codebase.
## Run the container Locally ## Run the container Locally
- You can run the container locally with the following **Base** flags to run your code: - You can run the container locally with the following **Base** flags to run your code:
- `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter` - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter`
- To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter` - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter`
@ -24,14 +30,18 @@ Once the container has been downloaded to your local environment, you can then b
- **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted - **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted
### Flags for running Locally ### Flags for running Locally
You can add as many **Additional** flags as needed, documented in [README.md](../README.md#Environment-variables) You can add as many **Additional** flags as needed, documented in [README.md](../README.md#Environment-variables)
## Troubleshooting ## Troubleshooting
### Run container and gain access to the command line ### Run container and gain access to the command line
If you need to run the container locally and gain access to its command line, you can run the following command: If you need to run the container locally and gain access to its command line, you can run the following command:
- `docker run -it --entrypoint /bin/bash github/super-linter` - `docker run -it --entrypoint /bin/bash github/super-linter`
- This will drop you in the command line of the docker container for any testing or troubleshooting that may be needed. - This will drop you in the command line of the docker container for any testing or troubleshooting that may be needed.
### Found issues ### Found issues
If you find a *bug* or *issue*, please open a **GitHub** issue at: `https://github.com/github/super-linter/issues`
If you find a _bug_ or _issue_, please open a **GitHub** issue at: [github/super-linter/issues](https://github.com/github/super-linter/issues)

View file

@ -1,10 +1,13 @@
# Super-Linter Library # Super-Linter Library
## Main script ## Main script
The file `linter.sh` is the main script that is called for the process and loads all other scripts as functions. The file `linter.sh` is the main script that is called for the process and loads all other scripts as functions.
## Functions ## Functions
The additional files in the folder are functions to help streamline the main build process and allow for easier maintenance. The additional files in the folder are functions to help streamline the main build process and allow for easier maintenance.
- `possum.sh` - `possum.sh`
- Official mascot of the **Super-Linter** - Official mascot of the **Super-Linter**
- `buildFileList.sh` - `buildFileList.sh`

View file

@ -16,7 +16,7 @@ function BuildFileList() {
################ ################
# print header # # print header #
################ ################
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Pulling in code history and branches..." echo "Pulling in code history and branches..."
@ -26,8 +26,8 @@ function BuildFileList() {
# Switch codebase back to the default branch to get a list of all files changed # # Switch codebase back to the default branch to get a list of all files changed #
################################################################################# #################################################################################
SWITCH_CMD=$( SWITCH_CMD=$(
git -C "$GITHUB_WORKSPACE" pull --quiet git -C "${GITHUB_WORKSPACE}" pull --quiet
git -C "$GITHUB_WORKSPACE" checkout "$DEFAULT_BRANCH" 2>&1 git -C "${GITHUB_WORKSPACE}" checkout "${DEFAULT_BRANCH}" 2>&1
) )
####################### #######################
@ -38,26 +38,26 @@ function BuildFileList() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Error # Error
echo "Failed to switch to $DEFAULT_BRANCH branch to get files changed!" echo "Failed to switch to ${DEFAULT_BRANCH} branch to get files changed!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${SWITCH_CMD}]${NC}"
exit 1 exit 1
fi fi
################ ################
# print header # # print header #
################ ################
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]" echo "Generating Diff with:[git diff --name-only '${DEFAULT_BRANCH}..${GITHUB_SHA}' --diff-filter=d]"
fi fi
################################################# #################################################
# Get the Array of files changed in the commits # # Get the Array of files changed in the commits #
################################################# #################################################
mapfile -t RAW_FILE_ARRAY < <(git -C "$GITHUB_WORKSPACE" diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1) mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "${DEFAULT_BRANCH}..${GITHUB_SHA}" --diff-filter=d 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -67,7 +67,7 @@ function BuildFileList() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Error # Error
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain a list of all files changed!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to gain a list of all files changed!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${RAW_FILE_ARRAY[*]}]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${RAW_FILE_ARRAY[*]}]${NC}"
@ -86,26 +86,26 @@ function BuildFileList() {
########################### ###########################
# Extract just the file and extension, reverse it, cut off extension, # Extract just the file and extension, reverse it, cut off extension,
# reverse it back, substitute to lowercase # reverse it back, substitute to lowercase
FILE_TYPE=$(basename "$FILE" | rev | cut -f1 -d'.' | rev | awk '{print tolower($0)}') FILE_TYPE=$(basename "${FILE}" | rev | cut -f1 -d'.' | rev | awk '{print tolower(${0})}')
############## ##############
# Print file # # Print file #
############## ##############
echo "File:[$FILE], File_type:[$FILE_TYPE]" echo "File:[${FILE}], File_type:[${FILE_TYPE}]"
######### #########
# DEBUG # # DEBUG #
######### #########
#echo "FILE_TYPE:[$FILE_TYPE]" #echo "FILE_TYPE:[${FILE_TYPE}]"
##################### #####################
# Get the CFN files # # Get the CFN files #
##################### #####################
if [ "$FILE_TYPE" == "yml" ] || [ "$FILE_TYPE" == "yaml" ]; then if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_YML+=("$FILE") FILE_ARRAY_YML+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -114,11 +114,11 @@ function BuildFileList() {
##################################### #####################################
# Check if the file is CFN template # # Check if the file is CFN template #
##################################### #####################################
if DetectCloudFormationFile "$FILE"; then if DetectCloudFormationFile "${FILE}"; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CFN+=("$FILE") FILE_ARRAY_CFN+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
@ -128,37 +128,37 @@ function BuildFileList() {
###################### ######################
# Get the JSON files # # Get the JSON files #
###################### ######################
elif [ "$FILE_TYPE" == "json" ]; then elif [ "${FILE_TYPE}" == "json" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_JSON+=("$FILE") FILE_ARRAY_JSON+=("${FILE}")
############################ ############################
# Check if file is OpenAPI # # Check if file is OpenAPI #
############################ ############################
if DetectOpenAPIFile "$FILE"; then if DetectOpenAPIFile "${FILE}"; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_OPENAPI+=("$FILE") FILE_ARRAY_OPENAPI+=("${FILE}")
fi fi
############################ ############################
# Check if file is ARM # # Check if file is ARM #
############################ ############################
if DetectARMFile "$FILE"; then if DetectARMFile "${FILE}"; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_ARM+=("$FILE") FILE_ARRAY_ARM+=("${FILE}")
fi fi
##################################### #####################################
# Check if the file is CFN template # # Check if the file is CFN template #
##################################### #####################################
if DetectCloudFormationFile "$FILE"; then if DetectCloudFormationFile "${FILE}"; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CFN+=("$FILE") FILE_ARRAY_CFN+=("${FILE}")
fi fi
############################################ ############################################
# Check if the file is AWS States Language # # Check if the file is AWS States Language #
@ -176,11 +176,11 @@ function BuildFileList() {
##################### #####################
# Get the XML files # # Get the XML files #
##################### #####################
elif [ "$FILE_TYPE" == "xml" ]; then elif [ "${FILE_TYPE}" == "xml" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_XML+=("$FILE") FILE_ARRAY_XML+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -188,19 +188,19 @@ function BuildFileList() {
########################## ##########################
# Get the MARKDOWN files # # Get the MARKDOWN files #
########################## ##########################
elif [ "$FILE_TYPE" == "md" ]; then elif [ "${FILE_TYPE}" == "md" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_MARKDOWN+=("$FILE") FILE_ARRAY_MARKDOWN+=("${FILE}")
###################### ######################
# Get the BASH files # # Get the BASH files #
###################### ######################
elif [ "$FILE_TYPE" == "sh" ]; then elif [ "${FILE_TYPE}" == "sh" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_BASH+=("$FILE") FILE_ARRAY_BASH+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -208,11 +208,11 @@ function BuildFileList() {
###################### ######################
# Get the PERL files # # Get the PERL files #
###################### ######################
elif [ "$FILE_TYPE" == "pl" ]; then elif [ "${FILE_TYPE}" == "pl" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_PERL+=("$FILE") FILE_ARRAY_PERL+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -220,13 +220,13 @@ function BuildFileList() {
###################### ######################
# Get the RAKU files # # Get the RAKU files #
###################### ######################
elif [ "$FILE_TYPE" == "raku" ] || [ "$FILE_TYPE" == "rakumod" ] \ elif [ "${FILE_TYPE}" == "raku" ] || [ "${FILE_TYPE}" == "rakumod" ] \
|| [ "$FILE_TYPE" == "rakutest" ] || [ "$FILE_TYPE" == "pm6" ] \ || [ "${FILE_TYPE}" == "rakutest" ] || [ "${FILE_TYPE}" == "pm6" ] \
|| [ "$FILE_TYPE" == "pl6" ] || [ "$FILE_TYPE" == "p6" ] ; then || [ "${FILE_TYPE}" == "pl6" ] || [ "${FILE_TYPE}" == "p6" ] ; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_RAKU+=("$FILE") FILE_ARRAY_RAKU+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -234,11 +234,11 @@ function BuildFileList() {
###################### ######################
# Get the PHP files # # Get the PHP files #
###################### ######################
elif [ "$FILE_TYPE" == "php" ]; then elif [ "${FILE_TYPE}" == "php" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_PHP+=("$FILE") FILE_ARRAY_PHP+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -246,11 +246,11 @@ function BuildFileList() {
###################### ######################
# Get the RUBY files # # Get the RUBY files #
###################### ######################
elif [ "$FILE_TYPE" == "rb" ]; then elif [ "${FILE_TYPE}" == "rb" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_RUBY+=("$FILE") FILE_ARRAY_RUBY+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -258,11 +258,11 @@ function BuildFileList() {
######################## ########################
# Get the PYTHON files # # Get the PYTHON files #
######################## ########################
elif [ "$FILE_TYPE" == "py" ]; then elif [ "${FILE_TYPE}" == "py" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_PYTHON+=("$FILE") FILE_ARRAY_PYTHON+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -270,11 +270,11 @@ function BuildFileList() {
######################## ########################
# Get the COFFEE files # # Get the COFFEE files #
######################## ########################
elif [ "$FILE_TYPE" == "coffee" ]; then elif [ "${FILE_TYPE}" == "coffee" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_COFFEESCRIPT+=("$FILE") FILE_ARRAY_COFFEESCRIPT+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -282,12 +282,12 @@ function BuildFileList() {
############################ ############################
# Get the JavaScript files # # Get the JavaScript files #
############################ ############################
elif [ "$FILE_TYPE" == "js" ]; then elif [ "${FILE_TYPE}" == "js" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_JAVASCRIPT_ES+=("$FILE") FILE_ARRAY_JAVASCRIPT_ES+=("${FILE}")
FILE_ARRAY_JAVASCRIPT_STANDARD+=("$FILE") FILE_ARRAY_JAVASCRIPT_STANDARD+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -295,11 +295,11 @@ function BuildFileList() {
############################ ############################
# Get the JSX files # # Get the JSX files #
############################ ############################
elif [ "$FILE_TYPE" == "jsx" ]; then elif [ "${FILE_TYPE}" == "jsx" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_JSX+=("$FILE") FILE_ARRAY_JSX+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -307,11 +307,11 @@ function BuildFileList() {
############################ ############################
# Get the TSX files # # Get the TSX files #
############################ ############################
elif [ "$FILE_TYPE" == "tsx" ]; then elif [ "${FILE_TYPE}" == "tsx" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_TSX+=("$FILE") FILE_ARRAY_TSX+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -322,12 +322,12 @@ function BuildFileList() {
############################ ############################
# Get the TypeScript files # # Get the TypeScript files #
############################ ############################
elif [ "$FILE_TYPE" == "ts" ]; then elif [ "${FILE_TYPE}" == "ts" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_TYPESCRIPT_ES+=("$FILE") FILE_ARRAY_TYPESCRIPT_ES+=("${FILE}")
FILE_ARRAY_TYPESCRIPT_STANDARD+=("$FILE") FILE_ARRAY_TYPESCRIPT_STANDARD+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -335,11 +335,11 @@ function BuildFileList() {
######################## ########################
# Get the Golang files # # Get the Golang files #
######################## ########################
elif [ "$FILE_TYPE" == "go" ]; then elif [ "${FILE_TYPE}" == "go" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_GO+=("$FILE") FILE_ARRAY_GO+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -347,11 +347,11 @@ function BuildFileList() {
########################### ###########################
# Get the Terraform files # # Get the Terraform files #
########################### ###########################
elif [ "$FILE_TYPE" == "tf" ]; then elif [ "${FILE_TYPE}" == "tf" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_TERRAFORM+=("$FILE") FILE_ARRAY_TERRAFORM+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -359,34 +359,34 @@ function BuildFileList() {
########################### ###########################
# Get the Powershell files # # Get the Powershell files #
########################### ###########################
elif [ "$FILE_TYPE" == "ps1" ]; then elif [ "${FILE_TYPE}" == "ps1" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_POWERSHELL+=("$FILE") FILE_ARRAY_POWERSHELL+=("${FILE}")
elif [ "$FILE_TYPE" == "css" ]; then elif [ "${FILE_TYPE}" == "css" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CSS+=("$FILE") FILE_ARRAY_CSS+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE_TYPE" == "env" ]; then elif [ "${FILE_TYPE}" == "env" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_ENV+=("$FILE") FILE_ARRAY_ENV+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE_TYPE" == "kt" ] || [ "$FILE_TYPE" == "kts" ]; then elif [ "${FILE_TYPE}" == "kt" ] || [ "${FILE_TYPE}" == "kts" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_KOTLIN+=("$FILE") FILE_ARRAY_KOTLIN+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -394,47 +394,47 @@ function BuildFileList() {
############################ ############################
# Get the Protocol Buffers files # # Get the Protocol Buffers files #
############################ ############################
elif [ "$FILE_TYPE" == "dart" ]; then elif [ "${FILE_TYPE}" == "dart" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_DART+=("$FILE") FILE_ARRAY_DART+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE_TYPE" == "proto" ]; then elif [ "${FILE_TYPE}" == "proto" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_PROTOBUF+=("$FILE") FILE_ARRAY_PROTOBUF+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE" == "dockerfile" ] || [ "$FILE_TYPE" == "dockerfile" ]; then elif [ "${FILE}" == "dockerfile" ] || [ "${FILE_TYPE}" == "dockerfile" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_DOCKER+=("$FILE") FILE_ARRAY_DOCKER+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE_TYPE" == "clj" ] || [ "$FILE_TYPE" == "cljs" ] || [ "$FILE_TYPE" == "cljc" ] || [ "$FILE_TYPE" == "edn" ]; then elif [ "${FILE_TYPE}" == "clj" ] || [ "${FILE_TYPE}" == "cljs" ] || [ "${FILE_TYPE}" == "cljc" ] || [ "${FILE_TYPE}" == "edn" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CLOJURE+=("$FILE") FILE_ARRAY_CLOJURE+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE_TYPE" == "html" ]; then elif [ "${FILE_TYPE}" == "html" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
##############################p## ##############################p##
FILE_ARRAY_HTML+=("$FILE") FILE_ARRAY_HTML+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -443,12 +443,12 @@ function BuildFileList() {
############################################## ##############################################
# Use file to see if we can parse what it is # # Use file to see if we can parse what it is #
############################################## ##############################################
GET_FILE_TYPE_CMD=$(file "$FILE" 2>&1) GET_FILE_TYPE_CMD=$(file "${FILE}" 2>&1)
################# #################
# Check if bash # # Check if bash #
################# #################
if [[ $GET_FILE_TYPE_CMD == *"Bourne-Again shell script"* ]]; then if [[ ${GET_FILE_TYPE_CMD} == *"Bourne-Again shell script"* ]]; then
####################### #######################
# It is a bash script # # It is a bash script #
####################### #######################
@ -457,12 +457,12 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_BASH+=("$FILE") FILE_ARRAY_BASH+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
elif [[ $GET_FILE_TYPE_CMD == *"Ruby script"* ]]; then elif [[ ${GET_FILE_TYPE_CMD} == *"Ruby script"* ]]; then
####################### #######################
# It is a Ruby script # # It is a Ruby script #
####################### #######################
@ -471,7 +471,7 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_RUBY+=("$FILE") FILE_ARRAY_RUBY+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -480,7 +480,7 @@ function BuildFileList() {
############################ ############################
# Extension was not found! # # Extension was not found! #
############################ ############################
echo -e "${NC}${F[Y]} - WARN!${NC} Failed to get filetype for:[$FILE]!${NC}" echo -e "${NC}${F[Y]} - WARN!${NC} Failed to get filetype for:[${FILE}]!${NC}"
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
########################################################## ##########################################################
@ -494,7 +494,7 @@ function BuildFileList() {
######################################### #########################################
# Need to switch back to branch of code # # Need to switch back to branch of code #
######################################### #########################################
SWITCH2_CMD=$(git -C "$GITHUB_WORKSPACE" checkout --progress --force "$GITHUB_SHA" 2>&1) SWITCH2_CMD=$(git -C "${GITHUB_WORKSPACE}" checkout --progress --force "${GITHUB_SHA}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -504,10 +504,10 @@ function BuildFileList() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Error # Error
echo "Failed to switch back to branch!" echo "Failed to switch back to branch!"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$SWITCH2_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${SWITCH2_CMD}]${NC}"
exit 1 exit 1
fi fi

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@ function GetValidationInfo() {
########################################### ###########################################
# Skip validation if were running locally # # Skip validation if were running locally #
########################################### ###########################################
if [[ $RUN_LOCAL != "true" ]]; then if [[ ${RUN_LOCAL} != "true" ]]; then
############################### ###############################
# Convert string to lowercase # # Convert string to lowercase #
############################### ###############################
@ -28,9 +28,9 @@ function GetValidationInfo() {
###################################### ######################################
# Validate we should check all files # # Validate we should check all files #
###################################### ######################################
if [[ $VALIDATE_ALL_CODEBASE != "false" ]]; then if [[ ${VALIDATE_ALL_CODEBASE} != "false" ]]; then
# Set to true # Set to true
VALIDATE_ALL_CODEBASE="$DEFAULT_VALIDATE_ALL_CODEBASE" VALIDATE_ALL_CODEBASE="${DEFAULT_VALIDATE_ALL_CODEBASE}"
echo "- Validating ALL files in code base..." echo "- Validating ALL files in code base..."
else else
# Its false # Its false
@ -120,9 +120,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check YAML # # Validate if we should check YAML #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_YAML ]]; then if [[ -z ${VALIDATE_YAML} ]]; then
# YAML flag was not set - default to false # YAML flag was not set - default to false
VALIDATE_YAML="false" VALIDATE_YAML="false"
fi fi
@ -134,9 +134,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check JSON # # Validate if we should check JSON #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_JSON ]]; then if [[ -z ${VALIDATE_JSON} ]]; then
# JSON flag was not set - default to false # JSON flag was not set - default to false
VALIDATE_JSON="false" VALIDATE_JSON="false"
fi fi
@ -148,9 +148,9 @@ function GetValidationInfo() {
################################### ###################################
# Validate if we should check XML # # Validate if we should check XML #
################################### ###################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_XML ]]; then if [[ -z ${VALIDATE_XML} ]]; then
# XML flag was not set - default to false # XML flag was not set - default to false
VALIDATE_XML="false" VALIDATE_XML="false"
fi fi
@ -162,9 +162,9 @@ function GetValidationInfo() {
######################################## ########################################
# Validate if we should check MARKDOWN # # Validate if we should check MARKDOWN #
######################################## ########################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_MARKDOWN ]]; then if [[ -z ${VALIDATE_MARKDOWN} ]]; then
# MD flag was not set - default to false # MD flag was not set - default to false
VALIDATE_MARKDOWN="false" VALIDATE_MARKDOWN="false"
fi fi
@ -176,9 +176,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check BASH # # Validate if we should check BASH #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_BASH ]]; then if [[ -z ${VALIDATE_BASH} ]]; then
# BASH flag was not set - default to false # BASH flag was not set - default to false
VALIDATE_BASH="false" VALIDATE_BASH="false"
fi fi
@ -190,9 +190,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check PERL # # Validate if we should check PERL #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_PERL ]]; then if [[ -z ${VALIDATE_PERL} ]]; then
# PERL flag was not set - default to false # PERL flag was not set - default to false
VALIDATE_PERL="false" VALIDATE_PERL="false"
fi fi
@ -204,9 +204,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check RAKU # # Validate if we should check RAKU #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_RAKU ]]; then if [[ -z ${VALIDATE_RAKU} ]]; then
# RAKU flag was not set - default to false # RAKU flag was not set - default to false
VALIDATE_RAKU="false" VALIDATE_RAKU="false"
fi fi
@ -218,9 +218,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check PHP # # Validate if we should check PHP #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_PHP ]]; then if [[ -z ${VALIDATE_PHP} ]]; then
# PHP flag was not set - default to false # PHP flag was not set - default to false
VALIDATE_PHP="false" VALIDATE_PHP="false"
fi fi
@ -232,9 +232,9 @@ function GetValidationInfo() {
###################################### ######################################
# Validate if we should check PYTHON # # Validate if we should check PYTHON #
###################################### ######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_PYTHON ]]; then if [[ -z ${VALIDATE_PYTHON} ]]; then
# PYTHON flag was not set - default to false # PYTHON flag was not set - default to false
VALIDATE_PYTHON="false" VALIDATE_PYTHON="false"
fi fi
@ -246,9 +246,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check RUBY # # Validate if we should check RUBY #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_RUBY ]]; then if [[ -z ${VALIDATE_RUBY} ]]; then
# RUBY flag was not set - default to false # RUBY flag was not set - default to false
VALIDATE_RUBY="false" VALIDATE_RUBY="false"
fi fi
@ -274,9 +274,9 @@ function GetValidationInfo() {
###################################### ######################################
# Validate if we should check COFFEE # # Validate if we should check COFFEE #
###################################### ######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_COFFEE ]]; then if [[ -z ${VALIDATE_COFFEE} ]]; then
# COFFEE flag was not set - default to false # COFFEE flag was not set - default to false
VALIDATE_COFFEE="false" VALIDATE_COFFEE="false"
fi fi
@ -288,9 +288,9 @@ function GetValidationInfo() {
####################################### #######################################
# Validate if we should check ANSIBLE # # Validate if we should check ANSIBLE #
####################################### #######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_ANSIBLE ]]; then if [[ -z ${VALIDATE_ANSIBLE} ]]; then
# ANSIBLE flag was not set - default to false # ANSIBLE flag was not set - default to false
VALIDATE_ANSIBLE="false" VALIDATE_ANSIBLE="false"
fi fi
@ -302,9 +302,9 @@ function GetValidationInfo() {
############################################# #############################################
# Validate if we should check JAVASCRIPT_ES # # Validate if we should check JAVASCRIPT_ES #
############################################# #############################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_JAVASCRIPT_ES ]]; then if [[ -z ${VALIDATE_JAVASCRIPT_ES} ]]; then
# JAVASCRIPT_ES flag was not set - default to false # JAVASCRIPT_ES flag was not set - default to false
VALIDATE_JAVASCRIPT_ES="false" VALIDATE_JAVASCRIPT_ES="false"
fi fi
@ -316,9 +316,9 @@ function GetValidationInfo() {
################################################### ###################################################
# Validate if we should check JAVASCRIPT_STANDARD # # Validate if we should check JAVASCRIPT_STANDARD #
################################################### ###################################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_JAVASCRIPT_STANDARD ]]; then if [[ -z ${VALIDATE_JAVASCRIPT_STANDARD} ]]; then
# JAVASCRIPT_STANDARD flag was not set - default to false # JAVASCRIPT_STANDARD flag was not set - default to false
VALIDATE_JAVASCRIPT_STANDARD="false" VALIDATE_JAVASCRIPT_STANDARD="false"
fi fi
@ -330,9 +330,9 @@ function GetValidationInfo() {
############################################# #############################################
# Validate if we should check JSX # # Validate if we should check JSX #
############################################# #############################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_JSX ]]; then if [[ -z ${VALIDATE_JSX} ]]; then
# JSX flag was not set - default to false # JSX flag was not set - default to false
VALIDATE_JSX="false" VALIDATE_JSX="false"
fi fi
@ -344,9 +344,9 @@ function GetValidationInfo() {
############################################# #############################################
# Validate if we should check TSX # # Validate if we should check TSX #
############################################# #############################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_TSX ]]; then if [[ -z ${VALIDATE_TSX} ]]; then
# TSX flag was not set - default to false # TSX flag was not set - default to false
VALIDATE_TSX="false" VALIDATE_TSX="false"
fi fi
@ -358,9 +358,9 @@ function GetValidationInfo() {
############################################# #############################################
# Validate if we should check TYPESCRIPT_ES # # Validate if we should check TYPESCRIPT_ES #
############################################# #############################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_TYPESCRIPT_ES ]]; then if [[ -z ${VALIDATE_TYPESCRIPT_ES} ]]; then
# TYPESCRIPT_ES flag was not set - default to false # TYPESCRIPT_ES flag was not set - default to false
VALIDATE_TYPESCRIPT_ES="false" VALIDATE_TYPESCRIPT_ES="false"
fi fi
@ -372,9 +372,9 @@ function GetValidationInfo() {
################################################### ###################################################
# Validate if we should check TYPESCRIPT_STANDARD # # Validate if we should check TYPESCRIPT_STANDARD #
################################################### ###################################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_TYPESCRIPT_STANDARD ]]; then if [[ -z ${VALIDATE_TYPESCRIPT_STANDARD} ]]; then
# TYPESCRIPT_STANDARD flag was not set - default to false # TYPESCRIPT_STANDARD flag was not set - default to false
VALIDATE_TYPESCRIPT_STANDARD="false" VALIDATE_TYPESCRIPT_STANDARD="false"
fi fi
@ -386,9 +386,9 @@ function GetValidationInfo() {
###################################### ######################################
# Validate if we should check DOCKER # # Validate if we should check DOCKER #
###################################### ######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_DOCKER ]]; then if [[ -z ${VALIDATE_DOCKER} ]]; then
# DOCKER flag was not set - default to false # DOCKER flag was not set - default to false
VALIDATE_DOCKER="false" VALIDATE_DOCKER="false"
fi fi
@ -400,9 +400,9 @@ function GetValidationInfo() {
################################## ##################################
# Validate if we should check GO # # Validate if we should check GO #
################################## ##################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_GO ]]; then if [[ -z ${VALIDATE_GO} ]]; then
# GO flag was not set - default to false # GO flag was not set - default to false
VALIDATE_GO="false" VALIDATE_GO="false"
fi fi
@ -414,9 +414,9 @@ function GetValidationInfo() {
######################################### #########################################
# Validate if we should check TERRAFORM # # Validate if we should check TERRAFORM #
######################################### #########################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_TERRAFORM ]]; then if [[ -z ${VALIDATE_TERRAFORM} ]]; then
# TERRAFORM flag was not set - default to false # TERRAFORM flag was not set - default to false
VALIDATE_TERRAFORM="false" VALIDATE_TERRAFORM="false"
fi fi
@ -428,9 +428,9 @@ function GetValidationInfo() {
######################################### #########################################
# Validate if we should check POWERSHELL # # Validate if we should check POWERSHELL #
######################################### #########################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_POWERSHELL ]]; then if [[ -z ${VALIDATE_POWERSHELL} ]]; then
# POWERSHELL flag was not set - default to false # POWERSHELL flag was not set - default to false
VALIDATE_POWERSHELL="false" VALIDATE_POWERSHELL="false"
fi fi
@ -442,9 +442,9 @@ function GetValidationInfo() {
################################### ###################################
# Validate if we should check ARM # # Validate if we should check ARM #
################################### ###################################
if [[ "$ANY_SET" == "true" ]]; then if [[ "${ANY_SET}" == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_ARM" ]]; then if [[ -z "${VALIDATE_ARM}" ]]; then
# ARM flag was not set - default to false # ARM flag was not set - default to false
VALIDATE_ARM="false" VALIDATE_ARM="false"
fi fi
@ -456,9 +456,9 @@ function GetValidationInfo() {
################################### ###################################
# Validate if we should check CSS # # Validate if we should check CSS #
################################### ###################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_CSS ]]; then if [[ -z ${VALIDATE_CSS} ]]; then
# CSS flag was not set - default to false # CSS flag was not set - default to false
VALIDATE_CSS="false" VALIDATE_CSS="false"
fi fi
@ -470,9 +470,9 @@ function GetValidationInfo() {
################################### ###################################
# Validate if we should check ENV # # Validate if we should check ENV #
################################### ###################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_ENV ]]; then if [[ -z ${VALIDATE_ENV} ]]; then
# ENV flag was not set - default to false # ENV flag was not set - default to false
VALIDATE_ENV="false" VALIDATE_ENV="false"
fi fi
@ -484,9 +484,9 @@ function GetValidationInfo() {
###################################### ######################################
# Validate if we should check KOTLIN # # Validate if we should check KOTLIN #
###################################### ######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_KOTLIN ]]; then if [[ -z ${VALIDATE_KOTLIN} ]]; then
# ENV flag was not set - default to false # ENV flag was not set - default to false
VALIDATE_KOTLIN="false" VALIDATE_KOTLIN="false"
fi fi
@ -498,9 +498,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check DART # # Validate if we should check DART #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_DART ]]; then if [[ -z ${VALIDATE_DART} ]]; then
# ENV flag was not set - default to false # ENV flag was not set - default to false
VALIDATE_DART="false" VALIDATE_DART="false"
fi fi
@ -512,9 +512,9 @@ function GetValidationInfo() {
####################################### #######################################
# Validate if we should check OPENAPI # # Validate if we should check OPENAPI #
####################################### #######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_OPENAPI ]]; then if [[ -z ${VALIDATE_OPENAPI} ]]; then
# OPENAPI flag was not set - default to false # OPENAPI flag was not set - default to false
VALIDATE_OPENAPI="false" VALIDATE_OPENAPI="false"
fi fi
@ -526,9 +526,9 @@ function GetValidationInfo() {
####################################### #######################################
# Validate if we should check PROTOBUF # # Validate if we should check PROTOBUF #
####################################### #######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_PROTOBUF ]]; then if [[ -z ${VALIDATE_PROTOBUF} ]]; then
# PROTOBUF flag was not set - default to false # PROTOBUF flag was not set - default to false
VALIDATE_PROTOBUF="false" VALIDATE_PROTOBUF="false"
fi fi
@ -540,9 +540,9 @@ function GetValidationInfo() {
####################################### #######################################
# Validate if we should check Clojure # # Validate if we should check Clojure #
####################################### #######################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_CLOJURE ]]; then if [[ -z ${VALIDATE_CLOJURE} ]]; then
# Clojure flag was not set - default to false # Clojure flag was not set - default to false
VALIDATE_CLOJURE="false" VALIDATE_CLOJURE="false"
fi fi
@ -554,16 +554,16 @@ function GetValidationInfo() {
############################################ ############################################
# Validate if we should check editorconfig # # Validate if we should check editorconfig #
############################################ ############################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_EDITORCONFIG ]]; then if [[ -z ${VALIDATE_EDITORCONFIG} ]]; then
# EDITORCONFIG flag was not set - default to false # EDITORCONFIG flag was not set - default to false
VALIDATE_EDITORCONFIG="false" VALIDATE_EDITORCONFIG="false"
fi fi
else else
# No linter flags were set # No linter flags were set
# special case checking for .editorconfig # special case checking for .editorconfig
if [ -f "$GITHUB_WORKSPACE/.editorconfig" ]; then if [ -f "${GITHUB_WORKSPACE}/.editorconfig" ]; then
VALIDATE_EDITORCONFIG="true" VALIDATE_EDITORCONFIG="true"
fi fi
fi fi
@ -571,9 +571,9 @@ function GetValidationInfo() {
#################################### ####################################
# Validate if we should check HTML # # Validate if we should check HTML #
#################################### ####################################
if [[ $ANY_SET == "true" ]]; then if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true # Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_HTML ]]; then if [[ -z ${VALIDATE_HTML} ]]; then
# HTML flag was not set - default to false # HTML flag was not set - default to false
VALIDATE_HTML="false" VALIDATE_HTML="false"
fi fi
@ -585,152 +585,152 @@ function GetValidationInfo() {
####################################### #######################################
# Print which linters we are enabling # # Print which linters we are enabling #
####################################### #######################################
if [[ $VALIDATE_YAML == "true" ]]; then if [[ ${VALIDATE_YAML} == "true" ]]; then
PRINT_ARRAY+=("- Validating [YAML] files in code base...") PRINT_ARRAY+=("- Validating [YAML] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [YAML] files in code base...") PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
fi fi
if [[ $VALIDATE_JSON == "true" ]]; then if [[ ${VALIDATE_JSON} == "true" ]]; then
PRINT_ARRAY+=("- Validating [JSON] files in code base...") PRINT_ARRAY+=("- Validating [JSON] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [JSON] files in code base...") PRINT_ARRAY+=("- Excluding [JSON] files in code base...")
fi fi
if [[ $VALIDATE_XML == "true" ]]; then if [[ ${VALIDATE_XML} == "true" ]]; then
PRINT_ARRAY+=("- Validating [XML] files in code base...") PRINT_ARRAY+=("- Validating [XML] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [XML] files in code base...") PRINT_ARRAY+=("- Excluding [XML] files in code base...")
fi fi
if [[ $VALIDATE_MARKDOWN == "true" ]]; then if [[ ${VALIDATE_MARKDOWN} == "true" ]]; then
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...") PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...") PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
fi fi
if [[ $VALIDATE_BASH == "true" ]]; then if [[ ${VALIDATE_BASH} == "true" ]]; then
PRINT_ARRAY+=("- Validating [BASH] files in code base...") PRINT_ARRAY+=("- Validating [BASH] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [BASH] files in code base...") PRINT_ARRAY+=("- Excluding [BASH] files in code base...")
fi fi
if [[ $VALIDATE_PERL == "true" ]]; then if [[ ${VALIDATE_PERL} == "true" ]]; then
PRINT_ARRAY+=("- Validating [PERL] files in code base...") PRINT_ARRAY+=("- Validating [PERL] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [PERL] files in code base...") PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
fi fi
if [[ $VALIDATE_RAKU == "true" ]]; then if [[ ${VALIDATE_RAKU} == "true" ]]; then
PRINT_ARRAY+=("- Validating [RAKU] files in code base...") PRINT_ARRAY+=("- Validating [RAKU] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [RAKU] files in code base...") PRINT_ARRAY+=("- Excluding [RAKU] files in code base...")
fi fi
if [[ $VALIDATE_PHP == "true" ]]; then if [[ ${VALIDATE_PHP} == "true" ]]; then
PRINT_ARRAY+=("- Validating [PHP] files in code base...") PRINT_ARRAY+=("- Validating [PHP] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [PHP] files in code base...") PRINT_ARRAY+=("- Excluding [PHP] files in code base...")
fi fi
if [[ $VALIDATE_PYTHON == "true" ]]; then if [[ ${VALIDATE_PYTHON} == "true" ]]; then
PRINT_ARRAY+=("- Validating [PYTHON] files in code base...") PRINT_ARRAY+=("- Validating [PYTHON] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...") PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...")
fi fi
if [[ $VALIDATE_RUBY == "true" ]]; then if [[ ${VALIDATE_RUBY} == "true" ]]; then
PRINT_ARRAY+=("- Validating [RUBY] files in code base...") PRINT_ARRAY+=("- Validating [RUBY] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [RUBY] files in code base...") PRINT_ARRAY+=("- Excluding [RUBY] files in code base...")
fi fi
if [[ $VALIDATE_COFFEE == "true" ]]; then if [[ ${VALIDATE_COFFEE} == "true" ]]; then
PRINT_ARRAY+=("- Validating [COFFEE] files in code base...") PRINT_ARRAY+=("- Validating [COFFEE] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...") PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...")
fi fi
if [[ $VALIDATE_ANSIBLE == "true" ]]; then if [[ ${VALIDATE_ANSIBLE} == "true" ]]; then
PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...") PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...") PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...")
fi fi
if [[ $VALIDATE_JAVASCRIPT_ES == "true" ]]; then if [[ ${VALIDATE_JAVASCRIPT_ES} == "true" ]]; then
PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...") PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...") PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...")
fi fi
if [[ $VALIDATE_JAVASCRIPT_STANDARD == "true" ]]; then if [[ ${VALIDATE_JAVASCRIPT_STANDARD} == "true" ]]; then
PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...") PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...") PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...")
fi fi
if [[ $VALIDATE_TYPESCRIPT_ES == "true" ]]; then if [[ ${VALIDATE_TYPESCRIPT_ES} == "true" ]]; then
PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...") PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...") PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...")
fi fi
if [[ $VALIDATE_TYPESCRIPT_STANDARD == "true" ]]; then if [[ ${VALIDATE_TYPESCRIPT_STANDARD} == "true" ]]; then
PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...") PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...") PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...")
fi fi
if [[ $VALIDATE_DOCKER == "true" ]]; then if [[ ${VALIDATE_DOCKER} == "true" ]]; then
PRINT_ARRAY+=("- Validating [DOCKER] files in code base...") PRINT_ARRAY+=("- Validating [DOCKER] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...") PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...")
fi fi
if [[ $VALIDATE_GO == "true" ]]; then if [[ ${VALIDATE_GO} == "true" ]]; then
PRINT_ARRAY+=("- Validating [GOLANG] files in code base...") PRINT_ARRAY+=("- Validating [GOLANG] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...") PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...")
fi fi
if [[ $VALIDATE_TERRAFORM == "true" ]]; then if [[ ${VALIDATE_TERRAFORM} == "true" ]]; then
PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...") PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...") PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...")
fi fi
if [[ $VALIDATE_POWERSHELL == "true" ]]; then if [[ ${VALIDATE_POWERSHELL} == "true" ]]; then
PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...") PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...") PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...")
fi fi
if [[ $VALIDATE_ARM == "true" ]]; then if [[ ${VALIDATE_ARM} == "true" ]]; then
PRINT_ARRAY+=("- Validating [ARM] files in code base...") PRINT_ARRAY+=("- Validating [ARM] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [ARM] files in code base...") PRINT_ARRAY+=("- Excluding [ARM] files in code base...")
fi fi
if [[ $VALIDATE_CSS == "true" ]]; then if [[ ${VALIDATE_CSS} == "true" ]]; then
PRINT_ARRAY+=("- Validating [CSS] files in code base...") PRINT_ARRAY+=("- Validating [CSS] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [CSS] files in code base...") PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
fi fi
if [[ $VALIDATE_CLOJURE == "true" ]]; then if [[ ${VALIDATE_CLOJURE} == "true" ]]; then
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...") PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...") PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
fi fi
if [[ $VALIDATE_ENV == "true" ]]; then if [[ ${VALIDATE_ENV} == "true" ]]; then
PRINT_ARRAY+=("- Validating [ENV] files in code base...") PRINT_ARRAY+=("- Validating [ENV] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [ENV] files in code base...") PRINT_ARRAY+=("- Excluding [ENV] files in code base...")
fi fi
if [[ $VALIDATE_KOTLIN == "true" ]]; then if [[ ${VALIDATE_KOTLIN} == "true" ]]; then
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...") PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...") PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
fi fi
if [[ $VALIDATE_OPENAPI == "true" ]]; then if [[ ${VALIDATE_OPENAPI} == "true" ]]; then
PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...") PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...") PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...")
fi fi
if [[ $VALIDATE_PROTOBUF == "true" ]]; then if [[ ${VALIDATE_PROTOBUF} == "true" ]]; then
PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...") PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...") PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
fi fi
if [[ $VALIDATE_DART == "true" ]]; then if [[ ${VALIDATE_DART} == "true" ]]; then
PRINT_ARRAY+=("- Validating [DART] files in code base...") PRINT_ARRAY+=("- Validating [DART] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [DART] files in code base...") PRINT_ARRAY+=("- Excluding [DART] files in code base...")
fi fi
if [[ $VALIDATE_EDITORCONFIG == "true" ]]; then if [[ ${VALIDATE_EDITORCONFIG} == "true" ]]; then
PRINT_ARRAY+=("- Validating [EDITORCONFIG] files in code base...") PRINT_ARRAY+=("- Validating [EDITORCONFIG] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [EDITORCONFIG] files in code base...") PRINT_ARRAY+=("- Excluding [EDITORCONFIG] files in code base...")
fi fi
if [[ $VALIDATE_HTML == "true" ]]; then if [[ ${VALIDATE_HTML} == "true" ]]; then
PRINT_ARRAY+=("- Validating [HTML] files in code base...") PRINT_ARRAY+=("- Validating [HTML] files in code base...")
else else
PRINT_ARRAY+=("- Excluding [HTML] files in code base...") PRINT_ARRAY+=("- Excluding [HTML] files in code base...")
@ -744,9 +744,9 @@ function GetValidationInfo() {
############################## ##############################
# Validate Ansible Directory # # Validate Ansible Directory #
############################## ##############################
if [ -z "$ANSIBLE_DIRECTORY" ]; then if [ -z "${ANSIBLE_DIRECTORY}" ]; then
# No Value, need to default # No Value, need to default
ANSIBLE_DIRECTORY="$DEFAULT_ANSIBLE_DIRECTORY" ANSIBLE_DIRECTORY="${DEFAULT_ANSIBLE_DIRECTORY}"
else else
# Check if first char is '/' # Check if first char is '/'
if [[ ${ANSIBLE_DIRECTORY:0:1} == "/" ]]; then if [[ ${ANSIBLE_DIRECTORY:0:1} == "/" ]]; then
@ -754,19 +754,19 @@ function GetValidationInfo() {
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:1}" ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:1}"
fi fi
# Need to give it full path # Need to give it full path
TEMP_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/$ANSIBLE_DIRECTORY" TEMP_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/${ANSIBLE_DIRECTORY}"
# Set the value # Set the value
ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" ANSIBLE_DIRECTORY="${TEMP_ANSIBLE_DIRECTORY}"
fi fi
############################### ###############################
# Get the disable errors flag # # Get the disable errors flag #
############################### ###############################
if [ -z "$DISABLE_ERRORS" ]; then if [ -z "${DISABLE_ERRORS}" ]; then
################################## ##################################
# No flag passed, set to default # # No flag passed, set to default #
################################## ##################################
DISABLE_ERRORS="$DEFAULT_DISABLE_ERRORS" DISABLE_ERRORS="${DEFAULT_DISABLE_ERRORS}"
fi fi
############################### ###############################
@ -777,18 +777,18 @@ function GetValidationInfo() {
############################ ############################
# Set to false if not true # # Set to false if not true #
############################ ############################
if [ "$DISABLE_ERRORS" != "true" ]; then if [ "${DISABLE_ERRORS}" != "true" ]; then
DISABLE_ERRORS="false" DISABLE_ERRORS="false"
fi fi
############################ ############################
# Get the run verbose flag # # Get the run verbose flag #
############################ ############################
if [ -z "$ACTIONS_RUNNER_DEBUG" ]; then if [ -z "${ACTIONS_RUNNER_DEBUG}" ]; then
################################## ##################################
# No flag passed, set to default # # No flag passed, set to default #
################################## ##################################
ACTIONS_RUNNER_DEBUG="$DEFAULT_ACTIONS_RUNNER_DEBUG" ACTIONS_RUNNER_DEBUG="${DEFAULT_ACTIONS_RUNNER_DEBUG}"
fi fi
############################### ###############################
@ -799,25 +799,25 @@ function GetValidationInfo() {
############################ ############################
# Set to true if not false # # Set to true if not false #
############################ ############################
if [ "$ACTIONS_RUNNER_DEBUG" != "false" ]; then if [ "${ACTIONS_RUNNER_DEBUG}" != "false" ]; then
ACTIONS_RUNNER_DEBUG="true" ACTIONS_RUNNER_DEBUG="true"
fi fi
################### ###################
# Debug on runner # # Debug on runner #
################### ###################
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
########################### ###########################
# Print the validate info # # Print the validate info #
########################### ###########################
for LINE in "${PRINT_ARRAY[@]}"; do for LINE in "${PRINT_ARRAY[@]}"; do
echo "$LINE" echo "${LINE}"
done done
echo "--- DEBUG INFO ---" echo "--- DEBUG INFO ---"
echo "---------------------------------------------" echo "---------------------------------------------"
RUNNER=$(whoami) RUNNER=$(whoami)
echo "Runner:[$RUNNER]" echo "Runner:[${RUNNER}]"
echo "ENV:" echo "ENV:"
printenv printenv
echo "---------------------------------------------" echo "---------------------------------------------"

View file

@ -13,11 +13,11 @@ function LintCodebase() {
#################### ####################
# Pull in the vars # # Pull in the vars #
#################### ####################
FILE_TYPE="$1" && shift # Pull the variable and remove from array path (Example: JSON) FILE_TYPE="${1}" && shift # Pull the variable and remove from array path (Example: JSON)
LINTER_NAME="$1" && shift # Pull the variable and remove from array path (Example: jsonlint) LINTER_NAME="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint)
LINTER_COMMAND="$1" && shift # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file) LINTER_COMMAND="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
FILE_EXTENSIONS="$1" && shift # Pull the variable and remove from array path (Example: *.json) FILE_EXTENSIONS="${1}" && shift # Pull the variable and remove from array path (Example: *.json)
FILE_ARRAY=("$@") # Array of files to validate (Example: $FILE_ARRAY_JSON) FILE_ARRAY=("$@") # Array of files to validate (Example: ${FILE_ARRAY_JSON})
###################### ######################
# Create Print Array # # Create Print Array #
@ -30,14 +30,14 @@ function LintCodebase() {
PRINT_ARRAY+=("") PRINT_ARRAY+=("")
PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------")
PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------")
PRINT_ARRAY+=("Linting [$FILE_TYPE] files...") PRINT_ARRAY+=("Linting [${FILE_TYPE}] files...")
PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------")
PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------")
##################################### #####################################
# Validate we have linter installed # # Validate we have linter installed #
##################################### #####################################
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1) VALIDATE_INSTALL_CMD=$(command -v "${LINTER_NAME}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -47,15 +47,15 @@ function LintCodebase() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Failed # Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [${LINTER_NAME}] in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${VALIDATE_INSTALL_CMD}]${NC}"
exit 1 exit 1
else else
# Success # Success
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
echo -e "${NC}${F[B]}Successfully found binary for ${F[W]}[$LINTER_NAME]${F[B]} in system location: ${F[W]}[$VALIDATE_INSTALL_CMD]${NC}" echo -e "${NC}${F[B]}Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]${NC}"
fi fi
fi fi
@ -72,10 +72,10 @@ function LintCodebase() {
############################################################ ############################################################
# Check to see if we need to go through array or all files # # Check to see if we need to go through array or all files #
############################################################ ############################################################
if [ ${#FILE_ARRAY[@]} -eq 0 ] && [ "$VALIDATE_ALL_CODEBASE" == "false" ]; then if [ ${#FILE_ARRAY[@]} -eq 0 ] && [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then
# No files found in commit and user has asked to not validate code base # No files found in commit and user has asked to not validate code base
SKIP_FLAG=1 SKIP_FLAG=1
# echo " - No files found in changeset to lint for language:[$FILE_TYPE]" # echo " - No files found in changeset to lint for language:[${FILE_TYPE}]"
elif [ ${#FILE_ARRAY[@]} -ne 0 ]; then elif [ ${#FILE_ARRAY[@]} -ne 0 ]; then
# We have files added to array of files to check # We have files added to array of files to check
LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list
@ -88,12 +88,12 @@ function LintCodebase() {
################################# #################################
# Get list of all files to lint # # Get list of all files to lint #
################################# #################################
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE" -type f -regex "$FILE_EXTENSIONS" 2>&1) mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex "${FILE_EXTENSIONS}" 2>&1)
########################### ###########################
# Set IFS back to default # # Set IFS back to default #
########################### ###########################
IFS="$DEFAULT_IFS" IFS="${DEFAULT_IFS}"
############################################################ ############################################################
# Set it back to empty if loaded with blanks from scanning # # Set it back to empty if loaded with blanks from scanning #
@ -113,7 +113,7 @@ function LintCodebase() {
############################### ###############################
# Check if any data was found # # Check if any data was found #
############################### ###############################
if [ $SKIP_FLAG -eq 0 ]; then if [ ${SKIP_FLAG} -eq 0 ]; then
###################### ######################
# Print Header array # # Print Header array #
###################### ######################
@ -121,7 +121,7 @@ function LintCodebase() {
######################### #########################
# Print the header info # # Print the header info #
######################### #########################
echo "$LINE" echo "${LINE}"
done done
######################################## ########################################
@ -141,18 +141,18 @@ function LintCodebase() {
##################### #####################
# Get the file name # # Get the file name #
##################### #####################
FILE_NAME=$(basename "$FILE" 2>&1) FILE_NAME=$(basename "${FILE}" 2>&1)
##################################################### #####################################################
# Make sure we dont lint node modules or test cases # # Make sure we dont lint node modules or test cases #
##################################################### #####################################################
if [[ $FILE == *"node_modules"* ]]; then if [[ ${FILE} == *"node_modules"* ]]; then
# This is a node modules file # This is a node modules file
continue continue
elif [[ $FILE == *"$TEST_CASE_FOLDER"* ]]; then elif [[ ${FILE} == *"${TEST_CASE_FOLDER}"* ]]; then
# This is the test cases, we should always skip # This is the test cases, we should always skip
continue continue
elif [[ $FILE == *".git"* ]]; then elif [[ ${FILE} == *".git"* ]]; then
# This is likely the .git folder and shouldnt be parsed # This is likely the .git folder and shouldnt be parsed
continue continue
fi fi
@ -166,12 +166,12 @@ function LintCodebase() {
# File print # # File print #
############## ##############
echo "---------------------------" echo "---------------------------"
echo "File:[$FILE]" echo "File:[${FILE}]"
################################# #################################
# Add the language to the array # # Add the language to the array #
################################# #################################
LINTED_LANGUAGES_ARRAY+=("$FILE_TYPE") LINTED_LANGUAGES_ARRAY+=("${FILE_TYPE}")
#################### ####################
# Set the base Var # # Set the base Var #
@ -183,14 +183,14 @@ function LintCodebase() {
# - PowerShell (PSScriptAnalyzer) # # - PowerShell (PSScriptAnalyzer) #
# - ARM (arm-ttk) # # - ARM (arm-ttk) #
#################################### ####################################
if [[ $FILE_TYPE == "POWERSHELL" ]] || [[ $FILE_TYPE == "ARM" ]]; then if [[ ${FILE_TYPE} == "POWERSHELL" ]] || [[ ${FILE_TYPE} == "ARM" ]]; then
################################ ################################
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell # Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
LINT_CMD=$( LINT_CMD=$(
cd "$GITHUB_WORKSPACE" || exit cd "${GITHUB_WORKSPACE}" || exit
pwsh -NoProfile -NoLogo -Command "$LINTER_COMMAND $FILE; if (\$Error.Count) { exit 1 }" pwsh -NoProfile -NoLogo -Command "${LINTER_COMMAND} ${FILE}; if (\${Error}.Count) { exit 1 }"
exit $? 2>&1 exit $? 2>&1
) )
else else
@ -198,8 +198,8 @@ function LintCodebase() {
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$( LINT_CMD=$(
cd "$GITHUB_WORKSPACE" || exit cd "${GITHUB_WORKSPACE}" || exit
$LINTER_COMMAND "$FILE" 2>&1 ${LINTER_COMMAND} "${FILE}" 2>&1
) )
fi fi
@ -211,27 +211,27 @@ function LintCodebase() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
######### #########
# Error # # Error #
######### #########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
# Increment the error count # Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++")) (("ERRORS_FOUND_${FILE_TYPE}++"))
####################################################### #######################################################
# Store the linting as a temporary file in TAP format # # Store the linting as a temporary file in TAP format #
####################################################### #######################################################
if IsTAP ; then if IsTAP ; then
NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}"
AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}" AddDetailedMessageIfEnabled "${LINT_CMD}" "${TMPFILE}"
fi fi
else else
########### ###########
# Success # # Success #
########### ###########
echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} was linted with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" echo -e "${NC}${F[B]} - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}"
####################################################### #######################################################
# Store the linting as a temporary file in TAP format # # Store the linting as a temporary file in TAP format #
@ -257,11 +257,11 @@ function TestCodebase() {
#################### ####################
# Pull in the vars # # Pull in the vars #
#################### ####################
FILE_TYPE="$1" # Pull the variable and remove from array path (Example: JSON) FILE_TYPE="${1}" # Pull the variable and remove from array path (Example: JSON)
LINTER_NAME="$2" # Pull the variable and remove from array path (Example: jsonlint) LINTER_NAME="${2}" # Pull the variable and remove from array path (Example: jsonlint)
LINTER_COMMAND="$3" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file) LINTER_COMMAND="${3}" # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
FILE_EXTENSIONS="$4" # Pull the variable and remove from array path (Example: *.json) FILE_EXTENSIONS="${4}" # Pull the variable and remove from array path (Example: *.json)
INDVIDUAL_TEST_FOLDER="$5" # Folder for specific tests INDVIDUAL_TEST_FOLDER="${5}" # Folder for specific tests
TESTS_RAN=0 # Incremented when tests are ran, this will help find failed finds TESTS_RAN=0 # Incremented when tests are ran, this will help find failed finds
################ ################
@ -270,7 +270,7 @@ function TestCodebase() {
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Testing Codebase [$FILE_TYPE] files..." echo "Testing Codebase [${FILE_TYPE}] files..."
echo "----------------------------------------------" echo "----------------------------------------------"
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
@ -278,7 +278,7 @@ function TestCodebase() {
##################################### #####################################
# Validate we have linter installed # # Validate we have linter installed #
##################################### #####################################
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1) VALIDATE_INSTALL_CMD=$(command -v "${LINTER_NAME}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -288,14 +288,14 @@ function TestCodebase() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Failed # Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [$LINTER_NAME] in system!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find [${LINTER_NAME}] in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${VALIDATE_INSTALL_CMD}]${NC}"
exit 1 exit 1
else else
# Success # Success
echo -e "${NC}${F[B]}Successfully found binary for ${F[W]}[$LINTER_NAME]${F[B]} in system location: ${F[W]}[$VALIDATE_INSTALL_CMD]${NC}" echo -e "${NC}${F[B]}Successfully found binary for ${F[W]}[${LINTER_NAME}]${F[B]} in system location: ${F[W]}[${VALIDATE_INSTALL_CMD}]${NC}"
fi fi
########################## ##########################
@ -306,7 +306,7 @@ function TestCodebase() {
################################# #################################
# Get list of all files to lint # # Get list of all files to lint #
################################# #################################
mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible/ghe-initialize/*" | sort 2>&1) mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/${INDVIDUAL_TEST_FOLDER}" -type f -regex "${FILE_EXTENSIONS}" ! -path "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/ansible/ghe-initialize/*" | sort 2>&1)
######################################## ########################################
# Prepare context if TAP output format # # Prepare context if TAP output format #
@ -324,18 +324,18 @@ function TestCodebase() {
##################### #####################
# Get the file name # # Get the file name #
##################### #####################
FILE_NAME=$(basename "$FILE" 2>&1) FILE_NAME=$(basename "${FILE}" 2>&1)
############################ ############################
# Get the file pass status # # Get the file pass status #
############################ ############################
# Example: markdown_good_1.md -> good # Example: markdown_good_1.md -> good
FILE_STATUS=$(echo "$FILE_NAME" | cut -f2 -d'_') FILE_STATUS=$(echo "${FILE_NAME}" | cut -f2 -d'_')
######################################################### #########################################################
# If not found, assume it should be linted successfully # # If not found, assume it should be linted successfully #
######################################################### #########################################################
if [ -z "$FILE_STATUS" ] || [[ $FILE == *"README"* ]]; then if [ -z "${FILE_STATUS}" ] || [[ ${FILE} == *"README"* ]]; then
################################## ##################################
# Set to good for proper linting # # Set to good for proper linting #
################################## ##################################
@ -346,7 +346,7 @@ function TestCodebase() {
# File print # # File print #
############## ##############
echo "---------------------------" echo "---------------------------"
echo "File:[$FILE]" echo "File:[${FILE}]"
######################## ########################
# Set the lint command # # Set the lint command #
@ -356,8 +356,8 @@ function TestCodebase() {
####################################### #######################################
# Check if docker and get folder name # # Check if docker and get folder name #
####################################### #######################################
if [[ $FILE_TYPE == "DOCKER" ]]; then if [[ ${FILE_TYPE} == "DOCKER" ]]; then
if [[ $FILE == *"good"* ]]; then if [[ ${FILE} == *"good"* ]]; then
############# #############
# Good file # # Good file #
############# #############
@ -373,11 +373,11 @@ function TestCodebase() {
##################### #####################
# Check for ansible # # Check for ansible #
##################### #####################
if [[ $FILE_TYPE == "ANSIBLE" ]]; then if [[ ${FILE_TYPE} == "ANSIBLE" ]]; then
######################################## ########################################
# Make sure we dont lint certain files # # Make sure we dont lint certain files #
######################################## ########################################
if [[ $FILE == *"vault.yml"* ]] || [[ $FILE == *"galaxy.yml"* ]]; then if [[ ${FILE} == *"vault.yml"* ]] || [[ ${FILE} == *"galaxy.yml"* ]]; then
# This is a file we dont look at # This is a file we dont look at
continue continue
fi fi
@ -386,17 +386,17 @@ function TestCodebase() {
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$( LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" || exit cd "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/${INDVIDUAL_TEST_FOLDER}" || exit
$LINTER_COMMAND "$FILE" 2>&1 ${LINTER_COMMAND} "${FILE}" 2>&1
) )
elif [[ $FILE_TYPE == "POWERSHELL" ]] || [[ $FILE_TYPE == "ARM" ]]; then elif [[ ${FILE_TYPE} == "POWERSHELL" ]] || [[ ${FILE_TYPE} == "ARM" ]]; then
################################ ################################
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
# Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell # Need to run PowerShell commands using pwsh -c, also exit with exit code from inner subshell
LINT_CMD=$( LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit cd "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}" || exit
pwsh -NoProfile -NoLogo -Command "$LINTER_COMMAND $FILE; if (\$Error.Count) { exit 1 }" pwsh -NoProfile -NoLogo -Command "${LINTER_COMMAND} ${FILE}; if (\${Error}.Count) { exit 1 }"
exit $? 2>&1 exit $? 2>&1
) )
else else
@ -404,8 +404,8 @@ function TestCodebase() {
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$( LINT_CMD=$(
cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit cd "${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}" || exit
$LINTER_COMMAND "$FILE" 2>&1 ${LINTER_COMMAND} "${FILE}" 2>&1
) )
fi fi
@ -422,24 +422,24 @@ function TestCodebase() {
######################################## ########################################
# Check for if it was supposed to pass # # Check for if it was supposed to pass #
######################################## ########################################
if [[ $FILE_STATUS == "good" ]]; then if [[ ${FILE_STATUS} == "good" ]]; then
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
######### #########
# Error # # Error #
######### #########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[${LINTER_COMMAND} ${FILE}]${NC}"
# Increment the error count # Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++")) (("ERRORS_FOUND_${FILE_TYPE}++"))
else else
########### ###########
# Success # # Success #
########### ###########
echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} was linted with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" echo -e "${NC}${F[B]} - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}"
fi fi
####################################################### #######################################################
# Store the linting as a temporary file in TAP format # # Store the linting as a temporary file in TAP format #
@ -454,28 +454,28 @@ function TestCodebase() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -eq 0 ]; then if [ ${ERROR_CODE} -eq 0 ]; then
######### #########
# Error # # Error #
######### #########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} This file should have failed test case!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} This file should have failed test case!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[${LINTER_COMMAND} ${FILE}]${NC}"
# Increment the error count # Increment the error count
(("ERRORS_FOUND_$FILE_TYPE++")) (("ERRORS_FOUND_${FILE_TYPE}++"))
else else
########### ###########
# Success # # Success #
########### ###########
echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} failed test case with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" echo -e "${NC}${F[B]} - File:${F[W]}[${FILE_NAME}]${F[B]} failed test case with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}"
fi fi
####################################################### #######################################################
# Store the linting as a temporary file in TAP format # # Store the linting as a temporary file in TAP format #
####################################################### #######################################################
if IsTAP ; then if IsTAP ; then
NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}" NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}"
AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}" AddDetailedMessageIfEnabled "${LINT_CMD}" "${TMPFILE}"
fi fi
fi fi
done done
@ -490,24 +490,24 @@ function TestCodebase() {
######################################################################## ########################################################################
# If expected TAP report exists then compare with the generated report # # If expected TAP report exists then compare with the generated report #
######################################################################## ########################################################################
EXPECTED_FILE="$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER/reports/expected-${FILE_TYPE}.tap" EXPECTED_FILE="${GITHUB_WORKSPACE}/${TEST_CASE_FOLDER}/${INDVIDUAL_TEST_FOLDER}/reports/expected-${FILE_TYPE}.tap"
if [ -e "$EXPECTED_FILE" ] ; then if [ -e "${EXPECTED_FILE}" ] ; then
TMPFILE=$(mktemp -q "/tmp/diff-${FILE_TYPE}.XXXXXX") TMPFILE=$(mktemp -q "/tmp/diff-${FILE_TYPE}.XXXXXX")
## Ignore white spaces, case sensitive ## Ignore white spaces, case sensitive
if ! diff -a -w -i "${EXPECTED_FILE}" "${REPORT_OUTPUT_FILE}" > "${TMPFILE}" 2>&1; then if ! diff -a -w -i "${EXPECTED_FILE}" "${REPORT_OUTPUT_FILE}" > "${TMPFILE}" 2>&1; then
############################################# #############################################
# We failed to compare the reporting output # # We failed to compare the reporting output #
############################################# #############################################
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to assert TAP output:[$LINTER_NAME]${NC}"! echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to assert TAP output:[${LINTER_NAME}]${NC}"!
echo "Please validate the asserts!" echo "Please validate the asserts!"
cat "${TMPFILE}" cat "${TMPFILE}"
exit 1 exit 1
else else
# Success # Success
echo -e "${NC}${F[B]}Successfully validation in the expected TAP format for ${F[W]}[$LINTER_NAME]${NC}" echo -e "${NC}${F[B]}Successfully validation in the expected TAP format for ${F[W]}[${LINTER_NAME}]${NC}"
fi fi
else else
echo -e "${NC}${F[Y]}WARN!${NC} No TAP expected file found at:[$EXPECTED_FILE]${NC}" echo -e "${NC}${F[Y]}WARN!${NC} No TAP expected file found at:[${EXPECTED_FILE}]${NC}"
echo "skipping report assertions" echo "skipping report assertions"
##################################### #####################################
# Append the file type to the array # # Append the file type to the array #
@ -519,11 +519,11 @@ function TestCodebase() {
############################## ##############################
# Validate we ran some tests # # Validate we ran some tests #
############################## ##############################
if [ "$TESTS_RAN" -eq 0 ]; then if [ "${TESTS_RAN}" -eq 0 ]; then
################################################# #################################################
# We failed to find files and no tests were ran # # We failed to find files and no tests were ran #
################################################# #################################################
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find any tests ran for the Linter:[$LINTER_NAME]${NC}"! echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find any tests ran for the Linter:[${LINTER_NAME}]${NC}"!
echo "Please validate logic or that tests exist!" echo "Please validate logic or that tests exist!"
exit 1 exit 1
fi fi
@ -552,30 +552,30 @@ function RunTestCases() {
# Test case languages # # Test case languages #
####################### #######################
# TestCodebase "Language" "Linter" "Linter-command" "Regex to find files" "Test Folder" # TestCodebase "Language" "Linter" "Linter-command" "Regex to find files" "Test Folder"
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" ".*\.\(yml\|yaml\)\$" "ansible" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c ${ANSIBLE_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "ansible"
TestCodebase "ARM" "arm-ttk" "Import-Module $ARM_TTK_PSD1 ; \$config = \$(Import-PowerShellDataFile -Path $ARM_LINTER_RULES) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm" TestCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm"
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell" TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell"
TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file $CFN_LINTER_RULES" ".*\.\(json\|yml\|yaml\)\$" "cfn" TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "cfn"
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure" TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure"
TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f $COFFEESCRIPT_LINTER_RULES" ".*\.\(coffee\)\$" "coffeescript" TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript"
TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "css" TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css"
TestCodebase "DART" "dart" "dartanalyzer --fatal-infos --fatal-warnings --options $DART_LINTER_RULES" ".*\.\(dart\)\$" "dart" TestCodebase "DART" "dart" "dartanalyzer --fatal-infos --fatal-warnings --options ${DART_LINTER_RULES}" ".*\.\(dart\)\$" "dart"
TestCodebase "DOCKER" "dockerfilelint" "dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" "docker" TestCodebase "DOCKER" "dockerfilelint" "dockerfilelint -c ${DOCKER_LINTER_RULES}" ".*\(Dockerfile\)\$" "docker"
TestCodebase "EDITORCONFIG" "editorconfig-checker" "editorconfig-checker" ".*\.ext$" "editorconfig-checker" TestCodebase "EDITORCONFIG" "editorconfig-checker" "editorconfig-checker" ".*\.ext$" "editorconfig-checker"
TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" "env" TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" "env"
TestCodebase "GO" "golangci-lint" "golangci-lint run -c $GO_LINTER_RULES" ".*\.\(go\)\$" "golang" TestCodebase "GO" "golangci-lint" "golangci-lint run -c ${GO_LINTER_RULES}" ".*\.\(go\)\$" "golang"
TestCodebase "HTML" "htmlhint" "htmlhint --config $HTML_LINTER_RULES" ".*\.\(html\)\$" "html" TestCodebase "HTML" "htmlhint" "htmlhint --config ${HTML_LINTER_RULES}" ".*\.\(html\)\$" "html"
TestCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c $JAVASCRIPT_LINTER_RULES" ".*\.\(js\)\$" "javascript" TestCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${JAVASCRIPT_LINTER_RULES}" ".*\.\(js\)\$" "javascript"
TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" "javascript" TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard ${JAVASCRIPT_STANDARD_LINTER_RULES}" ".*\.\(js\)\$" "javascript"
TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json" TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json"
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin" TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin"
TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MARKDOWN_LINTER_RULES" ".*\.\(md\)\$" "markdown" TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c ${MARKDOWN_LINTER_RULES}" ".*\.\(md\)\$" "markdown"
TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl" TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl"
TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php" TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php"
TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi" TestCodebase "OPENAPI" "spectral" "spectral lint -r ${OPENAPI_LINTER_RULES}" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi"
TestCodebase "POWERSHELL" "pwsh" "Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "powershell" TestCodebase "POWERSHELL" "pwsh" "Invoke-ScriptAnalyzer -EnableExit -Settings ${POWERSHELL_LINTER_RULES} -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "powershell"
TestCodebase "PROTOBUF" "protolint" "protolint lint --config_path $PROTOBUF_LINTER_RULES" ".*\.\(proto\)\$" "protobuf" TestCodebase "PROTOBUF" "protolint" "protolint lint --config_path ${PROTOBUF_LINTER_RULES}" ".*\.\(proto\)\$" "protobuf"
TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES" ".*\.\(py\)\$" "python" TestCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "python"
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku" TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" "ruby" TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" "ruby"
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states" TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
@ -583,7 +583,7 @@ function RunTestCases() {
TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "typescript" TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "typescript" TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml" TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml"
TestCodebase "YML" "yamllint" "yamllint -c $YAML_LINTER_RULES" ".*\.\(yml\|yaml\)\$" "yml" TestCodebase "YML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "yml"
################# #################
# Footer prints # # Footer prints #
@ -618,7 +618,7 @@ function LintAnsibleFiles() {
########################################### ###########################################
# Validate we have ansible-lint installed # # Validate we have ansible-lint installed #
########################################### ###########################################
VALIDATE_INSTALL_CMD=$(command -v "$LINTER_NAME" 2>&1) VALIDATE_INSTALL_CMD=$(command -v "${LINTER_NAME}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -628,17 +628,17 @@ function LintAnsibleFiles() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
# Failed # Failed
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find $LINTER_NAME in system!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to find ${LINTER_NAME} in system!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$VALIDATE_INSTALL_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${VALIDATE_INSTALL_CMD}]${NC}"
exit 1 exit 1
else else
# Success # Success
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
# Success # Success
echo -e "${NC}${F[B]}Successfully found binary in system${NC}" echo -e "${NC}${F[B]}Successfully found binary in system${NC}"
echo "Location:[$VALIDATE_INSTALL_CMD]" echo "Location:[${VALIDATE_INSTALL_CMD}]"
fi fi
fi fi
@ -655,18 +655,18 @@ function LintAnsibleFiles() {
###################################################### ######################################################
# Only go into ansible linter if we have base folder # # Only go into ansible linter if we have base folder #
###################################################### ######################################################
if [ -d "$ANSIBLE_DIRECTORY" ]; then if [ -d "${ANSIBLE_DIRECTORY}" ]; then
################################# #################################
# Get list of all files to lint # # Get list of all files to lint #
################################# #################################
mapfile -t LIST_FILES < <(ls "$ANSIBLE_DIRECTORY"/*.{yaml,yml} 2>&1) mapfile -t LIST_FILES < <(ls "${ANSIBLE_DIRECTORY}"/*.{yaml,yml} 2>&1)
############################################################### ###############################################################
# Set the list to empty if only MD and TXT files were changed # # Set the list to empty if only MD and TXT files were changed #
############################################################### ###############################################################
# No need to run the full ansible checks on read only file changes # No need to run the full ansible checks on read only file changes
if [ "$READ_ONLY_CHANGE_FLAG" -eq 0 ]; then if [ "${READ_ONLY_CHANGE_FLAG}" -eq 0 ]; then
########################## ##########################
# Set the array to empty # # Set the array to empty #
########################## ##########################
@ -684,12 +684,12 @@ function LintAnsibleFiles() {
#################################### ####################################
# Check if we have data to look at # # Check if we have data to look at #
#################################### ####################################
if [ $SKIP_FLAG -eq 0 ]; then if [ ${SKIP_FLAG} -eq 0 ]; then
for LINE in "${PRINT_ARRAY[@]}"; do for LINE in "${PRINT_ARRAY[@]}"; do
######################### #########################
# Print the header line # # Print the header line #
######################### #########################
echo "$LINE" echo "${LINE}"
done done
fi fi
@ -711,7 +711,7 @@ function LintAnsibleFiles() {
######################################## ########################################
# Make sure we dont lint certain files # # Make sure we dont lint certain files #
######################################## ########################################
if [[ $FILE == *"vault.yml"* ]] || [[ $FILE == *"galaxy.yml"* ]]; then if [[ ${FILE} == *"vault.yml"* ]] || [[ ${FILE} == *"galaxy.yml"* ]]; then
# This is a file we dont look at # This is a file we dont look at
continue continue
fi fi
@ -724,18 +724,18 @@ function LintAnsibleFiles() {
#################### ####################
# Get the filename # # Get the filename #
#################### ####################
FILE_NAME=$(basename "$ANSIBLE_DIRECTORY/$FILE" 2>&1) FILE_NAME=$(basename "${ANSIBLE_DIRECTORY}/${FILE}" 2>&1)
############## ##############
# File print # # File print #
############## ##############
echo "---------------------------" echo "---------------------------"
echo "File:[$FILE]" echo "File:[${FILE}]"
################################ ################################
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$("$LINTER_NAME" -v -c "$ANSIBLE_LINTER_RULES" "$ANSIBLE_DIRECTORY/$FILE" 2>&1) LINT_CMD=$("${LINTER_NAME}" -v -c "${ANSIBLE_LINTER_RULES}" "${ANSIBLE_DIRECTORY}/${FILE}" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -745,12 +745,12 @@ function LintAnsibleFiles() {
############################## ##############################
# Check the shell for errors # # Check the shell for errors #
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ ${ERROR_CODE} -ne 0 ]; then
######### #########
# Error # # Error #
######### #########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [$LINTER_NAME] linter!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$LINT_CMD]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
# Increment error count # Increment error count
((ERRORS_FOUND_ANSIBLE++)) ((ERRORS_FOUND_ANSIBLE++))
@ -766,7 +766,7 @@ function LintAnsibleFiles() {
########### ###########
# Success # # Success #
########### ###########
echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} was linted with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" echo -e "${NC}${F[B]} - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully${NC}"
####################################################### #######################################################
# Store the linting as a temporary file in TAP format # # Store the linting as a temporary file in TAP format #
@ -788,11 +788,11 @@ function LintAnsibleFiles() {
############################### ###############################
# Check to see if debug is on # # Check to see if debug is on #
############################### ###############################
if [[ $ACTIONS_RUNNER_DEBUG == "true" ]]; then if [[ ${ACTIONS_RUNNER_DEBUG} == "true" ]]; then
######################## ########################
# No Ansible dir found # # No Ansible dir found #
######################## ########################
echo -e "${NC}${F[Y]}WARN!${NC} No Ansible base directory found at:[$ANSIBLE_DIRECTORY]${NC}" echo -e "${NC}${F[Y]}WARN!${NC} No Ansible base directory found at:[${ANSIBLE_DIRECTORY}]${NC}"
echo "skipping ansible lint" echo "skipping ansible lint"
fi fi
fi fi
@ -809,7 +809,7 @@ function IsTAP() {
################################################################################ ################################################################################
#### Function TransformTAPDetails ############################################## #### Function TransformTAPDetails ##############################################
function TransformTAPDetails() { function TransformTAPDetails() {
DATA=$1 DATA=${1}
if [ -n "${DATA}" ] && [ "${OUTPUT_DETAILS}" == "detailed" ] ; then if [ -n "${DATA}" ] && [ "${OUTPUT_DETAILS}" == "detailed" ] ; then
######################################################### #########################################################
# Transform new lines to \\n, remove colours and colons # # Transform new lines to \\n, remove colours and colons #
@ -823,8 +823,8 @@ function HeaderTap() {
################ ################
# Pull in Vars # # Pull in Vars #
################ ################
INDEX="$1" # File being validated INDEX="${1}" # File being validated
OUTPUT_FILE="$2" # Output location OUTPUT_FILE="${2}" # Output location
################### ###################
# Print the goods # # Print the goods #
@ -837,9 +837,9 @@ function OkTap() {
################ ################
# Pull in Vars # # Pull in Vars #
################ ################
INDEX="$1" # Location INDEX="${1}" # Location
FILE="$2" # File being validated FILE="${2}" # File being validated
TEMP_FILE="$3" # Temp file location TEMP_FILE="${3}" # Temp file location
################### ###################
# Print the goods # # Print the goods #
@ -852,9 +852,9 @@ function NotOkTap() {
################ ################
# Pull in Vars # # Pull in Vars #
################ ################
INDEX="$1" # Location INDEX="${1}" # Location
FILE="$2" # File being validated FILE="${2}" # File being validated
TEMP_FILE="$3" # Temp file location TEMP_FILE="${3}" # Temp file location
################### ###################
# Print the goods # # Print the goods #
@ -867,14 +867,14 @@ function AddDetailedMessageIfEnabled() {
################ ################
# Pull in Vars # # Pull in Vars #
################ ################
LINT_CMD="$1" # Linter command LINT_CMD="${1}" # Linter command
TEMP_FILE="$2" # Temp file TEMP_FILE="${2}" # Temp file
#################### ####################
# Check the return # # Check the return #
#################### ####################
DETAILED_MSG=$(TransformTAPDetails "${LINT_CMD}") DETAILED_MSG=$(TransformTAPDetails "${LINT_CMD}")
if [ -n "${DETAILED_MSG}" ] ; then if [ -n "${DETAILED_MSG}" ] ; then
printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TEMP_FILE}" printf " ---\n message: %s\n ...\n" "${DETAILED_MSG}" >> "${TEMP_FILE}"
fi fi
} }