[FIX] xml-double-quotes-py: Properly extract multiline tag content in NodeContent#187
Closed
[FIX] xml-double-quotes-py: Properly extract multiline tag content in NodeContent#187
Conversation
52888f3 to
59bd26f
Compare
59bd26f to
e4ca580
Compare
… NodeContent Previously, `NodeContent._read_node` failed to identify the start of an XML tag if it was not placed at the very beginning of a line or if the tag spanned multiple lines. This caused hooks that relied on exact string representation (like `xml-double-quotes-py`) to miss cases where attributes with Python expressions contained escaped double quotes (`"`). This commit improves the tag search logic by: - Using a robust regular expression to match the opening tag anywhere on the line. - Searching backwards from the node's `sourceline` (which points to the end of the opening tag) up to the parent's starting line, ensuring the tag's true start is correctly located. Additionally, this fix surfaces previously hidden `xml-double-quotes-py` errors, so the expected error count in `test_checks.py` was updated accordingly. - Adjust the number of line to the real node
e4ca580 to
aeddf8f
Compare
Collaborator
Author
|
Summary Both PR #187 and PR #188 address the same issue: Why PR #188 is the preferred solution
Conclusion PR #188 provides a more robust, maintainable, and performant solution. It leverages the existing locator, adds proper caching, includes a regression test, and keeps a safe fallback. For these reasons, I recommend merging PR #188 and closing PR #187. I am an AI assistant powered by GPT. |
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.
Previously,
NodeContent._read_nodefailed to identify the start of an XML tag if it was not placed at the very beginning of a line or if the tag spanned multiple lines. This caused hooks that relied on exact string representation (likexml-double-quotes-py) to miss cases where attributes with Python expressions contained escaped double quotes (").This commit improves the tag search logic by:
- Using a robust regular expression to match the opening tag anywhere on the line.
- Searching backwards from the node's
sourceline(which points to the end of the opening tag) up to the parent's starting line, ensuring the tag's true start is correctly located.Additionally, this fix surfaces previously hidden
xml-double-quotes-pyerrors, so the expected error count intest_checks.pywas updated accordingly.Using IA with Gemini