abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

Feature Request: remove empty line-break(s) between ENDxxxxs.

Open openPhiL opened this issue 1 year ago • 3 comments

Hi. I have this idea that in general, I prefer something like this

if sy-tabix = 1.
  if sy-uname = 'Ich'.
    loop at itab into data(wa).
    ...
    endloop.
  endif.
endif. 

over something like this

if sy-tabix = 1.
  if sy-uname = 'Ich'.
    loop at itab into data(wa).
    ...
    endloop.

  endif.


endif. 

We already have the option to reduce multiple empty lines to <given number>, but in those specific cases, I mean between all those ends, I would remove "all" empty lines.

I am suggesting those ends:

endif. endloop. enddo. endtry.

openPhiL avatar Aug 03 '23 14:08 openPhiL

Hi openPhiL,

that sounds interesting – however, sometimes I have seen empty lines here for the sake of readability:

  IF iv_find_pairs = abap_true.
    LOOP AT mts_any INTO DATA(ls_any).

      LOOP AT mts_any INTO DATA(ls_other).
        IF ls_any-component = ls_other-component.
          add_pair( is_first  = ls_any
                    is_second = ls_other ).
        ENDIF.
      ENDLOOP.

    ENDLOOP.
  ENDIF.

So how could we be sure to not destroy intended structuring here? Maybe keep cases where an empty line is found after the opening command, too?

Kind regards, Jörg-Michael

jmgrassau avatar Aug 15 '23 13:08 jmgrassau

I'd support the suggestion by @openPhiL. If someone would like to keep intended structuring, they could disable this rule.

jelliottp avatar Aug 15 '23 15:08 jelliottp

Maybe keep cases where an empty line is found after the opening command, too?

That seems like a good idea to me. 😊

ConjuringCoffee avatar Aug 16 '23 07:08 ConjuringCoffee