File modification checking multi-line support and cleanup
Review Request #10280 — Created Oct. 25, 2018 and submitted
Multiple TODOs have been addressed in _is_modified, so that tools
commenting on multiple lines have modifications properly checked. The
algorithm has been made more efficient, only checking relevant
(modified) chunks to see if they are in the range of modification.A patch was also made to tools that 'globally comment' (I.E. make a
comment with a line of <=0). Previously, all this would do is round the
line number up to 1, (as the front-end does not support rendering
first_line=None), which had the unintended side-effect of tools
configured to only comment on modified code who make global comments, to
only have their comment go through if line 1 was modified. The
first_line=1 workaround is still used, and the file is assumed to be
modified.
I've tested
_is_modified
through mynyc
plugin directly, and
testedFile.comment()
manually through a stub-plugin. Waiting on test
suite creation to mock up standalone tests.
- Change Summary:
-
Incorporated formatting and style changes.
- Commit:
-
53b8b990530d51ae8c0150efdbf91e3451d21fdd2efa09d38cb47ee4029e6846b6eff887e45d7ce5
- Diff:
-
Revision 2 (+32 -17)
Checks run (2 succeeded)
- Change Summary:
-
Accept negative line numbers also as global comments, assume files are modified if they're in the file diff.
- Description:
-
Multiple TODOs have been addressed in _is_modified, so that tools
commenting on multiple lines have modifications properly checked. The algorithm has been made more efficient, only checking relevant (modified) chunks to see if they are in the range of modification. A patch was also made to tools that 'globally comment' (I.E. make a
~ comment with a line of 0). Previously, all this would do is round the ~ comment with a line of <=0). Previously, all this would do is round the line number up to 1, (as the front-end does not support rendering first_line=None), which had the unintended side-effect of tools ~ configured to only comment on modified code who make global comments, ~ to only have their comment go through if line 1 was modified. The ~ first_line=1 workaround is still used, but the modification check now ~ checks the whole file for modifications. ~ configured to only comment on modified code who make global comments, to ~ only have their comment go through if line 1 was modified. The ~ first_line=1 workaround is still used, and the file is assumed to be ~ modified. - Commit:
-
2efa09d38cb47ee4029e6846b6eff887e45d7ce56034f4d54405337210314ade90f65fe901aba48d
- Diff:
-
Revision 3 (+23 -17)
Checks run (2 succeeded)
- Change Summary:
-
Updated comment in _is_modified
- Commit:
-
6034f4d54405337210314ade90f65fe901aba48db52336b094fb87d15bb76116489bfeae19697891
- Diff:
-
Revision 4 (+24 -17)
Checks run (2 succeeded)
- Change Summary:
-
Changed
None
Comment - Commit:
-
b52336b094fb87d15bb76116489bfeae19697891502f6f1fc32be05778c61535d7bbf5df38fe773c
- Diff:
-
Revision 5 (+24 -17)