Skip to content

Commit bcf146a

Browse files
authored
Fixed a bug with line matching in xml transformer (#737)
1 parent 3115185 commit bcf146a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/codemodder/codemods/xml_transformer.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ def match_result(self, line, column) -> bool:
8383
return True
8484
for result in self.results or []:
8585
for location in result.locations:
86-
if self.line_only_matching:
87-
return location.start.line == line
88-
else:
89-
# No two elements can have the same start but different ends.
90-
# It suffices to only match the start.
91-
return (
92-
location.start.line == line
93-
and location.start.column - 1 == column
94-
)
86+
# No two elements can have the same start but different ends.
87+
# It suffices to only match the start.
88+
if (self.line_only_matching and location.start.line == line) or (
89+
location.start.line == line and location.start.column - 1 == column
90+
):
91+
return True
9592
return False
9693

9794
def add_change(self, line):

0 commit comments

Comments
 (0)