@@ -64,8 +64,7 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
64
64
65
65
METHODS execute_check.
66
66
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.
69
68
70
69
"! <p class="shorttext synchronized" lang="en">Validates the Customizing</p>
71
70
"! @parameter statement | Received from inspect_tokens method.
@@ -120,14 +119,11 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
120
119
METHODS keyword REDEFINITION .
121
120
METHODS set_check_message IMPORTING message TYPE itex132.
122
121
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 .
125
122
126
123
PRIVATE SECTION .
127
124
METHODS do_attributes_exist RETURNING VALUE (result ) TYPE abap_bool .
128
125
129
126
METHODS instantiate_objects.
130
- METHODS enable_rfc.
131
127
132
128
METHODS is_skipped IMPORTING config TYPE y_if_clean_code_manager=>check_configuration
133
129
error_count TYPE int4
@@ -144,7 +140,7 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
144
140
METHODS should_skip_test_code IMPORTING structure TYPE sstruc
145
141
RETURNING VALUE (result ) TYPE abap_bool .
146
142
147
- METHODS should_skip_type IMPORTING structure TYPE sstruc
143
+ METHODS should_skip_type IMPORTING structure TYPE sstruc
148
144
RETURNING VALUE (result ) TYPE abap_bool .
149
145
150
146
METHODS is_statement_type_relevant IMPORTING structure TYPE sstruc
@@ -153,10 +149,8 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
153
149
METHODS is_structure_type_relevant IMPORTING structure TYPE sstruc
154
150
RETURNING VALUE (result ) TYPE abap_bool .
155
151
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 .
160
154
161
155
ENDCLASS .
162
156
@@ -169,16 +163,11 @@ CLASS y_check_base IMPLEMENTATION.
169
163
IF ref_scan_manager->is_scan_ok( ) = abap_false .
170
164
RAISE EXCEPTION TYPE ycx_object_not_processed.
171
165
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 .
176
166
ENDMETHOD .
177
167
178
168
179
169
METHOD constructor .
180
170
super ->constructor( ).
181
- enable_rfc( ).
182
171
183
172
description = get_class_description( ).
184
173
category = 'Y_CATEGORY_CODE_PAL' .
@@ -210,9 +199,18 @@ CLASS y_check_base IMPLEMENTATION.
210
199
211
200
212
201
METHOD detect_check_configuration .
202
+ DATA tadir_keys TYPE tadir.
213
203
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 ).
216
214
217
215
LOOP AT check_configurations ASSIGNING FIELD-SYMBOL (<configuration> )
218
216
WHERE object_creation_date <= creation_date.
@@ -249,8 +247,8 @@ CLASS y_check_base IMPLEMENTATION.
249
247
250
248
METHOD inspect_structures .
251
249
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 .
254
252
CONTINUE .
255
253
ENDIF .
256
254
@@ -265,10 +263,6 @@ CLASS y_check_base IMPLEMENTATION.
265
263
LOOP AT ref_scan_manager->statements ASSIGNING FIELD-SYMBOL (<statement> )
266
264
FROM structure-stmnt_from
267
265
TO structure-stmnt_to.
268
- IF is_in_scope( <statement> ) = abap_false .
269
- CONTINUE .
270
- ENDIF .
271
-
272
266
inspect_tokens( index = index
273
267
structure = structure
274
268
statement = <statement> ).
@@ -586,7 +580,7 @@ CLASS y_check_base IMPLEMENTATION.
586
580
ENDIF .
587
581
588
582
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( ).
590
584
ENDIF .
591
585
592
586
IF test_code_detector IS NOT BOUND .
@@ -636,13 +630,22 @@ CLASS y_check_base IMPLEMENTATION.
636
630
637
631
638
632
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
+
639
641
statistics->collect( kind = error_priority
640
642
pc = NEW y_pseudo_comment_detector( )->is_pseudo_comment( ref_scan_manager = ref_scan_manager
641
643
scimessages = scimessages
642
644
test = myname
643
645
code = get_code( error_priority )
644
646
suppress = settings-pseudo_comment
645
647
position = statement_index ) ).
648
+
646
649
IF cl_abap_typedescr=>describe_by_object_ref( ref_scan_manager )->get_relative_name( ) EQ 'Y_REF_SCAN_MANAGER' .
647
650
inform( p_sub_obj_type = object_type
648
651
p_sub_obj_name = get_include( p_level = statement_level )
@@ -664,7 +667,6 @@ CLASS y_check_base IMPLEMENTATION.
664
667
p_comments = pseudo_comments ).
665
668
ENDIF .
666
669
667
-
668
670
ENDMETHOD .
669
671
670
672
@@ -692,8 +694,7 @@ CLASS y_check_base IMPLEMENTATION.
692
694
ELSEIF attributes_ok = abap_true .
693
695
profile_configurations = check_configurations.
694
696
ENDIF .
695
- CATCH ycx_object_not_processed
696
- ycx_object_is_exempted.
697
+ CATCH ycx_object_not_processed.
697
698
FREE ref_scan_manager.
698
699
RETURN .
699
700
@@ -709,19 +710,6 @@ CLASS y_check_base IMPLEMENTATION.
709
710
ENDMETHOD .
710
711
711
712
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
-
725
713
METHOD set_check_message .
726
714
y_message_registration=>add_message(
727
715
EXPORTING
@@ -790,30 +778,14 @@ CLASS y_check_base IMPLEMENTATION.
790
778
ENDMETHOD .
791
779
792
780
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 .
801
782
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 .
817
789
ENDTRY .
818
790
ENDMETHOD .
819
791
0 commit comments