diff --git a/.automation/test/terraform/README.md b/.automation/test/terraform_tflint/README.md similarity index 100% rename from .automation/test/terraform/README.md rename to .automation/test/terraform_tflint/README.md diff --git a/.automation/test/terraform/bad/terraform_bad_1.tf b/.automation/test/terraform_tflint/bad/terraform_tflint_bad_1.tf similarity index 100% rename from .automation/test/terraform/bad/terraform_bad_1.tf rename to .automation/test/terraform_tflint/bad/terraform_tflint_bad_1.tf diff --git a/.automation/test/terraform/good/terraform_good_1.tf b/.automation/test/terraform_tflint/good/terraform_tflint_good_1.tf similarity index 100% rename from .automation/test/terraform/good/terraform_good_1.tf rename to .automation/test/terraform_tflint/good/terraform_tflint_good_1.tf diff --git a/README.md b/README.md index 7d2ad848..64c16ece 100644 --- a/README.md +++ b/README.md @@ -309,7 +309,7 @@ But if you wish to select or exclude specific linters, we give you full control | **SNAKEMAKE_SNAKEFMT_CONFIG_FILE** | `.snakefmt.toml` | Filename for [Snakemake configuration](https://github.com/snakemake/snakefmt#configuration) (ex: `pyproject.toml`, `.snakefmt.toml`) | | **SSL_CERT_SECRET** | `none` | SSL cert to add to the **Super-Linter** trust store. This is needed for users on `self-hosted` runners or need to inject the cert for security standards (ex. ${{ secrets.SSL_CERT }}) | | **SQL_CONFIG_FILE** | `.sql-config.json` | Filename for [SQL-Lint configuration](https://sql-lint.readthedocs.io/en/latest/files/configuration.html) (ex: `sql-config.json` , `.config.json`) | -| **TERRAFORM_CONFIG_FILE** | `.tflint.hcl` | Filename for [tfLint configuration](https://github.com/terraform-linters/tflint) (ex: `.tflint.hcl`) | +| **TERRAFORM_TFLINT_CONFIG_FILE** | `.tflint.hcl` | Filename for [tfLint configuration](https://github.com/terraform-linters/tflint) (ex: `.tflint.hcl`) | | **TERRAFORM_TERRASCAN_CONFIG_FILE**| `terrascan.toml` | Filename for [terrascan configuration](https://github.com/accurics/terrascan) (ex: `terrascan.toml`) | | **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`) | | **USE_FIND_ALGORITHM** | `false` | By default, we use `git diff` to find all files in the workspace and what has been updated, this would enable the Linux `find` method instead to find all files to lint | @@ -374,7 +374,7 @@ But if you wish to select or exclude specific linters, we give you full control | **VALIDATE_SQL** | `true` | Flag to enable or disable the linting process of the SQL language. | | **VALIDATE_SQLFLUFF** | `true` | Flag to enable or disable the linting process of the SQL language. (Utilizing: sqlfuff) | | **VALIDATE_TEKTON** | `true` | Flag to enable or disable the linting process of the Tekton language. | -| **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the Terraform language. | +| **VALIDATE_TERRAFORM_TFLINT** | `true` | Flag to enable or disable the linting process of the Terraform language. (Utilizing tflint) | | **VALIDATE_TERRAFORM_TERRASCAN** | `true` | Flag to enable or disable the linting process of the Terraform language for security related issues. | | **VALIDATE_TERRAGRUNT** | `true` | Flag to enable or disable the linting process for Terragrunt files. | | **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: eslint) | diff --git a/lib/functions/buildFileList.sh b/lib/functions/buildFileList.sh index b181a751..120e811b 100755 --- a/lib/functions/buildFileList.sh +++ b/lib/functions/buildFileList.sh @@ -710,7 +710,7 @@ function BuildFileList() { ################################ # Append the file to the array # ################################ - FILE_ARRAY_TERRAFORM+=("${FILE}") + FILE_ARRAY_TERRAFORM_TFLINT+=("${FILE}") FILE_ARRAY_TERRAFORM_TERRASCAN+=("${FILE}") ############################ diff --git a/lib/functions/worker.sh b/lib/functions/worker.sh index 0e20c04b..0d6b36da 100755 --- a/lib/functions/worker.sh +++ b/lib/functions/worker.sh @@ -91,6 +91,15 @@ function LintCodebase() { ############################ # Example: markdown_good_1.md -> good FILE_STATUS=$(echo "${FILE_NAME}" | cut -f2 -d'_') + # Example: clan_format_good_1.md -> good + SECONDARY_STATUS=$(echo "${FILE_NAME}" | cut -f3 -d'_') + + #################################### + # Catch edge cases of double names # + #################################### + if [ "${SECONDARY_STATUS}" == 'good' ] || [ "${SECONDARY_STATUS}" == 'bad' ]; then + FILE_STATUS="${SECONDARY_STATUS}" + fi ################### # Check if docker # diff --git a/lib/linter.sh b/lib/linter.sh index 9ca37937..68284de2 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -160,7 +160,7 @@ SUPPRESS_POSSUM="${SUPPRESS_POSSUM:-false}" # shellcheck disable=SC2034 # Variable is referenced indirectly SQL_FILE_NAME="${SQL_CONFIG_FILE:-.sql-config.json}" # shellcheck disable=SC2034 # Variable is referenced indirectly -TERRAFORM_FILE_NAME="${TERRAFORM_CONFIG_FILE:-.tflint.hcl}" +TERRAFORM_TFLINT_FILE_NAME="${TERRAFORM_TFLINT_CONFIG_FILE:-.tflint.hcl}" # shellcheck disable=SC2034 # Variable is referenced indirectly TERRAFORM_TERRASCAN_FILE_NAME="${TERRAFORM_TERRASCAN_CONFIG_FILE:-terrascan.toml}" # shellcheck disable=SC2034 # Variable is referenced indirectly @@ -204,7 +204,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLANG_FORMAT' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL' 'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RUBY' 'RUST_2015' 'RUST_2018' 'RUST_CLIPPY' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' - 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL' 'SQLFLUFF' 'TEKTON' 'TERRAFORM' + 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL' 'SQLFLUFF' 'TEKTON' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML') @@ -271,7 +271,7 @@ LINTER_NAMES_ARRAY['STATES']="asl-validator" LINTER_NAMES_ARRAY['SQL']="sql-lint" LINTER_NAMES_ARRAY['SQLFLUFF']="sqlfluff" LINTER_NAMES_ARRAY['TEKTON']="tekton-lint" -LINTER_NAMES_ARRAY['TERRAFORM']="tflint" +LINTER_NAMES_ARRAY['TERRAFORM_TFLINT']="tflint" LINTER_NAMES_ARRAY['TERRAFORM_TERRASCAN']="terrascan" LINTER_NAMES_ARRAY['TERRAGRUNT']="terragrunt" LINTER_NAMES_ARRAY['TSX']="eslint" @@ -886,7 +886,7 @@ LINTER_COMMANDS_ARRAY['STATES']="asl-validator --json-path" LINTER_COMMANDS_ARRAY['SQL']="sql-lint --config ${SQL_LINTER_RULES}" LINTER_COMMANDS_ARRAY['SQLFLUFF']="sqlfluff lint" LINTER_COMMANDS_ARRAY['TEKTON']="tekton-lint" -LINTER_COMMANDS_ARRAY['TERRAFORM']="tflint -c ${TERRAFORM_LINTER_RULES}" +LINTER_COMMANDS_ARRAY['TERRAFORM_TFLINT']="tflint -c ${TERRAFORM_TFLINT_LINTER_RULES}" LINTER_COMMANDS_ARRAY['TERRAFORM_TERRASCAN']="terrascan scan -i terraform -t all -c ${TERRAFORM_TERRASCAN_LINTER_RULES} -f" LINTER_COMMANDS_ARRAY['TERRAGRUNT']="terragrunt hclfmt --terragrunt-check --terragrunt-log-level error --terragrunt-hclfmt-file" LINTER_COMMANDS_ARRAY['TSX']="eslint --no-eslintrc -c ${TSX_LINTER_RULES}"