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()):