From 67e6bc209439aba84a78fc1d00bb21418ff41822 Mon Sep 17 00:00:00 2001 From: Ben Bridts Date: Thu, 18 Apr 2024 18:37:08 +0200 Subject: [PATCH] Only include json files as registry schemas (#3150) * Only include json files as registry schemas --------- Co-authored-by: Kevin DeJong --- src/cfnlint/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cfnlint/core.py b/src/cfnlint/core.py index 1f65fb1720..2499e49601 100644 --- a/src/cfnlint/core.py +++ b/src/cfnlint/core.py @@ -73,7 +73,12 @@ def run_cli( for path in registry_schemas: if path and os.path.isdir(os.path.expanduser(path)): for f in os.listdir(path): - with open(os.path.join(path, f), encoding="utf-8") as schema: + if not f.endswith(".json"): + continue + filename = os.path.join(path, f) + if not os.path.isfile(filename): + continue + with open(filename, encoding="utf-8") as schema: REGISTRY_SCHEMAS.append(json.load(schema)) return run_checks(filename, template, rules, regions, mandatory_rules)