Skip to content

Commit fd5b82d

Browse files
lucasborinEugen Günther
andauthored
1.12.0 (#306)
* Update README.md * disabling rfc * Update changelog.txt * Update changelog.txt * 1.12.0 * Profile Tool - UX Refinement (#313) Minor UX Changes * Update changelog.txt * Update changelog.txt * Performance (#317) * buffer size * fixing dump when object is not supported by sci * solving dump when ref scan is not set * Update y_ref_scan_manager.clas.abap * Update changelog.txt * removing shared memory (#319) * Update changelog.txt * Performance Improvements (#318) * moving application component valid. to ref_scan * wip * changing validation sequence * fixing minor bug * fixing bug * refactoring former buffer * syntax error * fixing ut * fixing unit test base * abaplint hint * Update changelog.txt * Code review (#322) * removing unused exception * solving empty catch * moving buffer cleanup * pretty printer Co-authored-by: Eugen Günther <[email protected]>
1 parent e534141 commit fd5b82d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+463
-875
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The Profile Management Tool, which is an alternative of working with SCI based v
3838
- Multiple execution of several profiles at the same time (the sharpest/strongest and time valid configuration/threshold will be taken);
3939
- Delegation principle to facilitate team work (all delegates, for instance: team members, can work with the same profile);
4040

41+
:warning: The checks are not RFC-Enabled due to local dependencies.
42+
4143
## List of Checks
4244

4345
- [Check Documentation](docs/check_documentation.md)

changelog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ Upgrade Note
1212
------------------
1313
Whenever you upgrade code pal for ABAP, it is highly recommended to execute the Y_CI_CHECK_REGISTRATION report to activate/reactivate the Checks (SE38 transaction) and regenerate the respective code inspector variant (SCI transaction)
1414

15+
2021-01-XX v1.12.0
16+
------------------
17+
+ Performance Improvements (#318)
18+
- Shared Memory (#319)
19+
* Performance Issues (#317)
20+
* Profile Tool - UX Refinement (#313)
21+
- RFC Disabled (#305)
22+
1523
2021-01-22 v1.11.1
1624
------------------
1725
* Dump in DB access in UT (#309)

src/checks/y_check_db_access_in_ut.clas.abap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ CLASS y_check_db_access_in_ut IMPLEMENTATION.
121121

122122
LOOP AT ref_scan_manager->statements ASSIGNING FIELD-SYMBOL(<statement>)
123123
FROM class_definition-stmnt_from TO class_definition-stmnt_to.
124-
125-
IF is_in_scope( <statement> ) = abap_false.
126-
CONTINUE.
127-
ENDIF.
128-
129124
DATA(tokens) = consolidade_tokens( <statement> ).
130125

131126
test_risk_level = COND #( WHEN tokens CS 'RISK LEVEL HARMLESS' THEN risk_level_harmless

src/checks/y_check_function.clas.testclasses.abap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ CLASS ltd_ref_scan_manager IMPLEMENTATION.
6767
ENDMETHOD.
6868
ENDCLASS.
6969

70-
CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING INHERITING FROM y_exemption_handler.
70+
CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING.
7171
PUBLIC SECTION.
72-
METHODS y_if_exemption~is_object_exempted REDEFINITION.
72+
INTERFACES y_if_exemption.
7373
ENDCLASS.
7474

7575
CLASS ltd_clean_code_exemption_no IMPLEMENTATION.

src/foundation/y_check_base.clas.abap

Lines changed: 35 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -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 sstruc
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

161155
ENDCLASS.
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

src/foundation/y_check_base.clas.locals_imp.abap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ CLASS ltd_check_base IMPLEMENTATION.
3535
METHOD constructor.
3636
super->constructor( ).
3737
ref_scan_manager = NEW ltd_ref_scan_manager( ).
38+
ref_scan_manager->set_ref_scan( VALUE #( ) ).
39+
clean_code_manager = NEW y_clean_code_manager_double( me ).
3840
ENDMETHOD.
3941

4042

src/foundation/y_clean_code_manager.clas.abap

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ CLASS y_clean_code_manager DEFINITION PUBLIC CREATE PUBLIC.
33
INTERFACES y_if_clean_code_manager.
44
ALIASES calculate_obj_creation_date FOR y_if_clean_code_manager~calculate_obj_creation_date.
55
ALIASES read_check_customizing FOR y_if_clean_code_manager~read_check_customizing.
6-
PROTECTED SECTION.
6+
77
PRIVATE SECTION.
8-
DATA object_creation_date TYPE REF TO y_if_object_creation_date.
98
METHODS determine_profiles RETURNING VALUE(result) TYPE string_table
109
RAISING ycx_no_check_customizing.
10+
1111
METHODS determine_checks IMPORTING profile TYPE ycicc_profile
1212
checkid TYPE seoclsname
1313
RETURNING VALUE(result) TYPE y_if_clean_code_manager=>check_configurations
@@ -76,20 +76,8 @@ CLASS y_clean_code_manager IMPLEMENTATION.
7676

7777

7878
METHOD calculate_obj_creation_date.
79-
IF object_creation_date IS NOT BOUND.
80-
object_creation_date = NEW y_object_creation_date( ).
81-
ENDIF.
82-
CASE object_type.
83-
WHEN 'INTF'.
84-
result = object_creation_date->get_interface_create_date( object_name ).
85-
WHEN 'CLAS'.
86-
result = object_creation_date->get_class_create_date( object_name ).
87-
WHEN 'FUGR'.
88-
result = object_creation_date->get_function_group_create_date( object_name ).
89-
WHEN 'PROG'.
90-
result = object_creation_date->get_program_create_date( object_name ).
91-
WHEN OTHERS.
92-
ENDCASE.
79+
result = y_object_creation_date=>get_created_on( object_type = object_type
80+
object_name = object_name ).
9381
ENDMETHOD.
9482

9583

0 commit comments

Comments
 (0)