Skip to content

Resolve "are-scripts-in-sync.py matches wrong lines if the lines are similar enough"

Closes #2326 (closed).

This solution truncates the create script to the upgrade script's length to remove any chance of wrong matching. This happens when the latest upgrade script is being diffed. For all other upgrade scripts, the usual diff is shown along with a warning that it might contain false errors, although the chance is slim.

Also solved some lints that I missed the first time I created the script:

are-scripts-in-sync.py:88:39: W1401: Anomalous backslash in string: '\$'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
are-scripts-in-sync.py:96:4: W0621: Redefining name 'diff' from outer scope (line 66) (redefined-outer-name)
are-scripts-in-sync.py:77:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
are-scripts-in-sync.py:80:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
are-scripts-in-sync.py:104:4: C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
are-scripts-in-sync.py:115:4: C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
are-scripts-in-sync.py:116:11: R1716: Simplify chained comparison between the operands (chained-comparison)
are-scripts-in-sync.py:155:8: R1722: Consider using sys.exit() (consider-using-sys-exit)
are-scripts-in-sync.py:150:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
are-scripts-in-sync.py:189:8: R1722: Consider using sys.exit() (consider-using-sys-exit)
are-scripts-in-sync.py:202:12: R1722: Consider using sys.exit() (consider-using-sys-exit)
are-scripts-in-sync.py:206:50: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
Edited by Andrei Pavel

Merge request reports