apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.63k stars 841 forks source link

fix for #7640 (formating related issue in javadoc) #7641

Closed naren2605 closed 2 weeks ago

naren2605 commented 1 month ago

fixes issue mentioned here #7640 :

fix:

lahodaj commented 1 month 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).

mbien commented 1 month ago

@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.

naren2605 commented 1 month 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).

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.

  1. introduced variables like 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)
  2. variable like 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)
  3. renamed variable names from 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 list
  4. marked few variables like offset 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.

naren2605 commented 2 weeks ago

@mbien / @lahodaj when are we targeting this pr to be merged?

mbien commented 2 weeks ago

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 ;)

naren2605 commented 2 weeks ago

thank you @mbien