Closed naren2605 closed 2 weeks ago
I am sorry, but it seems this patch contains way too many "drive-by" changes to allow a reasonable review. I probably could accept having constants instead of hardcoded number, but changing lastWSOffset
to lastWhiteSpaceOffset
does not seem very useful to me. I would suggest to cleanup the patch, removing as many of drive-by changes (changes that are not necessary for the functionality of the patch).
@lahodaj its two commits, the first refactors, the second fixes the issue. We do allow the two commit approach, otherwise nobody would ever refactor anything ;)
But I agree that the renaming could be probably reduced a bit.
I am sorry, but it seems this patch contains way too many "drive-by" changes to allow a reasonable review. I probably could accept having constants instead of hardcoded number, but changing
lastWSOffset
tolastWhiteSpaceOffset
does not seem very useful to me. I would suggest to cleanup the patch, removing as many of drive-by changes (changes that are not necessary for the functionality of the patch).
hi @lahodaj , @mbien thanks for taking a look into pr , i have added minor refactoring changes to improve readability of code in the same method where fix related changes exist(while i was debugging the issue), just following this clean code principle. as @mbien mentioned i have added refactoring changes in one commit(where tests are passing before adding fix) and fix as head commit(with new tests). i would like to summarise refactoring changes as below. take a look and let me know which and all refactoring changes you see doesn't add value, will revert them accordingly.
ACTION_TYPE_ADD_BLANK_LINE
and STATE_INITIAL_TEXT
as constants to remove code smell - magic numbers (as you are ok with this and @mbien was suggesting to add enums, will enumize these)currNWSPos
, lastNWSPos
, currWSPos
, lastWSPos
, NWS and WS here was bit cryptic i have renamed these variables accordingly to improve readability(will revert these changes as you suggested these doesn't seem to be adding value)toAdd
to marker
, marker
noun suited better as we are adding marked position and action to LinkedList<Pair<Integer, Integer>> marks = new LinkedList<Pair<Integer, Integer>>()
, renamed variablecheckOffset
verb to markedOffset
noun as we are retrieving markedOffset from marks
listoffset
as final , as current method is ~700 lines long and multiple variables and states are mutating, just marked some variables like these to final
which are used as readonly values with the intent to improve readability.let me know @lahodaj if you don't see value add on point's 3,4 will go ahead and revert them.
@mbien / @lahodaj when are we targeting this pr to be merged?
three approvals, java tests ran and are green, commit header/email address looks valid, fix and refactoring is kept separate -> merging
@naren2605 thanks and congrats on your first NetBeans contribution ;)
thank you @mbien
fixes issue mentioned here #7640 :
fix: