From 1102675a6d9da39739985968e51d9a9b2b810dc9 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 23 Jul 2020 10:18:54 -0500 Subject: [PATCH] adding the rest --- lib/linter.sh | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 46902f57..7c5fabc1 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -575,34 +575,15 @@ DetectCloudFormationFile() { ####################################### # Check if file has AWS Template info # ####################################### - if grep 'AWSTemplateFormatVersion' "${FILE}" > /dev/null; then + if grep -q 'AWSTemplateFormatVersion' "${FILE}" > /dev/null; then # Found it return 0 fi - ################################################### - # Check if file has AWSTemplateFormatVersion info # - ################################################### - if shyaml --quiet get-type AWSTemplateFormatVersion > /dev/null < "${FILE}"; then - # Found it - return 0 - fi - - ############################### - # check if file has resources # - ############################### - if jq -e 'has("Resources")' > /dev/null 2>&1 < "${FILE}"; then - # Check if AWS Alexa or custom - if jq ".Resources[].Type" 2> /dev/null | grep -q -E "(AWS|Alexa|Custom)" < "${FILE}"; then - # Found it - return 0 - fi - fi - - ################################ - # See if it contains resources # - ################################ - if shyaml values-0 Resources 2> /dev/null | grep -q -E "Type: (AWS|Alexa|Custom)" < "${FILE}"; then + ##################################### + # See if it contains AWS References # + ##################################### + if grep -q -E '(AWS|Alexa|Custom)::' "${FILE}" > /dev/null; then # Found it return 0 fi