Skip to content

Latest commit

 

History

History
79 lines (46 loc) · 2.35 KB

EmptyLinesWithinMethodsRule.md

File metadata and controls

79 lines (46 loc) · 2.35 KB

<-- previous rule | overview | next rule -->

Standardize empty lines within methods

Restricts the number of consecutive empty lines within methods, and adds an empty line between declarations and the first executable statement (or the comments preceding it).

For function modules, additional empty lines are kept at the beginning to align with ADT and SE37 behavior.

This rule is part of the essential profile, as it is explicitly demanded by the Clean ABAP Styleguide.

References

Options

  • Max. empty lines at method start: [0]
  • Max. empty lines within methods: [1]
  • Max. empty lines at method end: [0]
  • Insert empty line between declarations and first executable statement

Examples

  METHOD empty_lines_within_methods.

    DATA lv_any_integer TYPE i.
    DATA lv_any_string  TYPE string.
    do_something( ).


    do_something_else( ).


    finish_doing_something( ).

  ENDMETHOD.


  METHOD empty_lines.
    FIELD-SYMBOLS <ls_data> TYPE any_type.
    " comment above executable statement
    DATA(lo_utility) = cl_factory=>get( )->get_utility( ).

  ENDMETHOD.

Resulting code:

  METHOD empty_lines_within_methods.
    DATA lv_any_integer TYPE i.
    DATA lv_any_string  TYPE string.

    do_something( ).

    do_something_else( ).

    finish_doing_something( ).
  ENDMETHOD.


  METHOD empty_lines.
    FIELD-SYMBOLS <ls_data> TYPE any_type.

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

Related code