From 1e78b4c438bf600ace6e9d642812e25842056830 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 27 Jun 2024 06:06:37 -0700 Subject: [PATCH] Validate ignore checks before returning result (#3429) --- src/cfnlint/rules/_rules.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cfnlint/rules/_rules.py b/src/cfnlint/rules/_rules.py index 07366757b5..d35a2ba179 100644 --- a/src/cfnlint/rules/_rules.py +++ b/src/cfnlint/rules/_rules.py @@ -303,7 +303,10 @@ def is_rule_enabled(self, rule: CloudFormationLintRule): def run_check(self, check, filename, rule_id, *args): """Run a check""" try: - matches = list(check(*args)) + matches = [] + for match in check(*args): + if self.is_rule_enabled(match.rule): + matches.append(match) return matches except Exception as err: # pylint: disable=W0703 if self.is_rule_enabled(RuleError()):