Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 2.84 KB

PseudoCommentRule.md

File metadata and controls

82 lines (54 loc) · 2.84 KB

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

Replace obsolete pseudo comments with pragmas

Replaces obsolete pseudo comments ("#EC ...) for the Extended Program Check (SLIN) with corresponding pragmas.

This rule requires a NetWeaver version >= 7.0 EhP2. Note that pseudo comments for Code Inspector ("#EC CI_...) are kept, as they have not been replaced by pragmas yet.

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

References

Options

  • (no options available for this rule)

Examples

  METHOD replace_pseudo_comments.
    CONSTANTS lc_key TYPE ty_key VALUE 'abc'. "#EC NOTEXT

    DATA: a TYPE string, "#ec NEEDED  " additional textual comment
          b TYPE string.

    a = b.

    " pseudo comments for Code Inspector (CI_...) are kept
    LOOP AT lt_data ASSIGNING <ls_data> WHERE id <= iv_id. "#EC CI_SORTSEQ
      MOVE-CORRESPONDING <ls_data>-source TO <ls_data>-dest. "#ec ENHOK
    ENDLOOP.

    DO 5 TIMES.
      "#EC NEEDED
    ENDDO.

    TRY.
      GET BADI lo_any_badi.
    CATCH cx_badi_not_implemented. "#EC NO_HANDLER nothing to do here
    ENDTRY.
  ENDMETHOD.

Resulting code:

  METHOD replace_pseudo_comments.
    CONSTANTS lc_key TYPE ty_key VALUE 'abc' ##NO_TEXT.

    DATA: a TYPE string ##NEEDED, " additional textual comment
          b TYPE string.

    a = b.

    " pseudo comments for Code Inspector (CI_...) are kept
    LOOP AT lt_data ASSIGNING <ls_data> WHERE id <= iv_id. "#EC CI_SORTSEQ
      MOVE-CORRESPONDING <ls_data>-source TO <ls_data>-dest ##ENH_OK.
    ENDLOOP.

    DO 5 TIMES ##NEEDED.
    ENDDO.

    TRY.
      GET BADI lo_any_badi.
    CATCH cx_badi_not_implemented ##NO_HANDLER. " nothing to do here
    ENDTRY.
  ENDMETHOD.

Related code