From 5001845b7baf4c018e039cf35a418b7dbb3b7b1a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 22 Jul 2020 14:31:47 -0500 Subject: [PATCH] going soooo hard --- lib/validation.sh | 45 +++++++++------------------------------------ 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/lib/validation.sh b/lib/validation.sh index d13bb3f4..57aad373 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -46,40 +46,13 @@ function GetValidationInfo() { ################################ # Convert strings to lowercase # ################################ - VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE,,}" - VALIDATE_ARM="${VALIDATE_ARM,,}" - VALIDATE_BASH="${VALIDATE_BASH,,}" - VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}" - VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION,,}" - 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_JSX="${VALIDATE_JSX,,}" - VALIDATE_KOTLIN="${VALIDATE_KOTLIN,,}" - VALIDATE_MARKDOWN="${VALIDATE_MARKDOWN,,}" - VALIDATE_OPENAPI="${VALIDATE_OPENAPI,,}" - VALIDATE_PERL="${VALIDATE_PERL,,}" - VALIDATE_PHP="${VALIDATE_PHP,,}" - VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL,,}" - VALIDATE_PROTOBUF="${VALIDATE_PROTOBUF,,}" - VALIDATE_PYTHON="${VALIDATE_PYTHON,,}" - VALIDATE_RAKU="${VALIDATE_RAKU,,}" - VALIDATE_RUBY="${VALIDATE_RUBY,,}" - VALIDATE_STATES="${VALIDATE_STATES,,}" - VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM,,}" - VALIDATE_TSX="${VALIDATE_TSX,,}" - VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES,,}" - VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD,,}" - VALIDATE_YAML="${VALIDATE_YAML,,}" - VALIDATE_XML="${VALIDATE_XML,,}" + # Loop through all languages + for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do + # build the variable + VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + # Set the value of the var to lowercase + eval "${VALIDATE_LANGUAGE}=${!VALIDATE_LANGUAGE,,}" + done ################################################ # Determine if any linters were explicitly set # @@ -90,7 +63,7 @@ function GetValidationInfo() { # build the variable VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" # Check to see if the variable was set - if [ -n ${!VALIDATE_LANGUAGE} ]; then + if [ -n "${!VALIDATE_LANGUAGE}" ]; then # It was set, need to set flag ANY_SET="true" fi @@ -107,7 +80,7 @@ function GetValidationInfo() { # Check if ANY_SET was set if [[ ${ANY_SET} == "true" ]]; then # Check to see if the variable was set - if [ -z ${!VALIDATE_LANGUAGE} ]; then + if [ -z "${!VALIDATE_LANGUAGE}" ]; then # Flag was not set, default to false eval "${VALIDATE_LANGUAGE}='false'" fi