mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 23:32:10 -05:00
Merge pull request #463 from github/FixMissingVars
found the missing link
This commit is contained in:
commit
17450e8cd9
17 changed files with 254 additions and 864 deletions
|
@ -1,22 +0,0 @@
|
||||||
TAP version 13
|
|
||||||
1..8
|
|
||||||
not ok 1 - cfn_bad_1.json
|
|
||||||
---
|
|
||||||
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_1.json 6 10\n
|
|
||||||
...
|
|
||||||
not ok 2 - cfn_bad_2.yaml
|
|
||||||
---
|
|
||||||
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_2.yaml 5 5\n
|
|
||||||
...
|
|
||||||
not ok 3 - cfn_bad_3.json
|
|
||||||
---
|
|
||||||
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_3.json 11 13\n
|
|
||||||
...
|
|
||||||
not ok 4 - cfn_bad_4.yaml
|
|
||||||
---
|
|
||||||
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_4.yaml 9 7\n
|
|
||||||
...
|
|
||||||
ok 5 - cfn_good_1.json
|
|
||||||
ok 6 - cfn_good_2.yaml
|
|
||||||
ok 7 - cfn_good_3.json
|
|
||||||
ok 8 - cfn_good_4.yaml
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
TAP version 13
|
||||||
|
1..8
|
||||||
|
not ok 1 - cloudformation_bad_1.json
|
||||||
|
---
|
||||||
|
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_1.json 6 10\n
|
||||||
|
...
|
||||||
|
not ok 2 - cloudformation_bad_2.yaml
|
||||||
|
---
|
||||||
|
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_2.yaml 5 5\n
|
||||||
|
...
|
||||||
|
not ok 3 - cloudformation_bad_3.json
|
||||||
|
---
|
||||||
|
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_3.json 11 13\n
|
||||||
|
...
|
||||||
|
not ok 4 - cloudformation_bad_4.yaml
|
||||||
|
---
|
||||||
|
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_4.yaml 9 7\n
|
||||||
|
...
|
||||||
|
ok 5 - cloudformation_good_1.json
|
||||||
|
ok 6 - cloudformation_good_2.yaml
|
||||||
|
ok 7 - cloudformation_good_3.json
|
||||||
|
ok 8 - cloudformation_good_4.yaml
|
|
@ -209,6 +209,7 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
||||||
VALIDATE_ARM=${VALIDATE_ARM} \
|
VALIDATE_ARM=${VALIDATE_ARM} \
|
||||||
VALIDATE_BASH=${VALIDATE_BASH} \
|
VALIDATE_BASH=${VALIDATE_BASH} \
|
||||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||||
|
VALIDATE_CLOUDFORMATION=${VALIDATE_CLOUDFORMATION} \
|
||||||
VALIDATE_COFFEE=${VALIDATE_COFFEE} \
|
VALIDATE_COFFEE=${VALIDATE_COFFEE} \
|
||||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||||
VALIDATE_DART=${VALIDATE_DART} \
|
VALIDATE_DART=${VALIDATE_DART} \
|
||||||
|
|
|
@ -18,7 +18,7 @@ For some linters it is also possible to override rules on a case by case level w
|
||||||
- [Shell](#shell)
|
- [Shell](#shell)
|
||||||
- [Ansible](#ansible)
|
- [Ansible](#ansible)
|
||||||
- [YAML](#yaml)
|
- [YAML](#yaml)
|
||||||
- [AWS CloudFormation templates](#cfn)
|
- [AWS CloudFormation templates](#aws-cloud-formation)
|
||||||
- [Python](#python3)
|
- [Python](#python3)
|
||||||
- [JSON](#json)
|
- [JSON](#json)
|
||||||
- [Markdown](#markdown)
|
- [Markdown](#markdown)
|
||||||
|
|
|
@ -99,9 +99,9 @@ function BuildFileList() {
|
||||||
#########
|
#########
|
||||||
#echo "FILE_TYPE:[${FILE_TYPE}]"
|
#echo "FILE_TYPE:[${FILE_TYPE}]"
|
||||||
|
|
||||||
#####################
|
################################
|
||||||
# Get the CFN files #
|
# Get the CLOUDFORMATION files #
|
||||||
#####################
|
################################
|
||||||
if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
|
if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
|
||||||
################################
|
################################
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
|
@ -119,7 +119,7 @@ function BuildFileList() {
|
||||||
################################
|
################################
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
################################
|
################################
|
||||||
FILE_ARRAY_CFN+=("${FILE}")
|
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||||
|
@ -159,7 +159,7 @@ function BuildFileList() {
|
||||||
################################
|
################################
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
################################
|
################################
|
||||||
FILE_ARRAY_CFN+=("${FILE}")
|
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
|
||||||
fi
|
fi
|
||||||
############################################
|
############################################
|
||||||
# Check if the file is AWS States Language #
|
# Check if the file is AWS States Language #
|
||||||
|
|
336
lib/linter.sh
336
lib/linter.sh
|
@ -22,71 +22,71 @@ source /action/lib/worker.sh # Source the function script(s)
|
||||||
# GLOBALS #
|
# GLOBALS #
|
||||||
###########
|
###########
|
||||||
# Default Vars
|
# Default Vars
|
||||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||||
# Ansible Vars
|
# Ansible Vars
|
||||||
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
|
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
|
||||||
ANSIBLE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ANSIBLE_FILE_NAME}" # Path to the Ansible lint rules
|
ANSIBLE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ANSIBLE_FILE_NAME}" # Path to the Ansible lint rules
|
||||||
# Azure Resource Manager Vars
|
# Azure Resource Manager Vars
|
||||||
ARM_FILE_NAME='.arm-ttk.psd1' # Name of the file
|
ARM_FILE_NAME='.arm-ttk.psd1' # Name of the file
|
||||||
ARM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ARM_FILE_NAME}" # Path to the ARM lint rules
|
ARM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ARM_FILE_NAME}" # Path to the ARM lint rules
|
||||||
# Cloudformation Vars
|
# Cloudformation Vars
|
||||||
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
CLOUDFORMATION_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||||
CFN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CFN_FILE_NAME}" # Path to the cloudformation lint rules
|
CLOUDFORMATION_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOUDFORMATION_FILE_NAME}" # Path to the cloudformation lint rules
|
||||||
# Clojure Vars
|
# Clojure Vars
|
||||||
CLOJURE_FILE_NAME='.clj-kondo/config.edn' # Name of the file
|
CLOJURE_FILE_NAME='.clj-kondo/config.edn' # Name of the file
|
||||||
CLOJURE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOJURE_FILE_NAME}" # Path to the Clojure lint rules
|
CLOJURE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOJURE_FILE_NAME}" # Path to the Clojure lint rules
|
||||||
# Coffee Vars
|
# Coffee Vars
|
||||||
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||||
COFFEESCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${COFFEE_FILE_NAME}" # Path to the coffeescript lint rules
|
COFFEESCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${COFFEE_FILE_NAME}" # Path to the coffeescript 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
|
||||||
# Dart Vars
|
# Dart Vars
|
||||||
DART_FILE_NAME='analysis_options.yaml' # Name of the file
|
DART_FILE_NAME='analysis_options.yaml' # Name of the file
|
||||||
DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules
|
DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules
|
||||||
# Docker Vars
|
# Docker Vars
|
||||||
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
|
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
|
||||||
DOCKER_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DOCKER_FILE_NAME}" # Path to the Docker lint rules
|
DOCKER_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DOCKER_FILE_NAME}" # Path to the Docker lint rules
|
||||||
# Golang Vars
|
# Golang Vars
|
||||||
GO_FILE_NAME='.golangci.yml' # Name of the file
|
GO_FILE_NAME='.golangci.yml' # Name of the file
|
||||||
GO_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${GO_FILE_NAME}" # Path to the Go lint rules
|
GO_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${GO_FILE_NAME}" # Path to the Go lint rules
|
||||||
# HTML Vars
|
# HTML Vars
|
||||||
HTML_FILE_NAME='.htmlhintrc' # Name of the file
|
HTML_FILE_NAME='.htmlhintrc' # Name of the file
|
||||||
HTML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${HTML_FILE_NAME}" # Path to the CSS lint rules
|
HTML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${HTML_FILE_NAME}" # Path to the CSS lint rules
|
||||||
# Javascript Vars
|
# Javascript Vars
|
||||||
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
||||||
JAVASCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${JAVASCRIPT_FILE_NAME}" # Path to the Javascript lint rules
|
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
|
||||||
# Default linter path
|
# Default linter path
|
||||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
||||||
# MD Vars
|
# MD Vars
|
||||||
MARKDOWN_FILE_NAME='.markdown-lint.yml' # Name of the file
|
MARKDOWN_FILE_NAME='.markdown-lint.yml' # Name of the file
|
||||||
MARKDOWN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${MARKDOWN_FILE_NAME}" # Path to the markdown lint rules
|
MARKDOWN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${MARKDOWN_FILE_NAME}" # Path to the markdown lint rules
|
||||||
# OpenAPI Vars
|
# OpenAPI Vars
|
||||||
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
||||||
OPENAPI_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${OPENAPI_FILE_NAME}" # Path to the OpenAPI lint rules
|
OPENAPI_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${OPENAPI_FILE_NAME}" # Path to the OpenAPI lint rules
|
||||||
# Powershell Vars
|
# Powershell Vars
|
||||||
POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file
|
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
|
POWERSHELL_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${POWERSHELL_FILE_NAME}" # Path to the Powershell lint rules
|
||||||
# Protocol Buffers Vars
|
# Protocol Buffers Vars
|
||||||
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
|
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
|
||||||
PROTOBUF_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PROTOBUF_FILE_NAME}" # Path to the Protocol Buffers lint rules
|
PROTOBUF_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PROTOBUF_FILE_NAME}" # Path to the Protocol Buffers lint rules
|
||||||
# Python Vars
|
# Python Vars
|
||||||
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
||||||
PYTHON_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_FILE_NAME}" # Path to the python lint rules
|
PYTHON_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_FILE_NAME}" # Path to the python lint rules
|
||||||
# Ruby Vars
|
# Ruby Vars
|
||||||
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
||||||
RUBY_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${RUBY_FILE_NAME}" # Path to the ruby lint rules
|
RUBY_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${RUBY_FILE_NAME}" # Path to the ruby lint rules
|
||||||
# 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
|
||||||
# Typescript Vars
|
# Typescript Vars
|
||||||
TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.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
|
||||||
# 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
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Linter array for information prints #
|
# Linter array for information prints #
|
||||||
|
@ -100,7 +100,7 @@ LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo'
|
||||||
#############################
|
#############################
|
||||||
# Language array for prints #
|
# Language array for prints #
|
||||||
#############################
|
#############################
|
||||||
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT'
|
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT'
|
||||||
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES'
|
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES'
|
||||||
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI'
|
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI'
|
||||||
'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON'
|
'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON'
|
||||||
|
@ -130,7 +130,7 @@ VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to vali
|
||||||
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
||||||
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
||||||
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
||||||
VALIDATE_CFN="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
||||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
||||||
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
||||||
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
||||||
|
@ -205,7 +205,7 @@ REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the
|
||||||
##########################
|
##########################
|
||||||
FILE_ARRAY_ARM=() # Array of files to check
|
FILE_ARRAY_ARM=() # Array of files to check
|
||||||
FILE_ARRAY_BASH=() # Array of files to check
|
FILE_ARRAY_BASH=() # Array of files to check
|
||||||
FILE_ARRAY_CFN=() # Array of files to check
|
FILE_ARRAY_CLOUDFORMATION=() # Array of files to check
|
||||||
FILE_ARRAY_CLOJURE=() # Array of files to check
|
FILE_ARRAY_CLOJURE=() # Array of files to check
|
||||||
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
||||||
FILE_ARRAY_CSS=() # Array of files to check
|
FILE_ARRAY_CSS=() # Array of files to check
|
||||||
|
@ -239,39 +239,72 @@ FILE_ARRAY_YML=() # Array of files to check
|
||||||
############
|
############
|
||||||
# Counters #
|
# Counters #
|
||||||
############
|
############
|
||||||
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
||||||
ERRORS_FOUND_ARM=0 # Count of errors found
|
export ERRORS_FOUND_ANSIBLE # Workaround SC2034
|
||||||
ERRORS_FOUND_BASH=0 # Count of errors found
|
ERRORS_FOUND_ARM=0 # Count of errors found
|
||||||
ERRORS_FOUND_CFN=0 # Count of errors found
|
export ERRORS_FOUND_ARM # Workaround SC2034
|
||||||
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
ERRORS_FOUND_BASH=0 # Count of errors found
|
||||||
ERRORS_FOUND_CSS=0 # Count of errors found
|
export ERRORS_FOUND_BASH # Workaround SC2034
|
||||||
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
ERRORS_FOUND_CLOUDFORMATION=0 # Count of errors found
|
||||||
ERRORS_FOUND_DART=0 # Count of errors found
|
export ERRORS_FOUND_CLOUDFORMATION # Workaround SC2034
|
||||||
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
||||||
ERRORS_FOUND_ENV=0 # Count of errors found
|
export ERRORS_FOUND_CLOJURE # Workaround SC2034
|
||||||
ERRORS_FOUND_GO=0 # Count of errors found
|
ERRORS_FOUND_CSS=0 # Count of errors found
|
||||||
ERRORS_FOUND_HTML=0 # Count of errors found
|
export ERRORS_FOUND_CSS # Workaround SC2034
|
||||||
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
||||||
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
export ERRORS_FOUND_COFFEESCRIPT # Workaround SC2034
|
||||||
ERRORS_FOUND_JSON=0 # Count of errors found
|
ERRORS_FOUND_DART=0 # Count of errors found
|
||||||
ERRORS_FOUND_JSX=0 # Count of errors found
|
export ERRORS_FOUND_DART # Workaround SC2034
|
||||||
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
||||||
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
export ERRORS_FOUND_DOCKER # Workaround SC2034
|
||||||
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
ERRORS_FOUND_ENV=0 # Count of errors found
|
||||||
ERRORS_FOUND_PERL=0 # Count of errors found
|
export ERRORS_FOUND_ENV # Workaround SC2034
|
||||||
ERRORS_FOUND_PHP=0 # Count of errors found
|
ERRORS_FOUND_GO=0 # Count of errors found
|
||||||
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
export ERRORS_FOUND_GO # Workaround SC2034
|
||||||
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
ERRORS_FOUND_HTML=0 # Count of errors found
|
||||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
export ERRORS_FOUND_HTML # Workaround SC2034
|
||||||
ERRORS_FOUND_RAKU=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
export ERRORS_FOUND_JAVASCRIPT_STANDARD # Workaround SC2034
|
||||||
ERRORS_FOUND_STATES=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
||||||
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
export ERRORS_FOUND_JAVASCRIPT_ES # Workaround SC2034
|
||||||
ERRORS_FOUND_TSX=0 # Count of errors found
|
ERRORS_FOUND_JSON=0 # Count of errors found
|
||||||
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
export ERRORS_FOUND_JSON # Workaround SC2034
|
||||||
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
ERRORS_FOUND_JSX=0 # Count of errors found
|
||||||
ERRORS_FOUND_XML=0 # Count of errors found
|
export ERRORS_FOUND_JSX # Workaround SC2034
|
||||||
ERRORS_FOUND_YML=0 # Count of errors found
|
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_KOTLIN # Workaround SC2034
|
||||||
|
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_MARKDOWN # Workaround SC2034
|
||||||
|
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_OPENAPI # Workaround SC2034
|
||||||
|
ERRORS_FOUND_PERL=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_PERL # Workaround SC2034
|
||||||
|
ERRORS_FOUND_PHP=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_PHP # Workaround SC2034
|
||||||
|
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_POWERSHELL # Workaround SC2034
|
||||||
|
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_PROTOBUF # Workaround SC2034
|
||||||
|
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_PYTHON # Workaround SC2034
|
||||||
|
ERRORS_FOUND_RAKU=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_RAKU # Workaround SC2034
|
||||||
|
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_RUBY # Workaround SC2034
|
||||||
|
ERRORS_FOUND_STATES=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_STATES # Workaround SC2034
|
||||||
|
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_TERRAFORM # Workaround SC2034
|
||||||
|
ERRORS_FOUND_TSX=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_TSX # Workaround SC2034
|
||||||
|
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_TYPESCRIPT_STANDARD # Workaround SC2034
|
||||||
|
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_TYPESCRIPT_ES # Workaround SC2034
|
||||||
|
ERRORS_FOUND_XML=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_XML # Workaround SC2034
|
||||||
|
ERRORS_FOUND_YML=0 # Count of errors found
|
||||||
|
export ERRORS_FOUND_YML # Workaround SC2034
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
|
@ -574,9 +607,9 @@ DetectCloudFormationFile() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################################
|
#####################################################
|
||||||
# No identifiers of a CFN template found #
|
# No identifiers of a CLOUDFORMATION template found #
|
||||||
##########################################
|
#####################################################
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -890,12 +923,12 @@ CallStatusAPI() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Reports ##########################################################
|
||||||
Footer() {
|
Reports() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "The script has completed"
|
echo "Generated reports:"
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo "----------------------------------------------"
|
echo "----------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -907,6 +940,25 @@ Footer() {
|
||||||
echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}"
|
echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
################################
|
||||||
|
# Prints for warnings if found #
|
||||||
|
################################
|
||||||
|
for TEST in "${WARNING_ARRAY_TEST[@]}"; do
|
||||||
|
echo -e "${NC}${F[Y]}WARN!${NC} Expected file to compare with was not found for ${TEST}${NC}"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
################################################################################
|
||||||
|
#### Function Footer ###########################################################
|
||||||
|
Footer() {
|
||||||
|
echo ""
|
||||||
|
echo "----------------------------------------------"
|
||||||
|
echo "----------------------------------------------"
|
||||||
|
echo "The script has completed"
|
||||||
|
echo "----------------------------------------------"
|
||||||
|
echo "----------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# Need to clean up the lanuage array of duplicates #
|
# Need to clean up the lanuage array of duplicates #
|
||||||
####################################################
|
####################################################
|
||||||
|
@ -935,80 +987,47 @@ Footer() {
|
||||||
# Create status API for Failed language #
|
# Create status API for Failed language #
|
||||||
#########################################
|
#########################################
|
||||||
CallStatusAPI "${LANGUAGE}" "error"
|
CallStatusAPI "${LANGUAGE}" "error"
|
||||||
else
|
######################################
|
||||||
|
# Check if we validated the langauge #
|
||||||
|
######################################
|
||||||
|
elif [ "${!ERROR_COUNTER}" -eq 0 ] && [[ "${UNIQUE_LINTED_ARRAY[*]}" =~ ${LANGUAGE} ]]; then
|
||||||
# No errors found when linting the language
|
# No errors found when linting the language
|
||||||
######################################
|
CallStatusAPI "${LANGUAGE}" "success"
|
||||||
# Check if we validated the langauge #
|
|
||||||
######################################
|
|
||||||
if [[ "${UNIQUE_LINTED_ARRAY[*]}" =~ ${LANGUAGE} ]]; then
|
|
||||||
CallStatusAPI "${LANGUAGE}" "success"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
################################
|
|
||||||
# Prints for warnings if found #
|
|
||||||
################################
|
|
||||||
for TEST in "${WARNING_ARRAY_TEST[@]}"; do
|
|
||||||
echo -e "${NC}${F[Y]}WARN!${NC} Expected file to compare with was not found for ${TEST}${NC}"
|
|
||||||
done
|
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Exit with 0 if errors disabled #
|
# Exit with 0 if errors disabled #
|
||||||
##################################
|
##################################
|
||||||
if [ "${DISABLE_ERRORS}" == "true" ]; then
|
if [ "${DISABLE_ERRORS}" == "true" ]; then
|
||||||
echo -e "${NC}${F[Y]}WARN!${NC} Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[${DISABLE_ERRORS}]${NC}"
|
echo -e "${NC}${F[Y]}WARN!${NC} Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[${DISABLE_ERRORS}]${NC}"
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# Exit with 1 if errors found #
|
# Exit with 1 if errors found #
|
||||||
###############################
|
###############################
|
||||||
elif [ "${ERRORS_FOUND_ANSIBLE}" -ne 0 ] ||
|
# Loop through all languages
|
||||||
[ "${ERRORS_FOUND_ARM}" -ne 0 ] ||
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
[ "${ERRORS_FOUND_BASH}" -ne 0 ] ||
|
# build the variable
|
||||||
[ "${ERRORS_FOUND_CFN}" -ne 0 ] ||
|
ERRORS_FOUND_LANGUAGE="ERRORS_FOUND_${LANGUAGE}"
|
||||||
[ "${ERRORS_FOUND_CLOJURE}" -ne 0 ] ||
|
# Check if error was found
|
||||||
[ "${ERRORS_FOUND_COFFEESCRIPT}" -ne 0 ] ||
|
if [ "${!ERRORS_FOUND_LANGUAGE}" -ne 0 ]; then
|
||||||
[ "${ERRORS_FOUND_CSS}" -ne 0 ] ||
|
# Failed exit
|
||||||
[ "${ERRORS_FOUND_DART}" -ne 0 ] ||
|
echo -e "${NC}${F[R]}Exiting with errors found!${NC}"
|
||||||
[ "${ERRORS_FOUND_DOCKER}" -ne 0 ] ||
|
exit 1
|
||||||
[ "${ERRORS_FOUND_ENV}" -ne 0 ] ||
|
fi
|
||||||
[ "${ERRORS_FOUND_GO}" -ne 0 ] ||
|
done
|
||||||
[ "${ERRORS_FOUND_HTML}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_JAVASCRIPT_ES}" -ne 0 ] ||
|
########################
|
||||||
[ "${ERRORS_FOUND_JAVASCRIPT_STANDARD}" -ne 0 ] ||
|
# Footer prints Exit 0 #
|
||||||
[ "${ERRORS_FOUND_JSON}" -ne 0 ] ||
|
########################
|
||||||
[ "${ERRORS_FOUND_JSX}" -ne 0 ] ||
|
echo ""
|
||||||
[ "${ERRORS_FOUND_KOTLIN}" -ne 0 ] ||
|
echo -e "${NC}${F[G]}All file(s) linted successfully with no errors detected${NC}"
|
||||||
[ "${ERRORS_FOUND_MARKDOWN}" -ne 0 ] ||
|
echo "----------------------------------------------"
|
||||||
[ "${ERRORS_FOUND_OPENAPI}" -ne 0 ] ||
|
echo ""
|
||||||
[ "${ERRORS_FOUND_PERL}" -ne 0 ] ||
|
# Successful exit
|
||||||
[ "${ERRORS_FOUND_PHP}" -ne 0 ] ||
|
exit 0
|
||||||
[ "${ERRORS_FOUND_POWERSHELL}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_PROTOBUF}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_PYTHON}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_RAKU}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_RUBY}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_STATES}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_TERRAFORM}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_TSX}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_TYPESCRIPT_ES}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_TYPESCRIPT_STANDARD}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_XML}" -ne 0 ] ||
|
|
||||||
[ "${ERRORS_FOUND_YML}" -ne 0 ]; then
|
|
||||||
# Failed exit
|
|
||||||
echo -e "${NC}${F[R]}Exiting with errors found!${NC}"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
#################
|
|
||||||
# Footer prints #
|
|
||||||
#################
|
|
||||||
echo ""
|
|
||||||
echo -e "${NC}${F[G]}All file(s) linted successfully with no errors detected${NC}"
|
|
||||||
echo "----------------------------------------------"
|
|
||||||
echo ""
|
|
||||||
# Successful exit
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -1074,8 +1093,8 @@ GetLinterRules "POWERSHELL"
|
||||||
GetLinterRules "ARM"
|
GetLinterRules "ARM"
|
||||||
# Get CSS rules
|
# Get CSS rules
|
||||||
GetLinterRules "CSS"
|
GetLinterRules "CSS"
|
||||||
# Get CFN rules
|
# Get CLOUDFORMATION rules
|
||||||
GetLinterRules "CFN"
|
GetLinterRules "CLOUDFORMATION"
|
||||||
# Get DART rules
|
# Get DART rules
|
||||||
GetLinterRules "DART"
|
GetLinterRules "DART"
|
||||||
# Get HTML rules
|
# Get HTML rules
|
||||||
|
@ -1184,11 +1203,11 @@ if [ "${VALIDATE_PYTHON}" == "true" ]; then
|
||||||
LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}"
|
LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############
|
##########################
|
||||||
# CFN LINTING #
|
# CLOUDFORMATION LINTING #
|
||||||
###############
|
##########################
|
||||||
if [ "${VALIDATE_CFN}" == "true" ]; then
|
if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then
|
||||||
# If we are validating all codebase we need to build file list because not every yml/json file is an CFN file
|
# If we are validating all codebase we need to build file list because not every yml/json file is an CLOUDFORMATION file
|
||||||
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
|
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
||||||
|
@ -1198,7 +1217,7 @@ if [ "${VALIDATE_CFN}" == "true" ]; then
|
||||||
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
||||||
for FILE in "${LIST_FILES[@]}"; do
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
if DetectCloudFormationFile "${FILE}"; then
|
if DetectCloudFormationFile "${FILE}"; then
|
||||||
FILE_ARRAY_CFN+=("${FILE}")
|
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -1212,7 +1231,7 @@ if [ "${VALIDATE_CFN}" == "true" ]; then
|
||||||
# Lint the CloudFormation files #
|
# Lint the CloudFormation 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 "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" "disabledfileext" "${FILE_ARRAY_CFN[@]}"
|
LintCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" "disabledfileext" "${FILE_ARRAY_CLOUDFORMATION[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -1597,6 +1616,11 @@ if [ "${VALIDATE_STATES}" == "true" ]; then
|
||||||
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "disabledfileext" "${FILE_ARRAY_STATES[@]}"
|
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "disabledfileext" "${FILE_ARRAY_STATES[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###########
|
||||||
|
# Reports #
|
||||||
|
###########
|
||||||
|
Reports
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# Footer #
|
# Footer #
|
||||||
##########
|
##########
|
||||||
|
|
|
@ -46,700 +46,65 @@ function GetValidationInfo() {
|
||||||
################################
|
################################
|
||||||
# Convert strings to lowercase #
|
# Convert strings to lowercase #
|
||||||
################################
|
################################
|
||||||
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE,,}"
|
# Loop through all languages
|
||||||
VALIDATE_ARM="${VALIDATE_ARM,,}"
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
VALIDATE_BASH="${VALIDATE_BASH,,}"
|
# build the variable
|
||||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}"
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
VALIDATE_COFFEE="${VALIDATE_COFFEE,,}"
|
# Set the value of the var to lowercase
|
||||||
VALIDATE_CSS="${VALIDATE_CSS,,}"
|
eval "${VALIDATE_LANGUAGE}=${!VALIDATE_LANGUAGE,,}"
|
||||||
VALIDATE_DART="${VALIDATE_DART,,}"
|
done
|
||||||
VALIDATE_DOCKER="${VALIDATE_DOCKER,,}"
|
|
||||||
VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG,,}"
|
|
||||||
VALIDATE_ENV="${VALIDATE_ENV,,}"
|
|
||||||
VALIDATE_GO="${VALIDATE_GO,,}"
|
|
||||||
VALIDATE_HTML="${VALIDATE_HTML,,}"
|
|
||||||
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES,,}"
|
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD,,}"
|
|
||||||
VALIDATE_JSON="${VALIDATE_JSON,,}"
|
|
||||||
VALIDATE_JSX="${VALIDATE_JSX,,}"
|
|
||||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN,,}"
|
|
||||||
VALIDATE_MARKDOWN="${VALIDATE_MARKDOWN,,}"
|
|
||||||
VALIDATE_OPENAPI="${VALIDATE_OPENAPI,,}"
|
|
||||||
VALIDATE_PERL="${VALIDATE_PERL,,}"
|
|
||||||
VALIDATE_PHP="${VALIDATE_PHP,,}"
|
|
||||||
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL,,}"
|
|
||||||
VALIDATE_PROTOBUF="${VALIDATE_PROTOBUF,,}"
|
|
||||||
VALIDATE_PYTHON="${VALIDATE_PYTHON,,}"
|
|
||||||
VALIDATE_RAKU="${VALIDATE_RAKU,,}"
|
|
||||||
VALIDATE_RUBY="${VALIDATE_RUBY,,}"
|
|
||||||
VALIDATE_STATES="${VALIDATE_STATES,,}"
|
|
||||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM,,}"
|
|
||||||
VALIDATE_TSX="${VALIDATE_TSX,,}"
|
|
||||||
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES,,}"
|
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD,,}"
|
|
||||||
VALIDATE_YAML="${VALIDATE_YAML,,}"
|
|
||||||
VALIDATE_XML="${VALIDATE_XML,,}"
|
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Determine if any linters were explicitly set #
|
# Determine if any linters were explicitly set #
|
||||||
################################################
|
################################################
|
||||||
ANY_SET="false"
|
ANY_SET="false"
|
||||||
if [[ -n ${VALIDATE_ANSIBLE} || -n \
|
# Loop through all languages
|
||||||
${VALIDATE_ARM} || -n \
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
${VALIDATE_BASH} || -n \
|
# build the variable
|
||||||
${VALIDATE_CLOJURE} || -n \
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
${VALIDATE_COFFEE} || -n \
|
# Check to see if the variable was set
|
||||||
${VALIDATE_CSS} || -n \
|
if [ -n "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
${VALIDATE_DART} || -n \
|
# It was set, need to set flag
|
||||||
${VALIDATE_DOCKER} || -n \
|
ANY_SET="true"
|
||||||
${VALIDATE_EDITORCONFIG} || -n \
|
|
||||||
${VALIDATE_ENV} || -n \
|
|
||||||
${VALIDATE_GO} || -n \
|
|
||||||
${VALIDATE_HTML} || -n \
|
|
||||||
${VALIDATE_JAVASCRIPT_ES} || -n \
|
|
||||||
${VALIDATE_JAVASCRIPT_STANDARD} || -n \
|
|
||||||
${VALIDATE_JSON} || -n \
|
|
||||||
${VALIDATE_KOTLIN} || -n \
|
|
||||||
${VALIDATE_MARKDOWN} || -n \
|
|
||||||
${VALIDATE_OPENAPI} || -n \
|
|
||||||
${VALIDATE_PERL} || -n \
|
|
||||||
${VALIDATE_PHP} || -n \
|
|
||||||
${VALIDATE_POWERSHELL} || -n \
|
|
||||||
${VALIDATE_PROTOBUF} || -n \
|
|
||||||
${VALIDATE_PYTHON} || -n \
|
|
||||||
${VALIDATE_RAKU} || -n \
|
|
||||||
${VALIDATE_RUBY} || -n \
|
|
||||||
${VALIDATE_TERRAFORM} || -n \
|
|
||||||
${VALIDATE_TYPESCRIPT_ES} || -n \
|
|
||||||
${VALIDATE_TYPESCRIPT_STANDARD} || -n \
|
|
||||||
${VALIDATE_XML} || -n \
|
|
||||||
${VALIDATE_YAML} ]]; then
|
|
||||||
ANY_SET="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check YAML #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_YAML} ]]; then
|
|
||||||
# YAML flag was not set - default to false
|
|
||||||
VALIDATE_YAML="false"
|
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_YAML="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check JSON #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_JSON} ]]; then
|
|
||||||
# JSON flag was not set - default to false
|
|
||||||
VALIDATE_JSON="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_JSON="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Validate if we should check XML #
|
|
||||||
###################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_XML} ]]; then
|
|
||||||
# XML flag was not set - default to false
|
|
||||||
VALIDATE_XML="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_XML="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# Validate if we should check MARKDOWN #
|
|
||||||
########################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_MARKDOWN} ]]; then
|
|
||||||
# MD flag was not set - default to false
|
|
||||||
VALIDATE_MARKDOWN="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_MARKDOWN="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check BASH #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_BASH} ]]; then
|
|
||||||
# BASH flag was not set - default to false
|
|
||||||
VALIDATE_BASH="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_BASH="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check PERL #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_PERL} ]]; then
|
|
||||||
# PERL flag was not set - default to false
|
|
||||||
VALIDATE_PERL="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_PERL="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check RAKU #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_RAKU} ]]; then
|
|
||||||
# RAKU flag was not set - default to false
|
|
||||||
VALIDATE_RAKU="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_RAKU="true"
|
|
||||||
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 #
|
|
||||||
######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_PYTHON} ]]; then
|
|
||||||
# PYTHON flag was not set - default to false
|
|
||||||
VALIDATE_PYTHON="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_PYTHON="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check RUBY #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_RUBY} ]]; then
|
|
||||||
# RUBY flag was not set - default to false
|
|
||||||
VALIDATE_RUBY="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_RUBY="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################
|
|
||||||
# Validate if we should check AWS States #
|
|
||||||
##########################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_STATES} ]]; then
|
|
||||||
# STATES flag was not set - default to false
|
|
||||||
VALIDATE_STATES="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_STATES="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# Validate if we should check COFFEE #
|
|
||||||
######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_COFFEE} ]]; then
|
|
||||||
# COFFEE flag was not set - default to false
|
|
||||||
VALIDATE_COFFEE="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_COFFEE="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate if we should check ANSIBLE #
|
|
||||||
#######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_ANSIBLE} ]]; then
|
|
||||||
# ANSIBLE flag was not set - default to false
|
|
||||||
VALIDATE_ANSIBLE="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_ANSIBLE="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Validate if we should check JAVASCRIPT_ES #
|
|
||||||
#############################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_JAVASCRIPT_ES} ]]; then
|
|
||||||
# JAVASCRIPT_ES flag was not set - default to false
|
|
||||||
VALIDATE_JAVASCRIPT_ES="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_JAVASCRIPT_ES="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# Validate if we should check JAVASCRIPT_STANDARD #
|
# Validate if we should check individual lanuages #
|
||||||
###################################################
|
###################################################
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
# Loop through all languages
|
||||||
# Some linter flags were set - only run those set to true
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
if [[ -z ${VALIDATE_JAVASCRIPT_STANDARD} ]]; then
|
# build the variable
|
||||||
# JAVASCRIPT_STANDARD flag was not set - default to false
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="false"
|
# Check if ANY_SET was set
|
||||||
|
if [[ ${ANY_SET} == "true" ]]; then
|
||||||
|
# Check to see if the variable was set
|
||||||
|
if [ -z "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
|
# Flag was not set, default to false
|
||||||
|
eval "${VALIDATE_LANGUAGE}='false'"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No linter flags were set - default all to true
|
||||||
|
eval "${VALIDATE_LANGUAGE}='true'"
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Validate if we should check JSX #
|
|
||||||
#############################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_JSX} ]]; then
|
|
||||||
# JSX flag was not set - default to false
|
|
||||||
VALIDATE_JSX="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_JSX="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Validate if we should check TSX #
|
|
||||||
#############################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_TSX} ]]; then
|
|
||||||
# TSX flag was not set - default to false
|
|
||||||
VALIDATE_TSX="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_TSX="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Validate if we should check TYPESCRIPT_ES #
|
|
||||||
#############################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_TYPESCRIPT_ES} ]]; then
|
|
||||||
# TYPESCRIPT_ES flag was not set - default to false
|
|
||||||
VALIDATE_TYPESCRIPT_ES="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_TYPESCRIPT_ES="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################################################
|
|
||||||
# Validate if we should check TYPESCRIPT_STANDARD #
|
|
||||||
###################################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_TYPESCRIPT_STANDARD} ]]; then
|
|
||||||
# TYPESCRIPT_STANDARD flag was not set - default to false
|
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# Validate if we should check DOCKER #
|
|
||||||
######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_DOCKER} ]]; then
|
|
||||||
# DOCKER flag was not set - default to false
|
|
||||||
VALIDATE_DOCKER="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_DOCKER="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
##################################
|
|
||||||
# Validate if we should check GO #
|
|
||||||
##################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_GO} ]]; then
|
|
||||||
# GO flag was not set - default to false
|
|
||||||
VALIDATE_GO="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_GO="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# Validate if we should check TERRAFORM #
|
|
||||||
#########################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_TERRAFORM} ]]; then
|
|
||||||
# TERRAFORM flag was not set - default to false
|
|
||||||
VALIDATE_TERRAFORM="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_TERRAFORM="true"
|
|
||||||
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 ARM #
|
|
||||||
###################################
|
|
||||||
if [[ "${ANY_SET}" == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z "${VALIDATE_ARM}" ]]; then
|
|
||||||
# ARM flag was not set - default to false
|
|
||||||
VALIDATE_ARM="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_ARM="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Validate if we should check CSS #
|
|
||||||
###################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_CSS} ]]; then
|
|
||||||
# CSS flag was not set - default to false
|
|
||||||
VALIDATE_CSS="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_CSS="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Validate if we should check ENV #
|
|
||||||
###################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_ENV} ]]; then
|
|
||||||
# ENV flag was not set - default to false
|
|
||||||
VALIDATE_ENV="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_ENV="true"
|
|
||||||
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 DART #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_DART} ]]; then
|
|
||||||
# ENV flag was not set - default to false
|
|
||||||
VALIDATE_DART="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_DART="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate if we should check OPENAPI #
|
|
||||||
#######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_OPENAPI} ]]; then
|
|
||||||
# OPENAPI flag was not set - default to false
|
|
||||||
VALIDATE_OPENAPI="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_OPENAPI="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate if we should check PROTOBUF #
|
|
||||||
#######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_PROTOBUF} ]]; then
|
|
||||||
# PROTOBUF flag was not set - default to false
|
|
||||||
VALIDATE_PROTOBUF="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_PROTOBUF="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Validate if we should check Clojure #
|
|
||||||
#######################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_CLOJURE} ]]; then
|
|
||||||
# Clojure flag was not set - default to false
|
|
||||||
VALIDATE_CLOJURE="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_CLOJURE="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
############################################
|
|
||||||
# Validate if we should check editorconfig #
|
|
||||||
############################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_EDITORCONFIG} ]]; then
|
|
||||||
# EDITORCONFIG flag was not set - default to false
|
|
||||||
VALIDATE_EDITORCONFIG="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set
|
|
||||||
# special case checking for .editorconfig
|
|
||||||
if [ -f "${GITHUB_WORKSPACE}/.editorconfig" ]; then
|
|
||||||
VALIDATE_EDITORCONFIG="true"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Validate if we should check HTML #
|
|
||||||
####################################
|
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
|
||||||
# Some linter flags were set - only run those set to true
|
|
||||||
if [[ -z ${VALIDATE_HTML} ]]; then
|
|
||||||
# HTML flag was not set - default to false
|
|
||||||
VALIDATE_HTML="false"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# No linter flags were set - default all to true
|
|
||||||
VALIDATE_HTML="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Print which linters we are enabling #
|
# Print which linters we are enabling #
|
||||||
#######################################
|
#######################################
|
||||||
if [[ ${VALIDATE_YAML} == "true" ]]; then
|
# Loop through all languages
|
||||||
PRINT_ARRAY+=("- Validating [YAML] files in code base...")
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
else
|
# build the variable
|
||||||
PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
|
VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}"
|
||||||
fi
|
if [[ ${!VALIDATE_LANGUAGE} == "true" ]]; then
|
||||||
if [[ ${VALIDATE_JSON} == "true" ]]; then
|
# We need to validate
|
||||||
PRINT_ARRAY+=("- Validating [JSON] files in code base...")
|
PRINT_ARRAY+=("- Validating [$LANGUAGE] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [JSON] files in code base...")
|
# We are skipping the language
|
||||||
fi
|
PRINT_ARRAY+=("- Excluding [$LANGUAGE] files in code base...")
|
||||||
if [[ ${VALIDATE_XML} == "true" ]]; then
|
fi
|
||||||
PRINT_ARRAY+=("- Validating [XML] files in code base...")
|
done
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_MARKDOWN} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_BASH} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [BASH] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [BASH] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_PERL} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [PERL] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_RAKU} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [RAKU] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [RAKU] files in code base...")
|
|
||||||
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
|
|
||||||
PRINT_ARRAY+=("- Validating [PYTHON] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [PYTHON] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_RUBY} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [RUBY] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [RUBY] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_COFFEE} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [COFFEE] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [COFFEE] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_ANSIBLE} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [ANSIBLE] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [ANSIBLE] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_JAVASCRIPT_ES} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [JAVASCRIPT(eslint)] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(eslint)] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_JAVASCRIPT_STANDARD} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [JAVASCRIPT(standard)] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [JAVASCRIPT(standard)] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_TYPESCRIPT_ES} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [TYPESCRIPT(eslint)] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(eslint)] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_TYPESCRIPT_STANDARD} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [TYPESCRIPT(standard)] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [TYPESCRIPT(standard)] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_DOCKER} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [DOCKER] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [DOCKER] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_GO} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [GOLANG] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [GOLANG] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_TERRAFORM} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [TERRAFORM] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...")
|
|
||||||
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_ARM} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [ARM] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [ARM] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_CSS} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [CSS] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_CLOJURE} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_ENV} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [ENV] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_KOTLIN} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [KOTLIN] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_OPENAPI} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_PROTOBUF} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [PROTOBUF] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_DART} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [DART] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [DART] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_EDITORCONFIG} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [EDITORCONFIG] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [EDITORCONFIG] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_HTML} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [HTML] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [HTML] files in code base...")
|
|
||||||
fi
|
|
||||||
if [[ ${VALIDATE_STATES} == "true" ]]; then
|
|
||||||
PRINT_ARRAY+=("- Validating [AWS STATES] files in code base...")
|
|
||||||
else
|
|
||||||
PRINT_ARRAY+=("- Excluding [AWS STATES] files in code base...")
|
|
||||||
fi
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Validate Ansible Directory #
|
# Validate Ansible Directory #
|
||||||
|
|
|
@ -557,7 +557,7 @@ function RunTestCases() {
|
||||||
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c ${ANSIBLE_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "ansible"
|
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c ${ANSIBLE_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "ansible"
|
||||||
TestCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm"
|
TestCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm"
|
||||||
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell"
|
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell"
|
||||||
TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "cfn"
|
TestCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "cloudformation"
|
||||||
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure"
|
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure"
|
||||||
TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript"
|
TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript"
|
||||||
TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css"
|
TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css"
|
||||||
|
|
Loading…
Reference in a new issue