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.
-
-
-
bot/reviewbot/processing/review.py (Diff revision 1) We generally avoid Python's ternary form because it's confusing and ugly.
-
Change Summary:
Incorporated formatting and style changes.
Commit: |
|
||||
---|---|---|---|---|---|
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: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 3 (+23 -17) |
Checks run (2 succeeded)
-
-
bot/reviewbot/processing/review.py (Diff revision 3) Should the documentation for the line_num parameter also be changed to be re: checking and not comments?
Change Summary:
Updated comment in _is_modified
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+24 -17) |
Checks run (2 succeeded)
Change Summary:
Changed
None
Comment
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+24 -17) |