Merge pull request #451 from nemchik/state-braces

State braces
This commit is contained in:
Lukas Gravley 2020-07-22 09:43:04 -05:00 committed by GitHub
commit 0f5e47e560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 172 additions and 165 deletions

View file

@ -1,13 +1,19 @@
# 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.

2
.github/CODEOWNERS vendored
View file

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

View file

@ -30,7 +30,7 @@ jobs:
if: github.actor == 'dependabot[bot]'
steps:
- name: merge
uses: actions/github-script@0.2.0
uses: actions/github-script@v2
with:
script: |
github.pullRequests.createReview({

View file

@ -165,56 +165,56 @@ This means that if you run the linter "out of the box", all languages will be ch
But if you wish to select specific linters, we give you full control to choose which linters are run,
and won't run anything unexpected.
| **ENV VAR** | **Default Value** | **Notes** |
| --- | --- | --- |
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
| **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. |
| **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`)|
| **ENV VAR** | **Default Value** | **Notes** |
| -------------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
| **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. |
| **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. |
| **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

View file

@ -86,7 +86,7 @@ function BuildFileList() {
###########################
# Extract just the file and extension, reverse it, cut off extension,
# reverse it back, substitute to lowercase
FILE_TYPE=$(basename "${FILE}" | rev | cut -f1 -d'.' | rev | awk '{print tolower(${0})}')
FILE_TYPE=$(basename "${FILE}" | rev | cut -f1 -d'.' | rev | awk '{print tolower($0)}')
##############
# Print file #
@ -163,11 +163,11 @@ function BuildFileList() {
############################################
# Check if the file is AWS States Language #
############################################
if DetectAWSStatesFIle "$FILE"; then
if DetectAWSStatesFIle "${FILE}"; then
################################
# Append the file to the array #
################################
FILE_ARRAY_STATES+=("$FILE")
FILE_ARRAY_STATES+=("${FILE}")
fi
##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #

View file

@ -21,82 +21,81 @@ source /action/lib/worker.sh # Source the function script(s)
###########
# GLOBALS #
###########
# 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
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
# 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
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
# 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
# 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
# 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
GO_FILE_NAME='.golangci.yml' # Name of the file
GO_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${GO_FILE_NAME}" # Path to the Go 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
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
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
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
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
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
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
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
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
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
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
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
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=('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')
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 #
@ -105,8 +104,8 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT'
'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')
'RAKU' 'RUBY' 'STATES' 'TERRAFORM' 'TSX' 'TYPESCRIPT_ES'
'TYPESCRIPT_STANDARD' 'XML' 'YML')
############################################
# Array for all languages that were linted #
@ -171,10 +170,10 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-false}" # Boolean to see even more
################
# Default Vars #
################
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
DEFAULT_IFS="${IFS}" # Get the Default IFS for updating
###############################################################
@ -188,7 +187,7 @@ READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if
echo "${READ_ONLY_CHANGE_FLAG}" > /dev/null 2>&1 || true # Workaround SC2034
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034
DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory
DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory
echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034
WARNING_ARRAY_TEST=() # Array of warning linters that did not have an expected test result.
echo "${WARNING_ARRAY_TEST[*]}" > /dev/null 2>&1 || true # Workaround SC2034
@ -199,7 +198,7 @@ echo "${WARNING_ARRAY_TEST[*]}" > /dev/null 2>&1 || true # Workaround SC2034
OUTPUT_FORMAT="${OUTPUT_FORMAT}" # Output format to be generated. Default none
OUTPUT_FOLDER="${OUTPUT_FOLDER:-super-linter.report}" # Folder where the reports are generated. Default super-linter.report
OUTPUT_DETAILS="${OUTPUT_DETAILS:-simpler}" # What level of details. (simpler or detailed). Default simpler
REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}"
REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the report folder
##########################
# Array of changed files #
@ -312,9 +311,9 @@ GetLinterVersions() {
# Go through the array of linters and print version info #
##########################################################
for LINTER in "${LINTER_ARRAY[@]}"; do
###################
# Get the version #
###################
####################
# Get the versions #
####################
if [[ "${LINTER}" == "arm-ttk" ]]; then
# Need specific command for ARM
mapfile -t GET_VERSION_CMD < <(grep -iE 'version' "${ARM_TTK_PSD1}" | xargs 2>&1)
@ -586,13 +585,13 @@ DetectAWSStatesFIle() {
################
# Pull in Vars #
################
FILE="$1" # File that we need to validate
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
if grep '"Resource": *"arn"*' "${FILE}"; then
# Found it
return 0
fi
@ -963,39 +962,39 @@ Footer() {
###############################
# Exit with 1 if errors found #
###############################
elif [ "$ERRORS_FOUND_ANSIBLE" -ne 0 ] ||
[ "$ERRORS_FOUND_ARM" -ne 0 ] ||
[ "$ERRORS_FOUND_BASH" -ne 0 ] ||
[ "$ERRORS_FOUND_CFN" -ne 0 ] ||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] ||
[ "$ERRORS_FOUND_COFFEESCRIPT" -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_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
elif [ "${ERRORS_FOUND_ANSIBLE}" -ne 0 ] ||
[ "${ERRORS_FOUND_ARM}" -ne 0 ] ||
[ "${ERRORS_FOUND_BASH}" -ne 0 ] ||
[ "${ERRORS_FOUND_CFN}" -ne 0 ] ||
[ "${ERRORS_FOUND_CLOJURE}" -ne 0 ] ||
[ "${ERRORS_FOUND_COFFEESCRIPT}" -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_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
@ -1531,7 +1530,7 @@ fi
######################
# AWS STATES LINTING #
######################
if [ "$VALIDATE_STATES" == "true" ]; then
if [ "${VALIDATE_STATES}" == "true" ]; then
#########################
# Lint the STATES files #
#########################

View file

@ -260,9 +260,9 @@ function GetValidationInfo() {
##########################################
# Validate if we should check AWS States #
##########################################
if [[ $ANY_SET == "true" ]]; then
if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_STATES ]]; then
if [[ -z ${VALIDATE_STATES} ]]; then
# STATES flag was not set - default to false
VALIDATE_STATES="false"
fi
@ -735,7 +735,7 @@ function GetValidationInfo() {
else
PRINT_ARRAY+=("- Excluding [HTML] files in code base...")
fi
if [[ $VALIDATE_STATES == "true" ]]; then
if [[ ${VALIDATE_STATES} == "true" ]]; then
PRINT_ARRAY+=("- Validating [AWS STATES] files in code base...")
else
PRINT_ARRAY+=("- Excluding [AWS STATES] files in code base...")

View file

@ -217,6 +217,7 @@ function LintCodebase() {
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[${LINTER_COMMAND} ${FILE}]${NC}"
# Increment the error count
(("ERRORS_FOUND_${FILE_TYPE}++"))
@ -460,6 +461,7 @@ function TestCodebase() {
#########
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Found errors in [${LINTER_NAME}] linter!${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} This file should have failed test case!${NC}"
echo -e "${NC}${B[R]}${F[W]}Command run:${NC}[\$${LINT_CMD}]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[${LINT_CMD}]${NC}"
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[${LINTER_COMMAND} ${FILE}]${NC}"
# Increment the error count
@ -577,11 +579,11 @@ function RunTestCases() {
TestCodebase "PROTOBUF" "protolint" "protolint lint --config_path ${PROTOBUF_LINTER_RULES}" ".*\.\(proto\)\$" "protobuf"
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 "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"
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"
TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml"
TestCodebase "YML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "yml"