Merge pull request #470 from github/FixShyaml

fix shyaml
This commit is contained in:
Lukas Gravley 2020-07-23 11:02:02 -05:00 committed by GitHub
commit 131055ece7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 42 deletions

View file

@ -10,7 +10,6 @@ yamllint = "*"
pylint = "*" pylint = "*"
yq = "*" yq = "*"
cfn-lint = "*" cfn-lint = "*"
shyaml = "*"
[requires] [requires]
python_version = "3.8" python_version = "3.8"

36
dependencies/Pipfile.lock generated vendored
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "f8d7f08c1efbacea7c92868babd54bc040413f865e3cd7ea8d4bebab310b3da3" "sha256": "1ccc4fd5c20ba56f1cca85abdd09b24798c3ad68b921cb42c501177598d986c9"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -28,6 +28,7 @@
"sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703", "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703",
"sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386" "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"
], ],
"markers": "python_version >= '3.5'",
"version": "==2.4.2" "version": "==2.4.2"
}, },
"attrs": { "attrs": {
@ -35,6 +36,7 @@
"sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
"sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==19.3.0" "version": "==19.3.0"
}, },
"aws-sam-translator": { "aws-sam-translator": {
@ -47,16 +49,17 @@
}, },
"boto3": { "boto3": {
"hashes": [ "hashes": [
"sha256:07bd0872e9178b637baefb82aff8abb76197770c9fc60c4d6575564ba878e3e4" "sha256:4735fdf490094537ea0cb93ba4237db442195c37f974ea4ad44b9a5af98e6d7b",
"sha256:838cea329851e11b9a9dae1c00cd5ef2f3b29ac83c061733b2e93b64c333750f"
], ],
"version": "==1.14.22" "version": "==1.14.26"
}, },
"botocore": { "botocore": {
"hashes": [ "hashes": [
"sha256:4d084dfcfcdf21ac2df17d017607ca53d53ac6c2fa17484cdd87ef78daba06b8", "sha256:0c4ed6349e8ef6bfe9648757f3ff66c33a8f37d9cbadd9c17987138184990cbd",
"sha256:f491d3c29d7dda8c8907c520bc96d77a67a8953dfed7f55c250799849e213640" "sha256:28832be365204f00d5c7d2c2a0538d9d082dbfc39ed984fdc9556770470b7487"
], ],
"version": "==1.17.22" "version": "==1.17.26"
}, },
"cfn-lint": { "cfn-lint": {
"hashes": [ "hashes": [
@ -79,6 +82,7 @@
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827", "sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99" "sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
], ],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
"version": "==0.15.2" "version": "==0.15.2"
}, },
"isort": { "isort": {
@ -86,6 +90,7 @@
"sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1",
"sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd" "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==4.3.21" "version": "==4.3.21"
}, },
"jmespath": { "jmespath": {
@ -93,6 +98,7 @@
"sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9", "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9",
"sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f" "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f"
], ],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
"version": "==0.10.0" "version": "==0.10.0"
}, },
"jsonpatch": { "jsonpatch": {
@ -108,6 +114,7 @@
"sha256:c192ba86648e05fdae4f08a17ec25180a9aef5008d973407b581798a83975362", "sha256:c192ba86648e05fdae4f08a17ec25180a9aef5008d973407b581798a83975362",
"sha256:ff379fa021d1b81ab539f5ec467c7745beb1a5671463f9dcc2b2d458bd361c1e" "sha256:ff379fa021d1b81ab539f5ec467c7745beb1a5671463f9dcc2b2d458bd361c1e"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.0" "version": "==2.0"
}, },
"jsonschema": { "jsonschema": {
@ -147,6 +154,7 @@
"sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4",
"sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.4.3" "version": "==1.4.3"
}, },
"mccabe": { "mccabe": {
@ -190,6 +198,7 @@
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c", "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
"sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a" "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
"version": "==2.8.1" "version": "==2.8.1"
}, },
"pyyaml": { "pyyaml": {
@ -216,19 +225,12 @@
], ],
"version": "==0.3.3" "version": "==0.3.3"
}, },
"shyaml": {
"hashes": [
"sha256:3a57e380f66043c661d417106a0f101f8068c80caa2afef57c90447b88526c3d",
"sha256:ac9066eed5b8445de1f83a99106ca96a77900b6873de327fd50d3e3102084752"
],
"index": "pypi",
"version": "==0.6.1"
},
"six": { "six": {
"hashes": [ "hashes": [
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
], ],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
"version": "==1.15.0" "version": "==1.15.0"
}, },
"toml": { "toml": {
@ -240,11 +242,11 @@
}, },
"urllib3": { "urllib3": {
"hashes": [ "hashes": [
"sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a",
"sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"
], ],
"markers": "python_version != '3.4'", "markers": "python_version != '3.4'",
"version": "==1.25.9" "version": "==1.25.10"
}, },
"wrapt": { "wrapt": {
"hashes": [ "hashes": [

View file

@ -575,34 +575,15 @@ DetectCloudFormationFile() {
####################################### #######################################
# Check if file has AWS Template info # # Check if file has AWS Template info #
####################################### #######################################
if grep 'AWSTemplateFormatVersion' "${FILE}" > /dev/null; then if grep -q 'AWSTemplateFormatVersion' "${FILE}" > /dev/null; then
# Found it # Found it
return 0 return 0
fi fi
################################################### #####################################
# Check if file has AWSTemplateFormatVersion info # # See if it contains AWS References #
################################################### #####################################
if shyaml --quiet get-type AWSTemplateFormatVersion > /dev/null < "${FILE}"; then if grep -q -E '(AWS|Alexa|Custom)::' "${FILE}" > /dev/null; 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
# Found it # Found it
return 0 return 0
fi fi