@@ -64,8 +64,7 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
6464
6565    METHODS  execute_check.
6666
67-     METHODS  check_start_conditions RAISING  ycx_object_not_processed
68-                                            ycx_object_is_exempted.
67+     METHODS  check_start_conditions RAISING  ycx_object_not_processed.
6968
7069    "! <p class="shorttext synchronized" lang="en">Validates the Customizing</p> 
7170    "! @parameter statement | Received from inspect_tokens method. 
@@ -120,14 +119,11 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
120119    METHODS  keyword REDEFINITION .
121120    METHODS  set_check_message IMPORTING  message TYPE  itex132.
122121    METHODS  get_class_description  RETURNING  VALUE (result ) TYPE  string .
123-     METHODS  is_in_scope IMPORTING  statement      TYPE  sstmnt
124-                         RETURNING  VALUE (result ) TYPE  abap_bool .
125122
126123  PRIVATE SECTION .
127124    METHODS  do_attributes_exist  RETURNING  VALUE (result ) TYPE  abap_bool .
128125
129126    METHODS  instantiate_objects.
130-     METHODS  enable_rfc.
131127
132128    METHODS  is_skipped IMPORTING  config        TYPE  y_if_clean_code_manager=>check_configuration
133129                                 error_count   TYPE  int4 
@@ -144,7 +140,7 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
144140    METHODS  should_skip_test_code IMPORTING structure      TYPE  sstruc
145141                                  RETURNING  VALUE (result ) TYPE  abap_bool .
146142
147-     METHODS  should_skip_type IMPORTING structure TYPE  sstruc
143+     METHODS  should_skip_type IMPORTING structure        TYPE
148144                             RETURNING  VALUE (result ) TYPE  abap_bool .
149145
150146    METHODS  is_statement_type_relevant IMPORTING structure      TYPE  sstruc
@@ -153,10 +149,8 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
153149    METHODS  is_structure_type_relevant IMPORTING structure      TYPE  sstruc
154150                                       RETURNING  VALUE (result ) TYPE  abap_bool .
155151
156- 
157- 
158-     METHODS  get_application_component IMPORTING  level          TYPE  slevel
159-                                       RETURNING  VALUE (result ) TYPE  df14l-ps_posid.
152+     METHODS  is_app_comp_in_scope IMPORTING  level TYPE  stmnt_levl
153+                                  RETURNING  value (result ) TYPE  abap_bool .
160154
161155ENDCLASS .
162156
@@ -169,16 +163,11 @@ CLASS y_check_base IMPLEMENTATION.
169163    IF  ref_scan_manager->is_scan_ok( ) =  abap_false .
170164      RAISE  EXCEPTION TYPE  ycx_object_not_processed.
171165    ENDIF .
172- 
173-     IF  clean_code_exemption_handler->is_object_exempted( object_name =  object_name object_type =  object_type ) =  abap_true .
174-       RAISE  EXCEPTION TYPE  ycx_object_is_exempted.
175-     ENDIF .
176166  ENDMETHOD .
177167
178168
179169  METHOD  constructor .
180170    super ->constructor( ).
181-     enable_rfc( ).
182171
183172    description =  get_class_description(  ).
184173    category =  'Y_CATEGORY_CODE_PAL' .
@@ -210,9 +199,18 @@ CLASS y_check_base IMPLEMENTATION.
210199
211200
212201  METHOD  detect_check_configuration .
202+     DATA  tadir_keys TYPE  tadir.
213203
214-     DATA (include ) =  get_include( p_level =  statement-level ).
215-     DATA (creation_date ) =   NEW  y_object_creation_date( )->y_if_object_creation_date~get_program_create_date( include  ).
204+     DATA (level ) =  ref_scan_manager->levels[ statement-level ].
205+ 
206+     CALL  FUNCTION  'TR_TRANSFORM_TRDIR_TO_TADIR' 
207+       EXPORTING 
208+         iv_trdir_name =  level-name
209+       IMPORTING 
210+         es_tadir_keys =  tadir_keys.
211+ 
212+     DATA (creation_date ) =  clean_code_manager->calculate_obj_creation_date( object_type =  tadir_keys-object
213+                                                                            object_name =  tadir_keys-obj_name  ).
216214
217215    LOOP AT  check_configurations ASSIGNING  FIELD-SYMBOL (<configuration> )
218216    WHERE  object_creation_date <=  creation_date.
@@ -249,8 +247,8 @@ CLASS y_check_base IMPLEMENTATION.
249247
250248  METHOD  inspect_structures .
251249    LOOP AT  ref_scan_manager->structures ASSIGNING  FIELD-SYMBOL (<structure> ).
252-       IF  should_skip_test_code ( <structure>  ) =  abap_true 
253-       OR  should_skip_type ( <structure>  ) =  abap_true .
250+       IF  should_skip_type ( <structure>  ) =  abap_true 
251+       OR  should_skip_test_code ( <structure>  ) =  abap_true .
254252        CONTINUE .
255253      ENDIF .
256254
@@ -265,10 +263,6 @@ CLASS y_check_base IMPLEMENTATION.
265263    LOOP AT  ref_scan_manager->statements ASSIGNING  FIELD-SYMBOL (<statement> )
266264    FROM  structure-stmnt_from
267265    TO  structure-stmnt_to.
268-       IF  is_in_scope( <statement>  ) =  abap_false .
269-         CONTINUE .
270-       ENDIF .
271- 
272266      inspect_tokens( index  = index 
273267                      structure  = structure 
274268                      statement  =  <statement>  ).
@@ -586,7 +580,7 @@ CLASS y_check_base IMPLEMENTATION.
586580    ENDIF .
587581
588582    IF  clean_code_exemption_handler IS  NOT  BOUND .
589-       clean_code_exemption_handler =  y_exemption_handler=>create ( ).
583+       clean_code_exemption_handler =  new   y_exemption_handler( ).
590584    ENDIF .
591585
592586    IF  test_code_detector IS  NOT  BOUND .
@@ -636,13 +630,22 @@ CLASS y_check_base IMPLEMENTATION.
636630
637631
638632  METHOD  raise_error .
633+     IF  clean_code_exemption_handler->is_object_exempted( object_name =  object_name object_type =  object_type ) =  abap_true .
634+       RETURN .
635+     ENDIF .
636+ 
637+     IF  is_app_comp_in_scope( statement_level ) =  abap_false .
638+       RETURN .
639+     ENDIF .
640+ 
639641    statistics->collect( kind  =  error_priority
640642                         pc =  NEW  y_pseudo_comment_detector( )->is_pseudo_comment( ref_scan_manager =  ref_scan_manager
641643                                                                                   scimessages      =  scimessages
642644                                                                                   test              =  myname
643645                                                                                   code              =  get_code( error_priority )
644646                                                                                   suppress          =  settings-pseudo_comment
645647                                                                                   position          =  statement_index ) ).
648+ 
646649    IF  cl_abap_typedescr=>describe_by_object_ref( ref_scan_manager )->get_relative_name( ) EQ  'Y_REF_SCAN_MANAGER' .
647650      inform( p_sub_obj_type =  object_type
648651              p_sub_obj_name =  get_include( p_level =  statement_level )
@@ -664,7 +667,6 @@ CLASS y_check_base IMPLEMENTATION.
664667              p_comments =  pseudo_comments ).
665668    ENDIF .
666669
667- 
668670  ENDMETHOD .
669671
670672
@@ -692,8 +694,7 @@ CLASS y_check_base IMPLEMENTATION.
692694        ELSEIF  attributes_ok =  abap_true .
693695          profile_configurations =  check_configurations.
694696        ENDIF .
695-       CATCH  ycx_object_not_processed
696-             ycx_object_is_exempted.
697+       CATCH  ycx_object_not_processed.
697698        FREE  ref_scan_manager.
698699        RETURN .
699700
@@ -709,19 +710,6 @@ CLASS y_check_base IMPLEMENTATION.
709710  ENDMETHOD .
710711
711712
712-   METHOD  enable_rfc .
713-     ASSIGN  me ->('remote_rfc_enabled' ) TO  FIELD-SYMBOL (<remote_rfc_enabled> ).
714-     IF  sy -subrc  =  0 .
715-       <remote_rfc_enabled>  =  abap_true .
716-     ENDIF .
717-     ASSIGN  me ->('remote_enabled' ) TO  FIELD-SYMBOL (<remote_enabled> ).
718-     IF  sy -subrc  =  0 .
719-       <remote_enabled>  =  abap_true .
720-     ENDIF .
721-     UNASSIGN : <remote_rfc_enabled> , <remote_enabled> .
722-   ENDMETHOD .
723- 
724- 
725713  METHOD  set_check_message .
726714    y_message_registration=>add_message(
727715      EXPORTING 
@@ -790,30 +778,14 @@ CLASS y_check_base IMPLEMENTATION.
790778  ENDMETHOD .
791779
792780
793-   METHOD  is_in_scope .
794-     TRY .
795-         DATA (main_level ) =  ref_scan_manager->levels[ level  =  0  ].
796-         DATA (main_application_component ) =  get_application_component( main_level ).
797-       CATCH  cx_sy_itab_line_not_found.
798-         RETURN .
799-     ENDTRY .
800- 
781+   METHOD  is_app_comp_in_scope .
801782    TRY .
802-         DATA (current_level ) =  ref_scan_manager->levels[ statement-level ].
803-         DATA (current_application_component ) =  get_application_component( current_level ).
804-       CATCH  cx_sy_itab_line_not_found.
805-         RETURN .
806-     ENDTRY .
807- 
808-     result  =  xsdbool ( current_application_component =  main_application_component ).
809-   ENDMETHOD .
810- 
811- 
812-   METHOD  get_application_component .
813-     TRY .
814-         result  =  y_code_pal_app_comp=>get( level-name ).
815-       CATCH  ycx_entry_not_found.
816-         RETURN .
783+         DATA (main_app_comp ) =  y_code_pal_app_comp=>get( ref_scan_manager->levels[ level  =  0  ] ).
784+         DATA (curr_app_comp ) =  y_code_pal_app_comp=>get( ref_scan_manager->levels[ level  ] ).
785+         result  =  xsdbool ( main_app_comp =  curr_app_comp ).
786+       CATCH  cx_sy_itab_line_not_found
787+             ycx_entry_not_found.
788+         result  =  abap_false .
817789    ENDTRY .
818790  ENDMETHOD .
819791
0 commit comments