From 3c92dcd70b19a83756a723274188cb3c27523cc6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 22 Jul 2020 14:26:45 -0500 Subject: [PATCH] Went sooo hard on this --- lib/validation.sh | 703 +++------------------------------------------- 1 file changed, 37 insertions(+), 666 deletions(-) diff --git a/lib/validation.sh b/lib/validation.sh index bf1e7ccb..d13bb3f4 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -85,682 +85,53 @@ function GetValidationInfo() { # Determine if any linters were explicitly set # ################################################ ANY_SET="false" - if [[ -n ${VALIDATE_ANSIBLE} || -n \ - ${VALIDATE_ARM} || -n \ - ${VALIDATE_BASH} || -n \ - ${VALIDATE_CLOJURE} || -n \ - ${VALIDATE_CLOUDFORMATION} || -n \ - ${VALIDATE_COFFEE} || -n \ - ${VALIDATE_CSS} || -n \ - ${VALIDATE_DART} || -n \ - ${VALIDATE_DOCKER} || -n \ - ${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" + # Loop through all languages + for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do + # build the variable + VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + # Check to see if the variable was set + if [ -n ${!VALIDATE_LANGUAGE} ]; then + # It was set, need to set flag + ANY_SET="true" fi - else - # No linter flags were set - default all to true - VALIDATE_YAML="true" - fi + done - #################################### - # 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 - # Some linter flags were set - only run those set to true - if [[ -z ${VALIDATE_JAVASCRIPT_STANDARD} ]]; then - # JAVASCRIPT_STANDARD flag was not set - default to false - VALIDATE_JAVASCRIPT_STANDARD="false" + # Loop through all languages + for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do + # build the variable + VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + # 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 - else - # 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 CloudFormation # - ############################################## - if [[ ${ANY_SET} == "true" ]]; then - # Some linter flags were set - only run those set to true - if [[ -z ${VALIDATE_CLOUDFORMATION} ]]; then - # Cloud Formation flag was not set - default to false - VALIDATE_CLOUDFORMATION="false" - fi - else - # No linter flags were set - default all to true - VALIDATE_CLOUDFORMATION="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 + done ####################################### # Print which linters we are enabling # ####################################### - if [[ ${VALIDATE_YAML} == "true" ]]; then - PRINT_ARRAY+=("- Validating [YAML] files in code base...") - else - PRINT_ARRAY+=("- Excluding [YAML] files in code base...") - fi - if [[ ${VALIDATE_JSON} == "true" ]]; then - PRINT_ARRAY+=("- Validating [JSON] files in code base...") - else - PRINT_ARRAY+=("- Excluding [JSON] files in code base...") - fi - if [[ ${VALIDATE_XML} == "true" ]]; then - PRINT_ARRAY+=("- Validating [XML] files in code base...") - 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_CLOUDFORMATION} == "true" ]]; then - PRINT_ARRAY+=("- Validating [CLOUDFORMATION] files in code base...") - else - PRINT_ARRAY+=("- Excluding [CLOUDFORMATION] 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 + # Loop through all languages + for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do + # build the variable + VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + if [[ ${!VALIDATE_LANGUAGE} == "true" ]]; then + # We need to validate + PRINT_ARRAY+=("- Validating [$LANGUAGE] files in code base...") + else + # We are skipping the language + PRINT_ARRAY+=("- Excluding [$LANGUAGE] files in code base...") + fi + done ############################## # Validate Ansible Directory #