Skip to content

Commit

Permalink
fixes #502
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Borin committed Oct 27, 2021
1 parent 7985332 commit 6790133
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/checks/y_check_prefer_new_to_crt_obj.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ CLASS y_check_prefer_new_to_crt_obj IMPLEMENTATION.
AND get_token_abs( statement-from + 1 ) = 'OBJECT'.

CHECK get_token_abs( statement-to - 1 ) <> 'FOR'
AND get_token_abs( statement-to ) <> 'TESTING'
AND get_token_abs( statement-to ) NA '()'.
AND get_token_abs( statement-to ) <> 'TESTING'.

CHECK next1( 'TYPE' ) NA '()'.

DATA(check_configuration) = detect_check_configuration( statement ).

Expand Down
23 changes: 23 additions & 0 deletions src/checks/y_check_prefer_new_to_crt_obj.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ CLASS ltc_create_object IMPLEMENTATION.
ENDCLASS.



CLASS ltc_dynamic_object_with_param DEFINITION INHERITING FROM ltc_create_object FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_code_without_issue REDEFINITION.
ENDCLASS.

CLASS ltc_dynamic_object_with_param IMPLEMENTATION.

METHOD get_code_without_issue.
result = VALUE #(
( ' REPORT ut_test.' )
( ' START-OF-SELECTION.' )
( | DATA check TYPE REF TO y_check_base. | )
( | DATA params TYPE abap_parmbind_tab. | )
( | DATA(prefer_new) = 'y_check_prefer_new_to_crt_obj'. | )
( | CREATE OBJECT check TYPE (prefer_new) PARAMETER-TABLE params. | )
).
ENDMETHOD.

ENDCLASS.



CLASS ltc_dynamic_object DEFINITION INHERITING FROM ltc_create_object FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_code_without_issue REDEFINITION.
Expand Down

0 comments on commit 6790133

Please sign in to comment.