Repository navigation
Conversation
Rules.run_check emits an E0002 match for a rule that raises, but _filter_matches only passes ids that are in the collection, so a rule crash in a collection built without RuleError (api.lint(rules=...), append-rules users) disappeared. Add E0002 to the enabled set when it is enabled by the configuration, which is what run_check already checks. Signed-off-by: Brenden Hogan <hoganbr@amazon.com>
kddejong
force-pushed
the
fix/e0002-unregistered-rule-error
branch
from
October 30, 2026 20:27
a8fd20f to
2f21e05
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4908 +/- ##
=======================================
Coverage 94.71% 94.72%
=======================================
Files 442 442
Lines 16087 16089 +2
Branches 3120 3121 +1
=======================================
+ Hits 15237 15240 +3
Misses 468 468
+ Partials 382 381 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: fixes #4948
Description of changes:
Rules.run_checkturns an exception raised by a rule into anE0002match wheneverRuleErroris enabled by the configuration.Rules.runthen passes every match through_filter_matches, which only lets through ids that are in the collection's ownenabled_rule_ids. A collection built withoutRuleErrorregistered (api.lint(rules=...), or any--append-rulesuser who builds aRulesby hand) therefore drops theE0002and a crashing rule produces no output at all.The fix adds
E0002toenabled_rule_idswhenRuleErroris enabled, which is the same testrun_checkalready makes. The CLI is unaffected because it loadscfnlint.rules, which includesRuleError.Repro on
main:Tests:
test_rule_failure_without_rule_error_registered(red on the parent, green on the fix) andtest_rule_failure_respects_ignore_of_rule_error(an--ignore-checks E0002still suppresses it).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.