Repository navigation
fix: let api.lint() run a Rules collection passed by the caller - #4909
Merged
kddejong merged 1 commit intoOct 30, 2026
Merged
Conversation
lint() documents a rules parameter but only honoured the pre-1.0 RulesCollection class. A Rules collection fell through to a fresh Runner, which loaded every built-in rule and never ran the rules it was handed. Signed-off-by: Brenden Hogan <hoganbr@amazon.com>
kddejong
force-pushed
the
fix/api-lint-rules-collection
branch
from
October 30, 2026 20:30
da32335 to
eb07a95
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4909 +/- ##
=======================================
Coverage 94.71% 94.71%
=======================================
Files 442 442
Lines 16087 16087
Branches 3120 3120
=======================================
Hits 15237 15237
Misses 468 468
Partials 382 382
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 #4949
Description of changes:
cfnlint.api.lint()documents arulesparameter and routes it torun_template_by_data, but theisinstancecheck only accepts the pre-1.0RulesCollection. Passing the 1.xRulesclass falls through to a freshRunner, which loads every built-in rule and never runs the collection it was handed. Measured: a one-ruleRulespassed tolint()ran all built-ins (0.35 s,W8001) and produced none of the caller's findings.The fix accepts
Rules | RulesCollectionand updates the docstring. Not changed here: on the legacyRulesCollectionpath,run_template_by_datacallsrules.is_rule_enabled(TransformError(), config)with two arguments whileRulesCollection.is_rule_enabledtakes one, so a transform error on that path raisesTypeError; that predates this change and can be tracked separately. Two tests: a one-rule collection produces exactly that rule's finding, andignore_checksinconfigstill applies to it.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.