thiagosantos0/IFFT

IFFT recomendation is triggered when a change is outsite the block (specific case)

Closed this issue · 1 comments

Found out this bug while writing some examples for the "tutorials" section of documentation. When I added a change outsite the IFFT block the expected behavior was that the IFFT does't recommend changes in any place.

Surprisingly, that was not the case... when I turned on debug mode I found out that the variable "modified_lines_within_block" was holding a couple of ' ' values, like [' ', ' ', ' '].

The problem was that the program was scanning the code inside IFFT block and comparing with "staged" and "unstaged" changes, when both matches the character/word is added inside the list. The problem with this approach is that, if, for example, the developer add a line with the word "teste" (outside IFFT block) and in the IFFT block we have another "teste" word (added before for another developer) the match will happen and the program will considere that the "teste" outside the block is actually a change inside the block, an incorrect behavior.

One easy fix that I thought (even thought understand the problem was a big headache) is not consider only the content of the file but also the exact line, doing so, the first "teste" would be considered different from the second one and the match wouldn't happen. I'll try this approach now.

Before the change:
image

After the change (Note the "Modified lines within the block lines"):
image

The main program still recomends a change in another file but it can be easily solved just checking for the data inside "modified_files_within_blocs" in the main program.