From bc2057b67cdf625f2e887170eb2045673881724f Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 27 Jun 2024 05:51:59 -0700 Subject: [PATCH] Validate ignore checks before returning result --- 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()):