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

Allow fix values for empty lines at method start and end

Open bnichell opened this issue 1 year ago • 3 comments

Currently the rule Standardize empty lines within methods allows to set max values for empty lines at method start and end. Thus, it is not possible to enforce consistency without setting the value of both options to 0. To allow consistency for values different from 0 I propose to allow setting the given values as fix values, meaning if empty lines at method start and end is set to 1, a line is being added, if none existed.

Example

Option: Max empty lines at method start: 1 Max empty lines at method end: 1

original code

  METHOD empty_lines.


    FIELD-SYMBOLS <ls_data> TYPE any_type.

    " comment above executable statement
    DATA(lo_utility) = cl_factory=>get( )->get_utility( ).
  ENDMETHOD.

formatted with max values

  METHOD empty_lines.
-

    FIELD-SYMBOLS <ls_data> TYPE any_type.

    " comment above executable statement
    DATA(lo_utility) = cl_factory=>get( )->get_utility( ).
  ENDMETHOD.

formatted with fixed values

  METHOD empty_lines.
-

    FIELD-SYMBOLS <ls_data> TYPE any_type.

    " comment above executable statement
    DATA(lo_utility) = cl_factory=>get( )->get_utility( ).
+
  ENDMETHOD.

bnichell avatar Jan 26 '24 13:01 bnichell

Hi Benedikt,

yes, that makes sense – just not sure yet about the wording: add settings for "Min empty lines at method start/end" (making sure they don't contradict)?

Kind regards, Jörg-Michael

jmgrassau avatar Feb 09 '24 11:02 jmgrassau

add settings for "Min empty lines at method start/end" (making sure they don't contradict)?

I would not need a range at all, meaning my team always sets min equal to the max value to force consistency. But, if you want to allow a range, your proposal makes sense.

bnichell avatar Feb 10 '24 12:02 bnichell