Unverified Commit 1f7e40d0 authored by Rak Alexey's avatar Rak Alexey Committed by GitHub
Browse files

Improve check copies (#19829)

* print first diff line intead of first code part line

* fix style
parent 8b2501b4
...@@ -228,7 +228,12 @@ def is_copy_consistent(filename, overwrite=False): ...@@ -228,7 +228,12 @@ def is_copy_consistent(filename, overwrite=False):
# Test for a diff and act accordingly. # Test for a diff and act accordingly.
if observed_code != theoretical_code: if observed_code != theoretical_code:
diffs.append([object_name, start_index]) diff_index = start_index + 1
for observed_line, theoretical_line in zip(observed_code.split("\n"), theoretical_code.split("\n")):
if observed_line != theoretical_line:
break
diff_index += 1
diffs.append([object_name, diff_index])
if overwrite: if overwrite:
lines = lines[:start_index] + [theoretical_code] + lines[line_index:] lines = lines[:start_index] + [theoretical_code] + lines[line_index:]
line_index = start_index + 1 line_index = start_index + 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment