Repository navigation
fix(W1040): report resolved Fn::ToJsonString errors under W1040 - #4969
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
ToJsonString overwrote every error's rule with E1031, including the resolved-value errors the base class assigns to W1040, so W1040 never appeared and the findings were reported at error level. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
Contributor
Author
|
Friendly ping in case this slipped through — happy to adjust anything (scope, tests, style) if that makes review easier. Thanks for maintaining this! |
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.
Fixes #4961
Root cause
ToJsonString.fn_tojsonstringseterr.rule = selfon every error yielded byBaseFn.validate. That also overwrote the errors thatBaseFn._clean_resolve_errorshad already assigned to theW1040child rule, so resolved-value findings were reported asE1031(error) with the W1040 message text,--include-checks W1040had no effect, and--ignore-checks W1040did not suppress them.Fix
Only assign
selfas the rule when the error is not already attached to the resolved-value child rule (W1040).Test
Added
test_resolved_errors_use_w1040: a template withVisibilityTimeout: {Fn::ToJsonString: [1, 2]}now yields a singleW1040instead ofE1031. It fails on main and passes with the change; the rest oftest/unit/rules/functionsandtest_rules_collections.pypass.This PR was prepared with the assistance of an AI coding agent (Claude).