Merge branch 'master' into SpellingCheck

This commit is contained in:
Lucas Gravley 2020-06-24 15:43:23 -05:00
commit d6b1e51212
33 changed files with 598 additions and 88 deletions

View file

@ -19,4 +19,5 @@ When the script is triggered in a branch, it will push with the tag:**NameOfBran
- **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

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
################################################################################ ################################################################################
############# Cleanup Image on DockerHub @admiralawkbar ######################## ############# Cleanup Image on DockerHub @admiralawkbar ########################

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
################################################################################ ################################################################################
# Script to run ghe-config-apply on the primary GHES instance # Script to run ghe-config-apply on the primary GHES instance

View file

@ -0,0 +1,13 @@
# Kotlin Test Cases
This folder holds the test cases for **Kotlin**.
## Additional Docs
No Additional information is needed for this test case.
## Good Test Cases
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.
## Bad Test Cases
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.

View file

@ -0,0 +1,6 @@
fun main() {
val n = "World";
val v = "Hello, ${n}!";
println(v);
}

View file

@ -0,0 +1,6 @@
fun main() {
val n = "World"
val v = "Hello, $n!"
println(v)
}

View file

@ -0,0 +1,13 @@
# PHP Test Cases
This folder holds the test cases for **PHP**.
## Additional Docs
No Additional information is needed for this test case.
## Good Test Cases
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.
## Bad Test Cases
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.

View file

@ -0,0 +1,3 @@
<?php
2pe98y r-n0u823n=r 092u3- r08u2q098ry 09nq2yr09n2yr9 y2n-93yr 298yr3 29

View file

@ -0,0 +1,3 @@
<?php
echo "Hello World!", PHP_EOL;

View file

@ -0,0 +1,13 @@
# PowerShell Test Cases
This folder holds the test cases for **PowerShell**.
## Additional Docs
No Additional information is needed for this test case.
## Good Test Cases
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.
## Bad Test Cases
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.

View file

@ -0,0 +1,14 @@
#Plaintext Parameters
function BadFunction {
param(
[String]$Username = 'me',
[String]$Password = 'password'
)
$Username
$Password
$VariableThatIsNotUsedLater = '5'
try {
'Empty Catch Block'
} catch {}
}

View file

@ -0,0 +1,3 @@
@{
'Hello'='World
}

View file

@ -0,0 +1 @@
Write-Output "hello world!

View file

@ -0,0 +1 @@
Write-Output "hello world!"

View file

@ -0,0 +1,3 @@
@{
'Hello'='World'
}

View file

@ -0,0 +1 @@
Write-Output "hello world!"

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# CMD # CMD
HELLO_WORLD=($(echo "Hello World" | cut -f1 -d' ' 2>&1)) HELLO_WORLD=($(echo "Hello World" | cut -f1 -d' ' 2>&1))

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# CMD # CMD
HELLO_WORLD=$(echo "Hello World" | cut -f1 -d' ' 2>&1) HELLO_WORLD=$(echo "Hello World" | cut -f1 -d' ' 2>&1)

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
################################################################################ ################################################################################
############# Deploy Container to DockerHub @admiralawkbar ##################### ############# Deploy Container to DockerHub @admiralawkbar #####################
@ -20,6 +20,9 @@
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub
DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub
GPR_USERNAME="${GPR_USERNAME}" # Username to login to GitHub package registry
GPR_TOKEN="${GPR_TOKEN}" # Password to login to GitHub package registry
REGISTRY="${REGISTRY}" # What registry to upload | <GPR> or <Docker>
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
@ -33,7 +36,7 @@ Header()
{ {
echo "" echo ""
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "------ GitHub Actions Upload image to DockerHub -------" echo "---- GitHub Actions Upload image to [$REGISTRY] ----"
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "" echo ""
} }
@ -51,9 +54,9 @@ ValidateInput()
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
############################ #############################
# Validate GITHUB_WORKSPACE # # Validate GITHUB_WORKSPACE #
############################ #############################
if [ -z "$GITHUB_WORKSPACE" ]; then if [ -z "$GITHUB_WORKSPACE" ]; then
echo "ERROR! Failed to get [GITHUB_WORKSPACE]!" echo "ERROR! Failed to get [GITHUB_WORKSPACE]!"
echo "ERROR:[$GITHUB_WORKSPACE]" echo "ERROR:[$GITHUB_WORKSPACE]"
@ -62,6 +65,46 @@ ValidateInput()
echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]"
fi fi
#####################
# Validate REGISTRY #
#####################
if [ -z "$REGISTRY" ]; then
echo "ERROR! Failed to get [REGISTRY]!"
echo "ERROR:[$REGISTRY]"
exit 1
else
echo "Successfully found:[REGISTRY], value:[$REGISTRY]"
fi
#####################################################
# See if we need values for GitHub package Registry #
#####################################################
if [[ "$REGISTRY" == "GPR" ]]; then
#########################
# Validate GPR_USERNAME #
#########################
if [ -z "$GPR_USERNAME" ]; then
echo "ERROR! Failed to get [GPR_USERNAME]!"
echo "ERROR:[$GPR_USERNAME]"
exit 1
else
echo "Successfully found:[GPR_USERNAME], value:[$GPR_USERNAME]"
fi
######################
# Validate GPR_TOKEN #
######################
if [ -z "$GPR_TOKEN" ]; then
echo "ERROR! Failed to get [GPR_TOKEN]!"
echo "ERROR:[$GPR_TOKEN]"
exit 1
else
echo "Successfully found:[GPR_TOKEN], value:[********]"
fi
########################################
# See if we need values for Ducker hub #
########################################
elif [[ "$REGISTRY" == "Docker" ]]; then
############################ ############################
# Validate DOCKER_USERNAME # # Validate DOCKER_USERNAME #
############################ ############################
@ -83,6 +126,15 @@ ValidateInput()
else else
echo "Successfully found:[DOCKER_PASSWORD], value:[********]" echo "Successfully found:[DOCKER_PASSWORD], value:[********]"
fi fi
###########################################
# We were not passed a registry to update #
###########################################
else
echo "ERROR! Failed to find a valid registry!"
echo "Registry:[$REGISTRY]"
exit 1
fi
####################### #######################
# Validate IMAGE_REPO # # Validate IMAGE_REPO #
@ -93,6 +145,14 @@ ValidateInput()
exit 1 exit 1
else else
echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]"
###############################################
# Need to see if GPR registry and update name #
###############################################
if [[ "$REGISTRY" == "GPR" ]]; then
NAME="docker.pkg.github/$IMAGE_REPO"
IMAGE_REPO="$NAME"
echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR"
fi
fi fi
########################## ##########################
@ -146,22 +206,30 @@ ValidateInput()
fi fi
} }
################################################################################ ################################################################################
#### Function LoginToDocker #################################################### #### Function Authenticate #####################################################
LoginToDocker() Authenticate()
{ {
################
# Pull in Vars #
################
USERNAME="$1" # Name to auth with
PASSWORD="$2" # Password to auth with
URL="$3" # Url to auth towards
NAME="$4" # name of the service
################ ################
# Print header # # Print header #
################ ################
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Login to DockerHub..." echo "Login to $NAME..."
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
###################### ###################
# Login to DockerHub # # Auth to service #
###################### ###################
LOGIN_CMD=$(docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" 2>&1) LOGIN_CMD=$(docker login "$URL" --username "$USERNAME" --password "$PASSWORD" 2>&1)
####################### #######################
# Load the error code # # Load the error code #
@ -173,12 +241,12 @@ LoginToDocker()
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ $ERROR_CODE -ne 0 ]; then
# ERROR # ERROR
echo "ERROR! Failed to authenticate to DockerHub!" echo "ERROR! Failed to authenticate to $NAME!"
echo "ERROR:[$LOGIN_CMD]" echo "ERROR:[$LOGIN_CMD]"
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo "Successfully authenticated to DockerHub!" echo "Successfully authenticated to $NAME!"
fi fi
} }
################################################################################ ################################################################################
@ -194,7 +262,6 @@ BuildImage()
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
################################ ################################
# Validate the DOCKERFILE_PATH # # Validate the DOCKERFILE_PATH #
################################ ################################
@ -238,7 +305,7 @@ UploadImage()
################ ################
echo "" echo ""
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Uploading the DockerFile image..." echo "Uploading the DockerFile image to $REGISTRY..."
echo "----------------------------------------------" echo "----------------------------------------------"
echo "" echo ""
@ -261,7 +328,7 @@ UploadImage()
exit 1 exit 1
else else
# SUCCESS # SUCCESS
echo "Successfully Uploaded Docker image to DockerHub!" echo "Successfully Uploaded Docker image to $REGISTRY!"
fi fi
######################### #########################
@ -329,16 +396,34 @@ Header
################## ##################
ValidateInput ValidateInput
######################
# Login to DockerHub #
######################
LoginToDocker
################### ###################
# Build the image # # Build the image #
################### ###################
BuildImage BuildImage
######################
# Login to DockerHub #
######################
if [[ "$REGISTRY" == "Docker" ]]; then
# Authenticate "Username" "Password" "Url" "Name"
Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub"
####################################
# Login to GitHub Package Registry #
####################################
elif [[ "$REGISTRY" == "GPR" ]]; then
# Authenticate "Username" "Password" "Url" "Name"
Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry"
else
#########
# ERROR #
#########
echo "ERROR! Registry not set correctly!"
echo "Registry:[$REGISTRY]"
exit 1
fi
#################### ####################
# Upload the image # # Upload the image #
#################### ####################

2
.github/CODEOWNERS vendored
View file

@ -1,4 +1,4 @@
###################################################################### ######################################################################
# These owners will be the default owners for everything in the repo # # These owners will be the default owners for everything in the repo #
###################################################################### ######################################################################
* @admiralawkbar @jwiebalk @zkoppert * @admiralawkbar @jwiebalk @zkoppert @IAmHughes

View file

@ -31,9 +31,11 @@ Draft pull requests are also welcome to get feedback early on, or if there is so
## Releasing ## Releasing
If you are the current maintainer of this action: If you are the current maintainer of this action:
1. Update `README.md` to reflect new version number in the suggested workflow file section 1. Update `README.md` and the wiki to reflect new version number in the example workflow file sections
2. Draft [Release](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) document explaining details of Release 2. Draft [Release](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) with a summarized changelog
3. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) 3. A GitHub Action will Publish the Docker image to GitHub Package Registry once a Release is created
4. A GitHub Action will Publish the Docker image to Docker Hub once a Release is created
5. 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/)

View file

@ -18,3 +18,6 @@ A clear and concise description of any alternative solutions or features you've
**Additional context** **Additional context**
Add any other context or screenshots about the feature request here. Add any other context or screenshots about the feature request here.
**Note**
If this is a request to add a new language, after submitting this issue check out [the wiki](https://github.com/github/super-linter/wiki/Adding-new-language-support) for more info on how to accomplish that.

View file

@ -47,7 +47,7 @@ jobs:
# Set the Env Vars # Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: admiralawkbar/super-linter IMAGE_REPO: github/super-linter
IMAGE_VERSION: ${{ github.event.pull_request.head.ref }} IMAGE_VERSION: ${{ github.event.pull_request.head.ref }}
shell: bash shell: bash
run: .automation/cleanup-docker.sh run: .automation/cleanup-docker.sh

View file

@ -43,13 +43,14 @@ jobs:
##################### #####################
# Run Deploy script # # Run Deploy script #
##################### #####################
- name: Deploy image to DockerHub - name: Deploy DEV image to DockerHub
env: env:
# Set the Env Vars # Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: github/super-linter IMAGE_REPO: github/super-linter
DOCKERFILE_PATH: Dockerfile DOCKERFILE_PATH: Dockerfile
REGISTRY: Docker
shell: bash shell: bash
run: .automation/upload-docker.sh run: .automation/upload-docker.sh

View file

@ -40,7 +40,7 @@ jobs:
##################### #####################
# Run Deploy script # # Run Deploy script #
##################### #####################
- name: Deploy image to DockerHub - name: Deploy latest image to DockerHub
env: env:
# Set the Env Vars # Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
@ -48,5 +48,6 @@ jobs:
IMAGE_REPO: github/super-linter IMAGE_REPO: github/super-linter
IMAGE_VERSION: latest IMAGE_VERSION: latest
DOCKERFILE_PATH: Dockerfile DOCKERFILE_PATH: Dockerfile
REGISTRY: Docker
shell: bash shell: bash
run: .automation/upload-docker.sh run: .automation/upload-docker.sh

68
.github/workflows/deploy-RELEASE.yml vendored Normal file
View file

@ -0,0 +1,68 @@
---
#########################
#########################
## Deploy Docker Image ##
#########################
#########################
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#######################################
# Start the job on all push to master #
#######################################
on:
release:
# Want to run the automation when a release is created
types: ['created']
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Deploy Docker Image - Release
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
###################################
# Run Deploy script for Dockerhub #
###################################
- name: Deploy Release image to Dockerhub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: github/super-linter
IMAGE_VERSION: ${{ github.event.release.tag_name }}
DOCKERFILE_PATH: Dockerfile
REGISTRY: Docker
shell: bash
run: .automation/upload-docker.sh
#############################
# Run Deploy script for GPR #
#############################
- name: Deploy Release image to GitHub Package Registry
env:
# Set the Env Vars
GPR_USERNAME: ${{ secrets.GPR_USERNAME }}
GPR_TOKEN: ${{ secrets.GPR_TOKEN }}
IMAGE_REPO: github/super-linter
IMAGE_VERSION: ${{ github.event.release.tag_name }}
DOCKERFILE_PATH: Dockerfile
REGISTRY: GPR
shell: bash
run: .automation/upload-docker.sh

View file

@ -27,7 +27,27 @@ RUN apk add --no-cache \
libxml2-utils perl \ libxml2-utils perl \
ruby ruby-dev ruby-bundler ruby-rdoc make \ ruby ruby-dev ruby-bundler ruby-rdoc make \
py3-setuptools ansible-lint \ py3-setuptools ansible-lint \
go go \
openjdk8-jre \
php7 \
ca-certificates less ncurses-terminfo-base \
krb5-libs libgcc libintl libssl1.1 libstdc++ \
tzdata userspace-rcu zlib icu-libs lttng-ust
#########################################
# Install Powershell + PSScriptAnalyzer #
#########################################
# Reference: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7
# Slightly modified to always retrieve latest stable Powershell version
RUN mkdir -p /opt/microsoft/powershell/7 \
&& curl -s https://api.github.com/repos/powershell/powershell/releases/latest \
| grep browser_download_url \
| grep linux-alpine-x64 \
| cut -d '"' -f 4 \
| xargs -n 1 wget -O - \
| tar -xzC /opt/microsoft/powershell/7 \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
&& pwsh -c 'install-module psscriptanalyzer -force'
##################### #####################
# Run Pip3 Installs # # Run Pip3 Installs #
@ -82,7 +102,10 @@ RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0
# Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default # Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default
# We then need to promote the correct version, uninstall, and fix deps # We then need to promote the correct version, uninstall, and fix deps
RUN sh -c 'gem install --default rubocop:0.74.0; yes | gem uninstall rubocop:0.85.1 -a -x -I; gem install rubocop:0.74.0' RUN sh -c 'INCORRECT_VERSION=$(gem list rhc -e rubocop | grep rubocop | awk "{print $2}" | cut -d"(" -f2 | cut -d"," -f1); \
gem install --default rubocop:0.74.0; \
yes | gem uninstall rubocop:$INCORRECT_VERSION -a -x -I; \
gem install rubocop:0.74.0'
###################### ######################
# Install shellcheck # # Install shellcheck #
@ -102,12 +125,18 @@ RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/maste
RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip \ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip \
&& mv "tflint" /usr/bin/ && mv "tflint" /usr/bin/
################## #########################
# Install dotenv-linter # # Install dotenv-linter #
################## #########################
RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \ RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \
&& mv "dotenv-linter" /usr/bin && mv "dotenv-linter" /usr/bin
##################
# Install ktlint #
##################
RUN curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod a+x ktlint \
&& mv "ktlint" /usr/bin/
########################################### ###########################################
# Load GitHub Env Vars for GitHub Actions # # Load GitHub Env Vars for GitHub Actions #
########################################### ###########################################
@ -116,12 +145,14 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \
DEFAULT_BRANCH=${DEFAULT_BRANCH} \ DEFAULT_BRANCH=${DEFAULT_BRANCH} \
VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \ VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \
LINTER_RULES_PATH=${LINTER_RULES_PATH} \
VALIDATE_YAML=${VALIDATE_YAML} \ VALIDATE_YAML=${VALIDATE_YAML} \
VALIDATE_JSON=${VALIDATE_JSON} \ VALIDATE_JSON=${VALIDATE_JSON} \
VALIDATE_XML=${VALIDATE_XML} \ VALIDATE_XML=${VALIDATE_XML} \
VALIDATE_MD=${VALIDATE_MD} \ VALIDATE_MD=${VALIDATE_MD} \
VALIDATE_BASH=${VALIDATE_BASH} \ VALIDATE_BASH=${VALIDATE_BASH} \
VALIDATE_PERL=${VALIDATE_PERL} \ VALIDATE_PERL=${VALIDATE_PERL} \
VALIDATE_PHP=${VALIDATE_PHP} \
VALIDATE_PYTHON=${VALIDATE_PYTHON} \ VALIDATE_PYTHON=${VALIDATE_PYTHON} \
VALIDATE_RUBY=${VALIDATE_RUBY} \ VALIDATE_RUBY=${VALIDATE_RUBY} \
VALIDATE_COFFEE=${VALIDATE_COFFEE} \ VALIDATE_COFFEE=${VALIDATE_COFFEE} \
@ -135,6 +166,8 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \
VALIDATE_CSS=${VALIDATE_CSS} \ VALIDATE_CSS=${VALIDATE_CSS} \
VALIDATE_ENV=${VALIDATE_ENV} \ VALIDATE_ENV=${VALIDATE_ENV} \
VALIDATE_KOTLIN=${VALIDATE_KOTLIN} \
VALIDATE_POWERSHELL=${VALIDATE_POWERSHELL} \
ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \
RUN_LOCAL=${RUN_LOCAL} \ RUN_LOCAL=${RUN_LOCAL} \
TEST_CASE_RUN=${TEST_CASE_RUN} \ TEST_CASE_RUN=${TEST_CASE_RUN} \

View file

@ -27,6 +27,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
| **JSON** | [jsonlint](https://github.com/zaach/jsonlint) | | **JSON** | [jsonlint](https://github.com/zaach/jsonlint) |
| **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) | | **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) |
| **Perl** | [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) | | **Perl** | [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) |
| **PHP** | [PHP](https://www.php.net/) |
| **Python3** | [pylint](https://www.pylint.org/) | | **Python3** | [pylint](https://www.pylint.org/) |
| **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) | | **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) |
| **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) | | **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) |
@ -34,7 +35,9 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
| **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | | **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) |
| **XML** | [LibXML](http://xmlsoft.org/) | | **XML** | [LibXML](http://xmlsoft.org/) |
| **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | | **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) |
| **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) |
| **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) | | **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) |
| **Kotlin** | [ktlint](https://github.com/pinterest/ktlint) |
## How to use ## How to use
To use this **GitHub** Action you will need to complete the following: To use this **GitHub** Action you will need to complete the following:
@ -95,14 +98,14 @@ jobs:
# Run Linter against code base # # Run Linter against code base #
################################ ################################
- name: Lint Code Base - name: Lint Code Base
uses: docker://github/super-linter:v2.1.1 uses: docker://github/super-linter:v2.2.0
env: env:
VALIDATE_ALL_CODEBASE: false VALIDATE_ALL_CODEBASE: false
VALIDATE_ANSIBLE: false VALIDATE_ANSIBLE: false
... ...
``` ```
**NOTE:** Using the line:`uses: docker://github/super-linter:v2.1.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.1.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... **NOTE:** Using the line:`uses: docker://github/super-linter:v2.2.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.2.0` 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.
@ -118,12 +121,14 @@ and won't run anything unexpected.
| --- | --- | --- | | --- | --- | --- |
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. | | **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | | **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
| **LINTER_RULES_PATH** | `.github/linters` | Directory for all linter configuration rules. |
| **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. | | **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. |
| **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . | | **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . |
@ -134,9 +139,11 @@ and won't run anything unexpected.
| **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) |
| **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_POWERSHELL** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_KOTLIN** | `true` | Flag to enable or disable the linting process of the language. |
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). |
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. | | **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |

View file

@ -29,9 +29,9 @@ quiet: true
################ ################
skip_list: skip_list:
- '602' # Allow compare to empty string - '602' # Allow compare to empty string
- '204' # Allow string length greater that 160 chars - '204' # Allow string length greater than 160 chars
- '301' # False positives for running command shells - '301' # False positives for running command shells
- '303' # Allow git commands for push add, etc... - '303' # Allow git commands for push, add, etc...
- '305' # Allow use of shell when you want - '305' # Allow use of shell when you want
- '503' # Allow step to run like handler - '503' # Allow step to run like handler

View file

@ -0,0 +1,18 @@
#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md#-settings
@{
#CustomRulePath='path\to\CustomRuleModule.psm1'
#RecurseCustomRulePath='path\of\customrules'
#Severity = @(
# 'Error'
# 'Warning'
#)
#IncludeDefaultRules=$true
#ExcludeRules = @(
# 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName'
#)
#IncludeRules = @(
# 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName'
#)
}

View file

@ -1,6 +1,6 @@
# Disabling linters and Rules # Disabling linters and Rules
If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules. If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules.
Below is examples and documentation for each language and the various methods to disable. Below are examples and documentation for each language and the various methods to disable.
## Table of Linters ## Table of Linters
- [Ruby](#ruby) - [Ruby](#ruby)
@ -11,6 +11,7 @@ Below is examples and documentation for each language and the various methods to
- [JSON](#json) - [JSON](#json)
- [Markdown](#markdown) - [Markdown](#markdown)
- [Perl](#perl) - [Perl](#perl)
- [PHP](#php)
- [XML](#xml) - [XML](#xml)
- [Coffeescript](#coffeescript) - [Coffeescript](#coffeescript)
- [Javascript Eslint](#javascript-eslint) - [Javascript Eslint](#javascript-eslint)
@ -22,6 +23,7 @@ Below is examples and documentation for each language and the various methods to
- [Terraform](#terraform) - [Terraform](#terraform)
- [CSS](#stylelint) - [CSS](#stylelint)
- [ENV](#dotenv-linter) - [ENV](#dotenv-linter)
- [Kotlin](#kotlin)
<!-- toc --> <!-- toc -->
@ -303,6 +305,23 @@ Here is more data
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
## PHP
- [PHP](https://www.php.net/)
### PHP Config file
- There is no top level *configuration file* available at this time
### PHP disable single line
- There is currently **No** way to disable rules inline of the file(s)
### PHP disable code block
- There is currently **No** way to disable rules inline of the file(s)
### PHP disable entire file
- There is currently **No** way to disable rules inline of the file(s)
--------------------------------------------------------------------------------
## XML ## XML
- [XML](http://xmlsoft.org/) - [XML](http://xmlsoft.org/)
@ -564,3 +583,27 @@ a {}
### 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
- [ktlint](https://github.com/pinterest/ktlint)
### ktlint Config file
- There is no top level *configuration file* available at this time
### ktlint disable single line
```kotlin
import package.* // ktlint-disable no-wildcard-imports
```
### ktlint disable code block
```kotlin
/* ktlint-disable no-wildcard-imports */
import package.a.*
import package.b.*
/* ktlint-enable no-wildcard-imports */
```
### ktlint disable entire file
- There is currently **No** way to disable rules inline of the file(s)

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# shellcheck disable=SC1003,SC2016 # shellcheck disable=SC1003,SC2016
################################################################################ ################################################################################
@ -12,7 +12,7 @@
########### ###########
# Default Vars # Default Vars
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
LINTER_PATH='.github/linters' # Default linter path LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
# YAML Vars # YAML Vars
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file YAML_FILE_NAME='.yaml-lint.yml' # Name of the file
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
@ -48,25 +48,28 @@ GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to th
# Terraform Vars # Terraform Vars
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules
# Powershell Vars
POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file
POWERSHELL_LINTER_RULES="$DEFAULT_RULES_LOCATION/$POWERSHELL_FILE_NAME" # Path to the Powershell lint rules
# CSS Vars # CSS Vars
CSS_FILE_NAME='.stylelintrc.json' # Name of the file CSS_FILE_NAME='.stylelintrc.json' # Name of the file
CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules
####################################### #######################################
# Linter array for information prints # # Linter array for information prints #
####################################### #######################################
LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
"pylint" "perl" "rubocop" "coffeelint" "eslint" "standard" "pylint" "perl" "rubocop" "coffeelint" "eslint" "standard"
"ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint" "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint"
"stylelint" "dotenv-linter") "stylelint" "dotenv-linter" "powershell" "ktlint")
############################# #############################
# Language array for prints # # Language array for prints #
############################# #############################
LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'PHP' 'RUBY' 'PYTHON'
'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES'
'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS' "ENV") 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM'
'ENV' 'POWERSHELL' 'KOTLIN')
################### ###################
# GitHub ENV Vars # # GitHub ENV Vars #
@ -83,6 +86,7 @@ VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate lang
VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
@ -93,9 +97,11 @@ VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to val
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
@ -128,6 +134,7 @@ FILE_ARRAY_XML=() # Array of files to check
FILE_ARRAY_MD=() # Array of files to check FILE_ARRAY_MD=() # Array of files to check
FILE_ARRAY_BASH=() # Array of files to check FILE_ARRAY_BASH=() # Array of files to check
FILE_ARRAY_PERL=() # Array of files to check FILE_ARRAY_PERL=() # Array of files to check
FILE_ARRAY_PHP=() # Array of files to check
FILE_ARRAY_RUBY=() # Array of files to check FILE_ARRAY_RUBY=() # Array of files to check
FILE_ARRAY_PYTHON=() # Array of files to check FILE_ARRAY_PYTHON=() # Array of files to check
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
@ -138,8 +145,10 @@ FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
FILE_ARRAY_DOCKER=() # Array of files to check FILE_ARRAY_DOCKER=() # Array of files to check
FILE_ARRAY_GO=() # Array of files to check FILE_ARRAY_GO=() # Array of files to check
FILE_ARRAY_TERRAFORM=() # Array of files to check FILE_ARRAY_TERRAFORM=() # Array of files to check
FILE_ARRAY_POWERSHELL=() # Array of files to check
FILE_ARRAY_CSS=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check
FILE_ARRAY_ENV=() # Array of files to check FILE_ARRAY_ENV=() # Array of files to check
FILE_ARRAY_KOTLIN=() # Array of files to check
############ ############
# Counters # # Counters #
@ -150,6 +159,7 @@ ERRORS_FOUND_XML=0 # Count of errors found
ERRORS_FOUND_MARKDOWN=0 # Count of errors found ERRORS_FOUND_MARKDOWN=0 # Count of errors found
ERRORS_FOUND_BASH=0 # Count of errors found ERRORS_FOUND_BASH=0 # Count of errors found
ERRORS_FOUND_PERL=0 # Count of errors found ERRORS_FOUND_PERL=0 # Count of errors found
ERRORS_FOUND_PHP=0 # Count of errors found
ERRORS_FOUND_RUBY=0 # Count of errors found ERRORS_FOUND_RUBY=0 # Count of errors found
ERRORS_FOUND_PYTHON=0 # Count of errors found ERRORS_FOUND_PYTHON=0 # Count of errors found
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
@ -161,8 +171,10 @@ ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
ERRORS_FOUND_DOCKER=0 # Count of errors found ERRORS_FOUND_DOCKER=0 # Count of errors found
ERRORS_FOUND_GO=0 # Count of errors found ERRORS_FOUND_GO=0 # Count of errors found
ERRORS_FOUND_TERRAFORM=0 # Count of errors found ERRORS_FOUND_TERRAFORM=0 # Count of errors found
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
ERRORS_FOUND_CSS=0 # Count of errors found ERRORS_FOUND_CSS=0 # Count of errors found
ERRORS_FOUND_ENV=0 # Count of errors found ERRORS_FOUND_ENV=0 # Count of errors found
ERRORS_FOUND_KOTLIN=0 # Count of errors found
################################################################################ ################################################################################
########################## FUNCTIONS BELOW ##################################### ########################## FUNCTIONS BELOW #####################################
@ -250,14 +262,14 @@ GetLinterRules()
##################################### #####################################
# Validate we have the linter rules # # Validate we have the linter rules #
##################################### #####################################
if [ -f "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" ]; then if [ -f "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" ]; then
echo "----------------------------------------------" echo "----------------------------------------------"
echo "User provided file:[$FILE_NAME], setting rules file..." echo "User provided file:[$FILE_NAME], setting rules file..."
#################################### ####################################
# Copy users into default location # # Copy users into default location #
#################################### ####################################
CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1) CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1)
################### ###################
# Load Error code # # Load Error code #
@ -277,7 +289,7 @@ GetLinterRules()
# No user default provided, using the template default # # No user default provided, using the template default #
######################################################## ########################################################
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
echo " -> Codebase does NOT have file:[$LINTER_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]"
fi fi
fi fi
} }
@ -728,6 +740,7 @@ GetValidationInfo()
VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}') VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}')
VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}') VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}')
VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}') VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}')
VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}')
VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}') VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}')
VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}') VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}')
VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}') VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}')
@ -739,8 +752,10 @@ GetValidationInfo()
VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}')
VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}')
VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}')
VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}')
VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}')
VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}')
VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}')
################################################ ################################################
# Determine if any linters were explicitly set # # Determine if any linters were explicitly set #
@ -752,6 +767,7 @@ GetValidationInfo()
-n "$VALIDATE_MD" || \ -n "$VALIDATE_MD" || \
-n "$VALIDATE_BASH" || \ -n "$VALIDATE_BASH" || \
-n "$VALIDATE_PERL" || \ -n "$VALIDATE_PERL" || \
-n "$VALIDATE_PHP" || \
-n "$VALIDATE_PYTHON" || \ -n "$VALIDATE_PYTHON" || \
-n "$VALIDATE_RUBY" || \ -n "$VALIDATE_RUBY" || \
-n "$VALIDATE_COFFEE" || \ -n "$VALIDATE_COFFEE" || \
@ -763,8 +779,10 @@ GetValidationInfo()
-n "$VALIDATE_DOCKER" || \ -n "$VALIDATE_DOCKER" || \
-n "$VALIDATE_GO" || \ -n "$VALIDATE_GO" || \
-n "$VALIDATE_TERRAFORM" || \ -n "$VALIDATE_TERRAFORM" || \
-n "$VALIDATE_POWERSHELL" || \
-n "$VALIDATE_CSS" || \ -n "$VALIDATE_CSS" || \
-n "$VALIDATE_ENV" ]]; then -n "$VALIDATE_ENV" || \
-n "$VALIDATE_KOTLIN" ]]; then
ANY_SET="true" ANY_SET="true"
fi fi
@ -852,6 +870,20 @@ GetValidationInfo()
VALIDATE_PERL="true" VALIDATE_PERL="true"
fi fi
####################################
# Validate if we should check PHP #
####################################
if [[ "$ANY_SET" == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_PHP" ]]; then
# PHP flag was not set - default to false
VALIDATE_PHP="false"
fi
else
# No linter flags were set - default all to true
VALIDATE_PHP="true"
fi
###################################### ######################################
# Validate if we should check PYTHON # # Validate if we should check PYTHON #
###################################### ######################################
@ -1006,6 +1038,20 @@ GetValidationInfo()
VALIDATE_TERRAFORM="true" VALIDATE_TERRAFORM="true"
fi fi
#########################################
# Validate if we should check POWERSHELL #
#########################################
if [[ "$ANY_SET" == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_POWERSHELL" ]]; then
# POWERSHELL flag was not set - default to false
VALIDATE_POWERSHELL="false"
fi
else
# No linter flags were set - default all to true
VALIDATE_POWERSHELL="true"
fi
################################### ###################################
# Validate if we should check CSS # # Validate if we should check CSS #
################################### ###################################
@ -1020,9 +1066,9 @@ GetValidationInfo()
VALIDATE_CSS="true" VALIDATE_CSS="true"
fi fi
#################################### ###################################
# 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
@ -1034,6 +1080,21 @@ GetValidationInfo()
VALIDATE_ENV="true" VALIDATE_ENV="true"
fi fi
######################################
# Validate if we should check KOTLIN #
######################################
if [[ "$ANY_SET" == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_KOTLIN" ]]; then
# ENV flag was not set - default to false
VALIDATE_KOTLIN="false"
fi
else
# No linter flags were set - default all to true
VALIDATE_KOTLIN="true"
fi
####################################### #######################################
# Print which linters we are enabling # # Print which linters we are enabling #
####################################### #######################################
@ -1067,6 +1128,11 @@ GetValidationInfo()
else else
PRINT_ARRAY+=("- Excluding [PERL] files in code base...") PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
fi fi
if [[ "$VALIDATE_PHP" == "true" ]]; then
PRINT_ARRAY+=("- Validating [PHP] files in code base...")
else
PRINT_ARRAY+=("- Excluding [PHP] files in code base...")
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
@ -1122,6 +1188,11 @@ GetValidationInfo()
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
PRINT_ARRAY+=("- Validating [POWERSHELL] files in code base...")
else
PRINT_ARRAY+=("- Excluding [POWERSHELL] files in code base...")
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
@ -1132,6 +1203,11 @@ GetValidationInfo()
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
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
else
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
fi
############################## ##############################
# Validate Ansible Directory # # Validate Ansible Directory #
@ -1376,6 +1452,18 @@ BuildFileList()
########################################################## ##########################################################
READ_ONLY_CHANGE_FLAG=1 READ_ONLY_CHANGE_FLAG=1
###################### ######################
# Get the PHP files #
######################
elif [ "$FILE_TYPE" == "php" ]; then
################################
# Append the file to the array #
################################
FILE_ARRAY_PHP+=("$FILE")
##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
##########################################################
READ_ONLY_CHANGE_FLAG=1
######################
# Get the RUBY files # # Get the RUBY files #
###################### ######################
elif [ "$FILE_TYPE" == "rb" ]; then elif [ "$FILE_TYPE" == "rb" ]; then
@ -1461,6 +1549,14 @@ BuildFileList()
# 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
###########################
# Get the Powershell files #
###########################
elif [ "$FILE_TYPE" == "ps1" ]; then
################################
# Append the file to the array #
################################
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 #
@ -1479,6 +1575,15 @@ BuildFileList()
# 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
################################
# Append the file to the array #
################################
FILE_ARRAY_KOTLIN+=("$FILE")
##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
##########################################################
READ_ONLY_CHANGE_FLAG=1
elif [ "$FILE" == "Dockerfile" ]; then elif [ "$FILE" == "Dockerfile" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
@ -1704,10 +1809,26 @@ LintCodebase()
echo "---------------------------" echo "---------------------------"
echo "File:[$FILE]" echo "File:[$FILE]"
####################
# Set the base Var #
####################
LINT_CMD=''
#######################################
# Corner case for Powershell subshell #
#######################################
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
################################
# Lint the file with the rules #
################################
# Need to append "'" to make the pwsh call syntax correct, also exit with exit code from inner subshell
LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1)
else
################################ ################################
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE" 2>&1) LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE" 2>&1)
fi
####################### #######################
# Load the error code # # Load the error code #
@ -1874,6 +1995,12 @@ TestCodebase()
# Lint the file with the rules # # Lint the file with the rules #
################################ ################################
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1) LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1)
elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
################################
# Lint the file with the rules #
################################
# Need to append "'" to make the pwsh call syntax correct, also exit with exit code from inner subshell
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1)
else else
################################ ################################
# Lint the file with the rules # # Lint the file with the rules #
@ -1980,6 +2107,7 @@ Footer()
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] || \ [ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] || \
[ "$ERRORS_FOUND_BASH" -ne 0 ] || \ [ "$ERRORS_FOUND_BASH" -ne 0 ] || \
[ "$ERRORS_FOUND_PERL" -ne 0 ] || \ [ "$ERRORS_FOUND_PERL" -ne 0 ] || \
[ "$ERRORS_FOUND_PHP" -ne 0 ] || \
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] || \ [ "$ERRORS_FOUND_PYTHON" -ne 0 ] || \
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] || \ [ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] || \
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] || \ [ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] || \
@ -1990,9 +2118,11 @@ Footer()
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \ [ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \
[ "$ERRORS_FOUND_GO" -ne 0 ] || \ [ "$ERRORS_FOUND_GO" -ne 0 ] || \
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \ [ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] || \
[ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \
[ "$ERRORS_FOUND_CSS" -ne 0 ] || \ [ "$ERRORS_FOUND_CSS" -ne 0 ] || \
[ "$ERRORS_FOUND_ENV" -ne 0 ]; then [ "$ERRORS_FOUND_ENV" -ne 0 ] || \
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then
# Failed exit # Failed exit
echo "Exiting with errors found!" echo "Exiting with errors found!"
exit 1 exit 1
@ -2039,6 +2169,7 @@ RunTestCases()
TestCodebase "BASH" "shellcheck" "shellcheck" ".*\.\(sh\)\$" TestCodebase "BASH" "shellcheck" "shellcheck" ".*\.\(sh\)\$"
TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES -E" ".*\.\(py\)\$" TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES -E" ".*\.\(py\)\$"
TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$"
TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$"
TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$"
TestCodebase "GO" "golangci-lint" "golangci-lint run -c $GO_LINTER_RULES" ".*\.\(go\)\$" TestCodebase "GO" "golangci-lint" "golangci-lint run -c $GO_LINTER_RULES" ".*\.\(go\)\$"
TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f $COFFEESCRIPT_LINTER_RULES" ".*\.\(coffee\)\$" TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f $COFFEESCRIPT_LINTER_RULES" ".*\.\(coffee\)\$"
@ -2049,8 +2180,10 @@ RunTestCases()
TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$"
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint"
TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$"
TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$"
TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$"
TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$"
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$"
################# #################
# Footer prints # # Footer prints #
@ -2105,6 +2238,8 @@ GetLinterRules "$GO_FILE_NAME" "$GO_LINTER_RULES"
GetLinterRules "$DOCKER_FILE_NAME" "$DOCKER_LINTER_RULES" GetLinterRules "$DOCKER_FILE_NAME" "$DOCKER_LINTER_RULES"
# Get Terraform rules # Get Terraform rules
GetLinterRules "$TERRAFORM_FILE_NAME" "$TERRAFORM_LINTER_RULES" GetLinterRules "$TERRAFORM_FILE_NAME" "$TERRAFORM_LINTER_RULES"
# Get PowerShell rules
GetLinterRules "$POWERSHELL_FILE_NAME" "$POWERSHELL_LINTER_RULES"
# Get CSS rules # Get CSS rules
GetLinterRules "$CSS_FILE_NAME" "$CSS_LINTER_RULES" GetLinterRules "$CSS_FILE_NAME" "$CSS_LINTER_RULES"
@ -2216,6 +2351,17 @@ if [ "$VALIDATE_PERL" == "true" ]; then
LintCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "${FILE_ARRAY_PERL[@]}" LintCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "${FILE_ARRAY_PERL[@]}"
fi fi
################
# PHP LINTING #
################
if [ "$VALIDATE_PHP" == "true" ]; then
#######################
# Lint the PHP files #
#######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "${FILE_ARRAY_PHP[@]}"
fi
################ ################
# RUBY LINTING # # RUBY LINTING #
################ ################
@ -2336,15 +2482,26 @@ if [ "$VALIDATE_CSS" == "true" ]; then
LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}" LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}"
fi fi
################ ###############
# ENV LINTING # # ENV LINTING #
################ ###############
if [ "$VALIDATE_ENV" == "true" ]; then if [ "$VALIDATE_ENV" == "true" ]; then
####################### #######################
# Lint the env files # # Lint the env files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" "${FILE_ARRAY_ENV[@]}" LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\).*\$" "${FILE_ARRAY_ENV[@]}"
fi
##################
# KOTLIN LINTING #
##################
if [ "$VALIDATE_KOTLIN" == "true" ]; then
#######################
# Lint the Kotlin files #
#######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "${FILE_ARRAY_ENV[@]}"
fi fi
################## ##################
@ -2358,6 +2515,17 @@ if [ "$VALIDATE_DOCKER" == "true" ]; then
LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}"
fi fi
######################
# POWERSHELL LINTING #
######################
if [ "$VALIDATE_POWERSHELL" == "true" ]; then
#############################
# Lint the powershell files #
#############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "${FILE_ARRAY_POWERSHELL[@]}"
fi
########## ##########
# Footer # # Footer #
########## ##########

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
cat <<EOF cat <<EOF
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------