[WIP] Potential whole-file fix for file modification when commenting

Review Request #10219 — Created Oct. 11, 2018 and discarded

Information

ReviewBot
master

Reviewers

NOTE: Very WIP, posted mostly for feedback / discussion. The current
change is not ideal, and will be different.

The Bug

According to the previous code "Some tools report general file errors as
being on line 0" It handles this special case by bumping up all
"first_line" arguments to 1. The _is_modified() method will then check
if any of the diff chunks report line 1 is modified. This will cause
users who have "comment on modified files" disabled to not get any
comments on files which do not have the first line modified. This
problem is caused in part by is_modified() only handling single lines
and ignoring its num_lines parameter.

The current patch adds a new is_any_modified() which is called instead
of any multiple-line checks in the comment() method when first_line
is 0, which simply checks if any hunk is not 'equal'.

Currently testing on my nyc plugin

Description From Last Updated

We should also accept None for this.

brenniebrennie

This should be None. num_lines shoould also be None.

brenniebrennie

F841 local variable 'line_num_index' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

alextechcc
brennie
  1. 
      
  2. bot/reviewbot/processing/review.py (Diff revision 1)
     
     
    Show all issues

    We should also accept None for this.

  3. bot/reviewbot/processing/review.py (Diff revision 1)
     
     
    Show all issues

    This should be None.
    num_lines shoould also be None.

  4. 
      
alextechcc
alextechcc
Review request changed
Status:
Discarded
Change Summary:

No longer about general comments, opening new review request