mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 21:50:59 -05:00
Adding states linter
This commit is contained in:
parent
b191b0ed0b
commit
1971c8359e
10 changed files with 313 additions and 203 deletions
13
.automation/test/states/README.md
Normal file
13
.automation/test/states/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# AWS States language Test Cases
|
||||
This folder holds the test cases for **AWS States Language**.
|
||||
|
||||
## 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.
|
7
.automation/test/states/reports/expected-STATES.tap
Normal file
7
.automation/test/states/reports/expected-STATES.tap
Normal file
|
@ -0,0 +1,7 @@
|
|||
TAP version 13
|
||||
1..2
|
||||
not ok 1 - json_bad_1.json
|
||||
---
|
||||
message: Error Parse error on line 6 \n...ng" { "level" 'ignore', "space\n----------------------^\nExpecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'\n at Object.parseError (/node_modules/jsonlint/lib/jsonlint.js 55 11)\n at Object.parse (/node_modules/jsonlint/lib/jsonlint.js 132 22)\n at parse (/node_modules/jsonlint/lib/cli.js 82 14)\n at main (/node_modules/jsonlint/lib/cli.js 135 14)\n at Object.<anonymous> (/node_modules/jsonlint/lib/cli.js 179 1)\n at Module._compile (internal/modules/cjs/loader.js 1138 30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js 1158 10)\n at Module.load (internal/modules/cjs/loader.js 986 32)\n at Function.Module._load (internal/modules/cjs/loader.js 879 14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js 71 12)\n
|
||||
...
|
||||
ok 2 - json_good_1.json
|
10
.automation/test/states/states_bad_1.json
Normal file
10
.automation/test/states/states_bad_1.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Comment": "A simple minimal example of the States language",
|
||||
"StartAt": "Hello World",
|
||||
"States": {
|
||||
"Hello World": {
|
||||
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
|
||||
"End": true
|
||||
}
|
||||
}
|
||||
}
|
11
.automation/test/states/states_good_1.json
Normal file
11
.automation/test/states/states_good_1.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Comment": "A simple minimal example of the States language",
|
||||
"StartAt": "Hello World",
|
||||
"States": {
|
||||
"Hello World": {
|
||||
"Type": "Task",
|
||||
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
|
||||
"End": true
|
||||
}
|
||||
}
|
||||
}
|
83
Dockerfile
83
Dockerfile
|
@ -190,50 +190,51 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/reposi
|
|||
###########################################
|
||||
# Load GitHub Env Vars for GitHub Actions #
|
||||
###########################################
|
||||
ENV GITHUB_SHA=${GITHUB_SHA} \
|
||||
GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \
|
||||
GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \
|
||||
DEFAULT_BRANCH=${DEFAULT_BRANCH} \
|
||||
VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \
|
||||
LINTER_RULES_PATH=${LINTER_RULES_PATH} \
|
||||
VALIDATE_YAML=${VALIDATE_YAML} \
|
||||
VALIDATE_JSON=${VALIDATE_JSON} \
|
||||
VALIDATE_XML=${VALIDATE_XML} \
|
||||
VALIDATE_MD=${VALIDATE_MD} \
|
||||
VALIDATE_BASH=${VALIDATE_BASH} \
|
||||
VALIDATE_PERL=${VALIDATE_PERL} \
|
||||
VALIDATE_RAKU=${VALIDATE_RAKU} \
|
||||
VALIDATE_PHP=${VALIDATE_PHP} \
|
||||
VALIDATE_PYTHON=${VALIDATE_PYTHON} \
|
||||
VALIDATE_RUBY=${VALIDATE_RUBY} \
|
||||
VALIDATE_COFFEE=${VALIDATE_COFFEE} \
|
||||
VALIDATE_ANSIBLE=${VALIDATE_ANSIBLE} \
|
||||
VALIDATE_DOCKER=${VALIDATE_DOCKER} \
|
||||
VALIDATE_JAVASCRIPT_ES=${VALIDATE_JAVASCRIPT_ES} \
|
||||
VALIDATE_JAVASCRIPT_STANDARD=${VALIDATE_JAVASCRIPT_STANDARD} \
|
||||
VALIDATE_TYPESCRIPT_ES=${VALIDATE_TYPESCRIPT_ES} \
|
||||
VALIDATE_TYPESCRIPT_STANDARD=${VALIDATE_TYPESCRIPT_STANDARD} \
|
||||
VALIDATE_GO=${VALIDATE_GO} \
|
||||
VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \
|
||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||
VALIDATE_ENV=${VALIDATE_ENV} \
|
||||
VALIDATE_HTML=${VALIDATE_HTML} \
|
||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||
VALIDATE_KOTLIN=${VALIDATE_KOTLIN} \
|
||||
VALIDATE_DART=${VALIDATE_DART} \
|
||||
VALIDATE_POWERSHELL=${VALIDATE_POWERSHELL} \
|
||||
VALIDATE_ARM=${VALIDATE_ARM} \
|
||||
VALIDATE_OPENAPI=${VALIDATE_OPENAPI} \
|
||||
VALIDATE_PROTOBUF=${VALIDATE_PROTOBUF} \
|
||||
VALIDATE_EDITORCONFIG=${VALIDATE_EDITORCONFIG} \
|
||||
ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
||||
ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \
|
||||
DEFAULT_BRANCH=${DEFAULT_BRANCH} \
|
||||
DISABLE_ERRORS=${DISABLE_ERRORS} \
|
||||
GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \
|
||||
GITHUB_SHA=${GITHUB_SHA} \
|
||||
GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \
|
||||
LINTER_RULES_PATH=${LINTER_RULES_PATH} \
|
||||
OUTPUT_DETAILS=${OUTPUT_DETAILS} \
|
||||
OUTPUT_FOLDER=${OUTPUT_FOLDER} \
|
||||
OUTPUT_FORMAT=${OUTPUT_FORMAT} \
|
||||
RUN_LOCAL=${RUN_LOCAL} \
|
||||
TEST_CASE_RUN=${TEST_CASE_RUN} \
|
||||
ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
||||
DISABLE_ERRORS=${DISABLE_ERRORS} \
|
||||
OUTPUT_FORMAT=${OUTPUT_FORMAT} \
|
||||
OUTPUT_FOLDER=${OUTPUT_FOLDER} \
|
||||
OUTPUT_DETAILS=${OUTPUT_DETAILS}
|
||||
VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \
|
||||
VALIDATE_ANSIBLE=${VALIDATE_ANSIBLE} \
|
||||
VALIDATE_ARM=${VALIDATE_ARM} \
|
||||
VALIDATE_BASH=${VALIDATE_BASH} \
|
||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||
VALIDATE_COFFEE=${VALIDATE_COFFEE} \
|
||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||
VALIDATE_DART=${VALIDATE_DART} \
|
||||
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_KOTLIN=${VALIDATE_KOTLIN} \
|
||||
VALIDATE_MD=${VALIDATE_MD} \
|
||||
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_TYPESCRIPT_ES=${VALIDATE_TYPESCRIPT_ES} \
|
||||
VALIDATE_TYPESCRIPT_STANDARD=${VALIDATE_TYPESCRIPT_STANDARD} \
|
||||
VALIDATE_XML=${VALIDATE_XML} \
|
||||
VALIDATE_YAML=${VALIDATE_YAML}
|
||||
|
||||
#############################
|
||||
# Copy scripts to container #
|
||||
|
|
86
README.md
86
README.md
|
@ -35,6 +35,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
|||
| **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) |
|
||||
| **Azure Resource Manager (ARM)** | [arm-ttk](https://github.com/azure/arm-ttk) |
|
||||
| **AWS CloudFormation templates** | [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/) |
|
||||
| **AWS States Language | [asl-validator](https://github.com/ChristopheBougere/asl-validator) |
|
||||
| **CSS** | [stylelint](https://stylelint.io/) |
|
||||
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
||||
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
||||
|
@ -154,53 +155,54 @@ and won't run anything unexpected.
|
|||
|
||||
| **ENV VAR** | **Default Value** | **Notes** |
|
||||
| --- | --- | --- |
|
||||
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
|
||||
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
|
||||
| **LINTER_RULES_PATH** | `.github/linters` | Directory for all linter configuration rules. |
|
||||
| **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_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_PERL** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_RAKU** | `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_RUBY** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **RUBY_CONFIG_FILE** | `.ruby-lint.yml` | Filename for [rubocop configuration](https://docs.rubocop.org/rubocop/configuration.html) (ex: `.ruby-lint.yml`, `.rubocop.yml`)|
|
||||
| **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . |
|
||||
| **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) |
|
||||
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)|
|
||||
| **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) |
|
||||
| **VALIDATE_JSX** | `true` | Flag to enable or disable the linting process for jsx files (Utilizing: eslint) |
|
||||
| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: eslint) |
|
||||
| **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) |
|
||||
| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)|
|
||||
| **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_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_ARM** | `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_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_HTML** | `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. |
|
||||
| **VALIDATE_DART** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_CLOUDFORMATION** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_PROTOBUF** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_EDITORCONFIG** | `true` | Flag to enable or disable the linting process with the editorconfig. |
|
||||
| **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. |
|
||||
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
|
||||
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). |
|
||||
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
|
||||
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. |
|
||||
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
|
||||
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)|
|
||||
| **LINTER_RULES_PATH** | `.github/linters` | Directory for all linter configuration rules. |
|
||||
| **MULTI_STATUS** | `true` | A status API is made for each language that is linted to make visual parsing easier. |
|
||||
| **OUTPUT_FORMAT** | `none` | The report format to be generated, besides the stdout one. Output format of tap is currently using v13 of the specification. Supported formats: tap |
|
||||
| **OUTPUT_FOLDER** | `super-linter.report` | The location where the output reporting will be generated to. Output folder must not previously exist. |
|
||||
| **OUTPUT_DETAILS** | `simpler` | What level of details to be reported. Supported formats: simpler or detailed. |
|
||||
| **MULTI_STATUS** | `true` | A status API is made for each language that is linted to make visual parsing easier. |
|
||||
| **RUBY_CONFIG_FILE** | `.ruby-lint.yml` | Filename for [rubocop configuration](https://docs.rubocop.org/rubocop/configuration.html) (ex: `.ruby-lint.yml`, `.rubocop.yml`)|
|
||||
| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)|
|
||||
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
|
||||
| **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the Ansible language. |
|
||||
| **VALIDATE_ARM** | `true` | Flag to enable or disable the linting process of the ARM language. |
|
||||
| **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the Bash language. |
|
||||
| **VALIDATE_CLOJURE** | `true` | Flag to enable or disable the linting process of the Clojure language. |
|
||||
| **VALIDATE_CLOUDFORMATION** | `true` | Flag to enable or disable the linting process of the AWS Cloud Formation language. |
|
||||
| **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the Coffeescript language . |
|
||||
| **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the CSS language. |
|
||||
| **VALIDATE_DART** | `true` | Flag to enable or disable the linting process of the Dart language. |
|
||||
| **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the Docker language. |
|
||||
| **VALIDATE_EDITORCONFIG** | `true` | Flag to enable or disable the linting process with the editorconfig. |
|
||||
| **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the ENV language. |
|
||||
| **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the Golang language. |
|
||||
| **VALIDATE_HTML** | `true` | Flag to enable or disable the linting process of the HTML language. |
|
||||
| **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the Javascript language. (Utilizing: eslint) |
|
||||
| **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the Javascript language. (Utilizing: standard) |
|
||||
| **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the JSON language. |
|
||||
| **VALIDATE_JSX** | `true` | Flag to enable or disable the linting process for jsx files (Utilizing: eslint) |
|
||||
| **VALIDATE_KOTLIN** | `true` | Flag to enable or disable the linting process of the Kotlin language. |
|
||||
| **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the Markdown language. |
|
||||
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the OpenAPI language. |
|
||||
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. |
|
||||
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. |
|
||||
| **VALIDATE_PROTOBUF** | `true` | Flag to enable or disable the linting process of the Protobuf language. |
|
||||
| **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the Python language. |
|
||||
| **VALIDATE_POWERSHELL** | `true` | Flag to enable or disable the linting process of the Powershell language. |
|
||||
| **VALIDATE_RAKU** | `true` | Flag to enable or disable the linting process of the Raku language. |
|
||||
| **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the Ruby language. |
|
||||
| **VALIDATE_STATES** | `true` | Flag to enable or disable the linting process for AWS States Language. |
|
||||
| **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the Terraform language. |
|
||||
| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: eslint) |
|
||||
| **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the Typescript language. (Utilizing: eslint) |
|
||||
| **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the Typescript language. (Utilizing: standard) |
|
||||
| **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the XML language. |
|
||||
| **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the YAML language. |
|
||||
|
||||
### Template rules files
|
||||
You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
|
||||
|
|
|
@ -160,6 +160,15 @@ function BuildFileList() {
|
|||
################################
|
||||
FILE_ARRAY_CFN+=("$FILE")
|
||||
fi
|
||||
############################################
|
||||
# Check if the file is AWS States Language #
|
||||
############################################
|
||||
if DetectAWSStatesFIle "$FILE"; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_STATES+=("$FILE")
|
||||
fi
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
|
|
222
lib/linter.sh
222
lib/linter.sh
|
@ -21,89 +21,91 @@ source /action/lib/worker.sh # Source the function script(s)
|
|||
###########
|
||||
# GLOBALS #
|
||||
###########
|
||||
# Default Vars
|
||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
||||
# YAML Vars
|
||||
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
|
||||
# MD Vars
|
||||
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
|
||||
# Python Vars
|
||||
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
||||
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
||||
# Cloudformation Vars
|
||||
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||
CFN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CFN_FILE_NAME" # Path to the cloudformation lint rules
|
||||
# Ruby Vars
|
||||
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
||||
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
||||
# Coffee Vars
|
||||
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules
|
||||
# Javascript Vars
|
||||
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
||||
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
||||
JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||
# Typescript Vars
|
||||
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_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||
# Ansible Vars
|
||||
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
|
||||
# Azure Resource Manager Vars
|
||||
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
|
||||
# Cloudformation Vars
|
||||
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||
CFN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CFN_FILE_NAME" # Path to the cloudformation lint rules
|
||||
# Clojure Vars
|
||||
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
|
||||
# Coffee Vars
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules
|
||||
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||
# CSS Vars
|
||||
CSS_FILE_NAME='.stylelintrc.json' # Name of the file
|
||||
CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules
|
||||
# Dart Vars
|
||||
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
|
||||
# Default Vars
|
||||
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
|
||||
# Docker Vars
|
||||
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
|
||||
DOCKER_LINTER_RULES="$DEFAULT_RULES_LOCATION/$DOCKER_FILE_NAME" # Path to the Docker lint rules
|
||||
# Golang Vars
|
||||
GO_FILE_NAME='.golangci.yml' # Name of the file
|
||||
GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to the Go lint rules
|
||||
# Terraform Vars
|
||||
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
|
||||
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
|
||||
# Azure Resource Manager Vars
|
||||
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
|
||||
# CSS Vars
|
||||
CSS_FILE_NAME='.stylelintrc.json' # Name of the file
|
||||
CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules
|
||||
# OpenAPI Vars
|
||||
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
||||
OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI lint rules
|
||||
# Protocol Buffers Vars
|
||||
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
|
||||
# Clojure Vars
|
||||
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
|
||||
# Dart Vars
|
||||
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
|
||||
# HTML Vars
|
||||
HTML_FILE_NAME='.htmlhintrc' # Name of the file
|
||||
HTML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$HTML_FILE_NAME" # Path to the CSS lint rules
|
||||
# Javascript Vars
|
||||
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
||||
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
||||
JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||
# Default linter path
|
||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
||||
# MD Vars
|
||||
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
|
||||
# OpenAPI Vars
|
||||
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
||||
OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI 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
|
||||
# Protocol Buffers Vars
|
||||
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
|
||||
# Python Vars
|
||||
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
||||
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
||||
# Ruby Vars
|
||||
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
|
||||
# Terraform Vars
|
||||
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
|
||||
TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules
|
||||
# Typescript Vars
|
||||
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_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||
# YAML Vars
|
||||
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
|
||||
|
||||
#######################################
|
||||
# Linter array for information prints #
|
||||
#######################################
|
||||
LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
|
||||
"pylint" "perl" "raku" "rubocop" "coffeelint" "eslint" "standard"
|
||||
"ansible-lint" "dockerfilelint" "golangci-lint" "tflint"
|
||||
"stylelint" "dotenv-linter" "pwsh" "arm-ttk" "ktlint" "protolint" "clj-kondo"
|
||||
"spectral" "cfn-lint" "dart" "htmlhint")
|
||||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo' 'coffeelint'
|
||||
'dart' 'dockerfilelint' 'dotenv-linter' 'eslint' 'golangci-lint' 'htmlhint'
|
||||
'jsonlint' 'ktlint' 'markdownlint' 'perl' 'protolint' 'pwsh' 'pylint'
|
||||
'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'tflint'
|
||||
'xmllint' 'yamllint')
|
||||
|
||||
#############################
|
||||
# Language array for prints #
|
||||
#############################
|
||||
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT'
|
||||
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML'
|
||||
'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'OPENAPI'
|
||||
'MARKDOWN' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY'
|
||||
'TERRAFORM' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YML' )
|
||||
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES'
|
||||
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI'
|
||||
'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON'
|
||||
'RAKU' 'RUBY' 'STATES' 'TERRAFORM' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD'
|
||||
'XML' 'YML')
|
||||
|
||||
############################################
|
||||
# Array for all languages that were linted #
|
||||
|
@ -113,15 +115,17 @@ LINTED_LANGUAGES_ARRAY=() # Will be filled at run time with all languages that w
|
|||
###################
|
||||
# GitHub ENV Vars #
|
||||
###################
|
||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
||||
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
||||
|
@ -149,14 +153,13 @@ VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to vali
|
|||
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
|
||||
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||
VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||
VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate language
|
||||
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language
|
||||
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
|
||||
VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language
|
||||
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
||||
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
|
||||
|
||||
##############
|
||||
# Debug Vars #
|
||||
|
@ -225,6 +228,7 @@ FILE_ARRAY_PROTOBUF=() # Array of files to check
|
|||
FILE_ARRAY_PYTHON=() # Array of files to check
|
||||
FILE_ARRAY_RAKU=() # Array of files to check
|
||||
FILE_ARRAY_RUBY=() # Array of files to check
|
||||
FILE_ARRAY_STATES=() # Array of files to check
|
||||
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
||||
FILE_ARRAY_TSX=() # Array of files to check
|
||||
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
||||
|
@ -261,6 +265,7 @@ ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
|||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||
ERRORS_FOUND_RAKU=0 # Count of errors found
|
||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||
ERRORS_FOUND_STATES=0 # Count of errors found
|
||||
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
||||
ERRORS_FOUND_TSX=0 # Count of errors found
|
||||
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
||||
|
@ -574,7 +579,28 @@ DetectCloudFormationFile() {
|
|||
##########################################
|
||||
return 1
|
||||
}
|
||||
################################################################################
|
||||
#### Function DetectAWSStatesFIle ##############################################
|
||||
DetectAWSStatesFIle() {
|
||||
################
|
||||
# Pull in Vars #
|
||||
################
|
||||
FILE="$1" # File that we need to validate
|
||||
|
||||
# https://states-language.net/spec.html#example
|
||||
###############################
|
||||
# check if file has resources #
|
||||
###############################
|
||||
if grep '"Resource": *"arn"*' "$FILE"; then
|
||||
# Found it
|
||||
return 0
|
||||
fi
|
||||
|
||||
#################################################
|
||||
# No identifiers of a AWS States Language found #
|
||||
#################################################
|
||||
return 1
|
||||
}
|
||||
################################################################################
|
||||
#### Function GetGitHubVars ####################################################
|
||||
GetGitHubVars() {
|
||||
|
@ -936,38 +962,38 @@ Footer() {
|
|||
###############################
|
||||
# Exit with 1 if errors found #
|
||||
###############################
|
||||
elif [ "$ERRORS_FOUND_YML" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_JSON" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_XML" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] ||
|
||||
elif [ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_ARM" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_BASH" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PERL" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_RAKU" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PHP" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CFN" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CSS" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_DART" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_ENV" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_GO" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_HTML" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_JAVASCRIPT_ES" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_JAVASCRIPT_STANDARD" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_JSON" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_JSX" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PERL" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PHP" -ne 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_TERRAFORM" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_TSX" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_TYPESCRIPT_ES" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_TYPESCRIPT_STANDARD" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_DOCKER" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_GO" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_POWERSHELL" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_ARM" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_RUBY" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CSS" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CFN" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_ENV" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_PROTOBUF" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_DART" -ne 0 ] ||
|
||||
[ "$ERRORS_FOUND_HTML" -ne 0 ]; then
|
||||
[ "$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
|
||||
|
@ -1500,6 +1526,16 @@ if [ "$VALIDATE_HTML" == "true" ]; then
|
|||
LintCodebase "HTML" "htmlhint" "htmlhint --config $HTML_LINTER_RULES" ".*\.\(html\)\$" "${FILE_ARRAY_HTML[@]}"
|
||||
fi
|
||||
|
||||
######################
|
||||
# AWS STATES LINTING #
|
||||
######################
|
||||
if [ "$VALIDATE_STATES" == "true" ]; then
|
||||
#########################
|
||||
# Lint the STATES files #
|
||||
#########################
|
||||
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "${FILE_ARRAY_STATES[@]}"
|
||||
fi
|
||||
|
||||
##########
|
||||
# Footer #
|
||||
##########
|
||||
|
|
|
@ -72,6 +72,7 @@ function GetValidationInfo() {
|
|||
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,,}"
|
||||
|
@ -83,36 +84,36 @@ function GetValidationInfo() {
|
|||
# Determine if any linters were explicitly set #
|
||||
################################################
|
||||
ANY_SET="false"
|
||||
if [[ -n $VALIDATE_YAML || -n \
|
||||
$VALIDATE_JSON || -n \
|
||||
$VALIDATE_XML || -n \
|
||||
$VALIDATE_MARKDOWN || -n \
|
||||
if [[ -n $VALIDATE_ANSIBLE || -n \
|
||||
$VALIDATE_ARM || -n \
|
||||
$VALIDATE_BASH || -n \
|
||||
$VALIDATE_PERL || -n \
|
||||
$VALIDATE_RAKU || -n \
|
||||
$VALIDATE_PHP || -n \
|
||||
$VALIDATE_PYTHON || -n \
|
||||
$VALIDATE_RUBY || -n \
|
||||
$VALIDATE_CLOJURE || -n \
|
||||
$VALIDATE_COFFEE || -n \
|
||||
$VALIDATE_ANSIBLE || -n \
|
||||
$VALIDATE_CSS || -n \
|
||||
$VALIDATE_DART || -n \
|
||||
$VALIDATE_DOCKER || -n \
|
||||
$VALIDATE_EDITORCONFIG || -n \
|
||||
$VALIDATE_ENV || -n \
|
||||
$VALIDATE_GO || -n \
|
||||
$VALIDATE_HTML ]]; then || -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_DOCKER || -n \
|
||||
$VALIDATE_GO || -n \
|
||||
$VALIDATE_TERRAFORM || -n \
|
||||
$VALIDATE_POWERSHELL || -n \
|
||||
$VALIDATE_ARM || -n \
|
||||
$VALIDATE_CSS || -n \
|
||||
$VALIDATE_ENV || -n \
|
||||
$VALIDATE_CLOJURE || -n \
|
||||
$VALIDATE_PROTOBUF || -n \
|
||||
$VALIDATE_OPENAPI || -n \
|
||||
$VALIDATE_KOTLIN || -n \
|
||||
$VALIDATE_DART || -n \
|
||||
$VALIDATE_EDITORCONFIG || -n \
|
||||
$VALIDATE_HTML ]]; then
|
||||
$VALIDATE_XML || -n \
|
||||
$VALIDATE_YAML ]]; then
|
||||
ANY_SET="true"
|
||||
fi
|
||||
|
||||
|
@ -256,6 +257,20 @@ function GetValidationInfo() {
|
|||
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 #
|
||||
######################################
|
||||
|
@ -720,6 +735,11 @@ function GetValidationInfo() {
|
|||
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 #
|
||||
|
|
|
@ -578,6 +578,7 @@ function RunTestCases() {
|
|||
TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES" ".*\.\(py\)\$" "python"
|
||||
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
|
||||
TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" "ruby"
|
||||
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
|
||||
TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" "terraform"
|
||||
TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
||||
TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "typescript"
|
||||
|
|
Loading…
Reference in a new issue