mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-06 09:15:49 -05:00
Merge branch 'master' into issue/111
This commit is contained in:
commit
f5dc615025
31 changed files with 416 additions and 64 deletions
|
@ -115,9 +115,9 @@ 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-numberic chars #
|
# Remove non alpha-numeric chars #
|
||||||
###################################
|
##################################
|
||||||
IMAGE_VERSION=$(echo "$IMAGE_VERSION" | tr -cd '[:alnum:]')
|
IMAGE_VERSION=$(echo "$IMAGE_VERSION" | tr -cd '[:alnum:]')
|
||||||
else
|
else
|
||||||
#############################################
|
#############################################
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
group: admin
|
group: admin
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
#########################################################
|
########################################################
|
||||||
# Set up Admin password, License, and Initial Setttings #
|
# Set up Admin password, License, and Initial Settings #
|
||||||
#########################################################
|
########################################################
|
||||||
- name: Setup Grafana
|
- name: Setup Grafana
|
||||||
# yamllint disable
|
# yamllint disable
|
||||||
shell: curl --fail -Lk \
|
shell: curl --fail -Lk \
|
||||||
|
|
|
@ -57,10 +57,10 @@
|
||||||
group: admin
|
group: admin
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
#########################################################
|
########################################################
|
||||||
# Set up Admin password, License, and Initial Setttings #
|
# Set up Admin password, License, and Initial Settings #
|
||||||
#########################################################
|
########################################################
|
||||||
- name: Setup License, Admin Password, and Initial Setttings
|
- name: Setup License, Admin Password, and Initial Settings
|
||||||
command: curl --fail -Lk \
|
command: curl --fail -Lk \
|
||||||
-X POST "https://{{ ansible_host }}:8443/setup/api/start" \
|
-X POST "https://{{ ansible_host }}:8443/setup/api/start" \
|
||||||
-F license=@/tmp/ghe-license.ghl \
|
-F license=@/tmp/ghe-license.ghl \
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
group: admin
|
group: admin
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
#########################################################
|
########################################################
|
||||||
# Set up Admin password, License, and Initial Setttings #
|
# Set up Admin password, License, and Initial Settings #
|
||||||
#########################################################
|
########################################################
|
||||||
- name: Setup Splunk
|
- name: Setup Splunk
|
||||||
# yamllint disable
|
# yamllint disable
|
||||||
shell: curl --fail -Lk \
|
shell: curl --fail -Lk \
|
||||||
|
|
|
@ -60,7 +60,7 @@ module.exports = (robot) -> )
|
||||||
# Drop the hammer #
|
# Drop the hammer #
|
||||||
###################
|
###################
|
||||||
robot.respond /drop the hammer/i, (msg) ->
|
robot.respond /drop the hammer/i, (msg) ->
|
||||||
msg.send "Commmencing the hammer dropping..."
|
msg.send "Commencing the hammer dropping..."
|
||||||
msg.send msg.random dropHammer
|
msg.send msg.random dropHammer
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -62,7 +62,7 @@ module.exports = (robot) ->
|
||||||
# Drop the hammer #
|
# Drop the hammer #
|
||||||
###################
|
###################
|
||||||
robot.respond /drop the hammer/i, (msg) ->
|
robot.respond /drop the hammer/i, (msg) ->
|
||||||
msg.send "Commmencing the hammer dropping..."
|
msg.send "Commencing the hammer dropping..."
|
||||||
msg.send msg.random dropHammer
|
msg.send msg.random dropHammer
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -7,7 +7,7 @@ var userArray = [ 'user1' ]
|
||||||
here is some garbage = that
|
here is some garbage = that
|
||||||
|
|
||||||
var teamDescription = Team of Robots
|
var teamDescription = Team of Robots
|
||||||
var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here
|
var teamPrivacy = 'closed' // closed (visible) / secret (hidden) are options here
|
||||||
|
|
||||||
var teamName = process.env.GHES_TEAM_NAME
|
var teamName = process.env.GHES_TEAM_NAME
|
||||||
var teamAccess = 'pull' // pull,push,admin options here
|
var teamAccess = 'pull' // pull,push,admin options here
|
||||||
|
|
|
@ -5,7 +5,7 @@ var handler = createHandler({ path: '/webhook', secret: (process.env.SECRET) })
|
||||||
var userArray = ['user1']
|
var userArray = ['user1']
|
||||||
|
|
||||||
var teamDescription = 'Team of Robots'
|
var teamDescription = 'Team of Robots'
|
||||||
var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here
|
var teamPrivacy = 'closed' // closed (visible) / secret (hidden) are options here
|
||||||
|
|
||||||
var teamName = process.env.GHES_TEAM_NAME
|
var teamName = process.env.GHES_TEAM_NAME
|
||||||
var teamAccess = 'pull' // pull,push,admin options here
|
var teamAccess = 'pull' // pull,push,admin options here
|
||||||
|
|
13
.automation/test/kotlin/README.md
Normal file
13
.automation/test/kotlin/README.md
Normal 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.
|
6
.automation/test/kotlin/kotlin_bad_1.kt
Normal file
6
.automation/test/kotlin/kotlin_bad_1.kt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
fun main() {
|
||||||
|
val n = "World";
|
||||||
|
val v = "Hello, ${n}!";
|
||||||
|
|
||||||
|
println(v);
|
||||||
|
}
|
6
.automation/test/kotlin/kotlint_good_1.kt
Normal file
6
.automation/test/kotlin/kotlint_good_1.kt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
fun main() {
|
||||||
|
val n = "World"
|
||||||
|
val v = "Hello, $n!"
|
||||||
|
|
||||||
|
println(v)
|
||||||
|
}
|
13
.automation/test/php/README.md
Normal file
13
.automation/test/php/README.md
Normal 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.
|
3
.automation/test/php/php_bad_1.php
Normal file
3
.automation/test/php/php_bad_1.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
2pe98y r-n0u823n=r 092u3- r08u2q098ry 09nq2yr09n2yr9 y2n-93yr 298yr3 29
|
3
.automation/test/php/php_good_1.php
Normal file
3
.automation/test/php/php_good_1.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo "Hello World!", PHP_EOL;
|
13
.automation/test/powershell/README.md
Normal file
13
.automation/test/powershell/README.md
Normal 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.
|
14
.automation/test/powershell/powershell_bad_1.ps1
Normal file
14
.automation/test/powershell/powershell_bad_1.ps1
Normal 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 {}
|
||||||
|
}
|
||||||
|
|
3
.automation/test/powershell/powershell_bad_1.psd1
Normal file
3
.automation/test/powershell/powershell_bad_1.psd1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
'Hello'='World
|
||||||
|
}
|
1
.automation/test/powershell/powershell_bad_1.psm1
Normal file
1
.automation/test/powershell/powershell_bad_1.psm1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Write-Output "hello world!
|
1
.automation/test/powershell/powershell_good_1.ps1
Normal file
1
.automation/test/powershell/powershell_good_1.ps1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Write-Output "hello world!"
|
3
.automation/test/powershell/powershell_good_1.psd1
Normal file
3
.automation/test/powershell/powershell_good_1.psd1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
'Hello'='World'
|
||||||
|
}
|
1
.automation/test/powershell/powershell_good_1.psm1
Normal file
1
.automation/test/powershell/powershell_good_1.psm1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Write-Output "hello world!"
|
|
@ -120,9 +120,9 @@ ValidateInput()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###################################
|
##################################
|
||||||
# Remove non alpha-numberic chars #
|
# Remove non alpha-numeric chars #
|
||||||
###################################
|
##################################
|
||||||
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cd '[:alnum:]')
|
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cd '[:alnum:]')
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -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
|
||||||
|
|
8
.github/CONTRIBUTING.md
vendored
8
.github/CONTRIBUTING.md
vendored
|
@ -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. Publish the docker image to GitHub package registry
|
||||||
|
4. Publish the docker image to Docker Hub
|
||||||
|
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/)
|
||||||
|
|
3
.github/ISSUE_TEMPLATE/feature_request.md
vendored
3
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -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.
|
||||||
|
|
2
.github/linters/.yaml-lint.yml
vendored
2
.github/linters/.yaml-lint.yml
vendored
|
@ -3,7 +3,7 @@
|
||||||
# These are the rules used for #
|
# These are the rules used for #
|
||||||
# linting all the yaml files in the stack #
|
# linting all the yaml files in the stack #
|
||||||
# NOTE: #
|
# NOTE: #
|
||||||
# You can disble line with: #
|
# You can disable line with: #
|
||||||
# # yamllint disable-line #
|
# # yamllint disable-line #
|
||||||
###########################################
|
###########################################
|
||||||
rules:
|
rules:
|
||||||
|
|
42
Dockerfile
42
Dockerfile
|
@ -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 #
|
||||||
|
@ -81,8 +101,11 @@ RUN git clone https://github.com/replicatedhq/dockerfilelint.git && cd /dockerfi
|
||||||
RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0
|
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 promot the correct verion, 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,9 +125,9 @@ 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
|
||||||
|
|
||||||
|
@ -117,6 +140,12 @@ RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v${CLJ_KON
|
||||||
&& rm clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \
|
&& rm clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \
|
||||||
&& mv clj-kondo /usr/bin/
|
&& mv clj-kondo /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 #
|
||||||
###########################################
|
###########################################
|
||||||
|
@ -131,6 +160,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
|
||||||
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} \
|
||||||
|
@ -145,6 +175,8 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
|
||||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||||
VALIDATE_ENV=${VALIDATE_ENV} \
|
VALIDATE_ENV=${VALIDATE_ENV} \
|
||||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||||
|
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} \
|
||||||
|
|
10
README.md
10
README.md
|
@ -28,6 +28,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) |
|
||||||
|
@ -35,7 +36,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:
|
||||||
|
@ -96,7 +99,7 @@ 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.1.0
|
||||||
env:
|
env:
|
||||||
VALIDATE_ALL_CODEBASE: false
|
VALIDATE_ALL_CODEBASE: false
|
||||||
VALIDATE_ANSIBLE: false
|
VALIDATE_ANSIBLE: false
|
||||||
|
@ -125,6 +128,7 @@ and won't run anything unexpected.
|
||||||
| **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 . |
|
||||||
|
@ -135,10 +139,12 @@ 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_CLOJURE** | `true` | Flag to enable or disable the linting process of the language. |
|
| **VALIDATE_CLOJURE** | `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. |
|
||||||
|
@ -165,7 +171,7 @@ The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions.
|
||||||
- `.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 branches **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
|
||||||
|
|
||||||
## 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**:
|
||||||
|
|
18
TEMPLATES/.powershell-psscriptanalyzer.psd1
Normal file
18
TEMPLATES/.powershell-psscriptanalyzer.psd1
Normal 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'
|
||||||
|
#)
|
||||||
|
}
|
|
@ -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)
|
||||||
|
|
224
lib/linter.sh
224
lib/linter.sh
|
@ -32,7 +32,7 @@ COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to
|
||||||
JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file
|
JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file
|
||||||
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
||||||
JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||||
# Typecript Vars
|
# Typescript Vars
|
||||||
TYPESCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file
|
TYPESCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file
|
||||||
TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules
|
TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules
|
||||||
TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||||
|
@ -48,6 +48,9 @@ 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
|
||||||
|
@ -55,22 +58,22 @@ CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to th
|
||||||
CLOJURE_FILE_NAME='.clj-kondo/config.edn'
|
CLOJURE_FILE_NAME='.clj-kondo/config.edn'
|
||||||
CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME"
|
CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME"
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# 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" "clj-kondo")
|
"stylelint" "dotenv-linter" "powershell" "ktlint" "clj-kondo")
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# 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'
|
||||||
'CLOJURE')
|
'CSS' 'ENV' 'POWERSHELL' 'KOTLIN' 'CLOJURE')
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# GitHub ENV Vars #
|
# GitHub ENV Vars #
|
||||||
|
@ -87,6 +90,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
|
||||||
|
@ -98,9 +102,11 @@ VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to val
|
||||||
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_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||||
|
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # 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_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # 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
|
||||||
|
|
||||||
|
@ -133,6 +139,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
|
||||||
|
@ -143,9 +150,11 @@ 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_CLOJURE=() # Array of files to check
|
FILE_ARRAY_CLOJURE=() # Array of files to check
|
||||||
|
FILE_ARRAY_KOTLIN=() # Array of files to check
|
||||||
|
|
||||||
############
|
############
|
||||||
# Counters #
|
# Counters #
|
||||||
|
@ -156,6 +165,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
|
||||||
|
@ -167,9 +177,11 @@ 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_CLOJURE=0 # Count of errors found
|
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
|
@ -230,7 +242,7 @@ GetLinterVersions()
|
||||||
##############################
|
##############################
|
||||||
# Check the shell for errors #
|
# Check the shell for errors #
|
||||||
##############################
|
##############################
|
||||||
if [ $ERROR_CODE -ne 0 ] | [ -z "${GET_VERSION_CMD[*]}" ]; then
|
if [ $ERROR_CODE -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then
|
||||||
echo "WARN! Failed to get version info for:[$LINTER]"
|
echo "WARN! Failed to get version info for:[$LINTER]"
|
||||||
echo "---------------------------------------------"
|
echo "---------------------------------------------"
|
||||||
else
|
else
|
||||||
|
@ -361,9 +373,9 @@ GetStandardRules()
|
||||||
ENV_STRING+="--env ${ENV} "
|
ENV_STRING+="--env ${ENV} "
|
||||||
done
|
done
|
||||||
|
|
||||||
########################################
|
#########################################
|
||||||
# Remove trailing and ending witespace #
|
# Remove trailing and ending whitespace #
|
||||||
########################################
|
#########################################
|
||||||
if [[ "$LINTER" == "javascript" ]]; then
|
if [[ "$LINTER" == "javascript" ]]; then
|
||||||
JAVASCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
JAVASCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||||
elif [[ "$LINTER" == "typescript" ]]; then
|
elif [[ "$LINTER" == "typescript" ]]; then
|
||||||
|
@ -735,6 +747,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)}')
|
||||||
|
@ -746,9 +759,11 @@ 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_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)')
|
VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | 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 #
|
||||||
|
@ -760,6 +775,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" || \
|
||||||
|
@ -771,9 +787,11 @@ 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" || \
|
-n "$VALIDATE_ENV" || \
|
||||||
-n "$VALIDATE_CLOJURE" ]]; then
|
-n "$VALIDATE_CLOJURE" || \
|
||||||
|
-n "$VALIDATE_KOTLIN" ]]; then
|
||||||
ANY_SET="true"
|
ANY_SET="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -861,6 +879,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 #
|
||||||
######################################
|
######################################
|
||||||
|
@ -1015,6 +1047,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 #
|
||||||
###################################
|
###################################
|
||||||
|
@ -1029,9 +1075,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
|
||||||
|
@ -1043,6 +1089,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
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Validate if we should check Clojure #
|
# Validate if we should check Clojure #
|
||||||
#######################################
|
#######################################
|
||||||
|
@ -1090,6 +1151,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
|
||||||
|
@ -1145,6 +1211,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
|
||||||
|
@ -1160,6 +1231,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 #
|
||||||
|
@ -1289,9 +1365,9 @@ BuildFileList()
|
||||||
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 comits #
|
# Get the Array of files changed in the commits #
|
||||||
################################################
|
#################################################
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1))
|
RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1))
|
||||||
|
|
||||||
|
@ -1310,9 +1386,9 @@ BuildFileList()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################################################
|
################################################
|
||||||
# Itterate through the array of all files found #
|
# Iterate through the array of all files found #
|
||||||
#################################################
|
################################################
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "Files that have been modified in the commit(s):"
|
echo "Files that have been modified in the commit(s):"
|
||||||
|
@ -1404,6 +1480,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
|
||||||
|
@ -1489,6 +1577,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 #
|
||||||
|
@ -1507,6 +1603,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 #
|
||||||
|
@ -1673,7 +1778,7 @@ LintCodebase()
|
||||||
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 chageset 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
|
||||||
|
@ -1741,10 +1846,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/$TEST_CASE_FOLDER" || 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 #
|
||||||
|
@ -1911,6 +2032,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 #
|
||||||
|
@ -2017,6 +2144,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 ] || \
|
||||||
|
@ -2027,9 +2155,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
|
||||||
|
@ -2055,7 +2185,7 @@ RunTestCases()
|
||||||
# version of linter.sh, and a new container is built with the latest codebase
|
# version of linter.sh, and a new container is built with the latest codebase
|
||||||
# for testing. That container is spun up, and ran,
|
# for testing. That container is spun up, and ran,
|
||||||
# with the flag: TEST_CASE_RUN=true
|
# with the flag: TEST_CASE_RUN=true
|
||||||
# So that the new code can be validated againt the test cases
|
# So that the new code can be validated against the test cases
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Header prints #
|
# Header prints #
|
||||||
|
@ -2076,6 +2206,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\)\$"
|
||||||
|
@ -2086,9 +2217,11 @@ 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 "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$"
|
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$"
|
||||||
|
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$"
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Footer prints #
|
# Footer prints #
|
||||||
|
@ -2113,9 +2246,9 @@ Header
|
||||||
# needed to connect back and update checks
|
# needed to connect back and update checks
|
||||||
GetGitHubVars
|
GetGitHubVars
|
||||||
|
|
||||||
##########################################
|
#########################################
|
||||||
# Get the langugages we need to validate #
|
# Get the languages we need to validate #
|
||||||
##########################################
|
#########################################
|
||||||
GetValidationInfo
|
GetValidationInfo
|
||||||
|
|
||||||
########################
|
########################
|
||||||
|
@ -2143,6 +2276,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"
|
||||||
|
|
||||||
|
@ -2254,6 +2389,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 #
|
||||||
################
|
################
|
||||||
|
@ -2374,15 +2520,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
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
@ -2410,6 +2567,17 @@ if [ "$VALIDATE_CLOJURE" == "true" ]; then
|
||||||
LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}"
|
LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}"
|
||||||
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 #
|
||||||
##########
|
##########
|
||||||
|
|
Loading…
Reference in a new issue