Skip to content

Revert "Part 1 - core feature - allow pseudo comment exception #329" #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions src/foundation/y_check_base.clas.abap
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
apply_on_test_code TYPE ycicc_testcode,
documentation TYPE c LENGTH 1000,
is_threshold_reversed TYPE abap_bool,
allow_pseudo_comments TYPE abap_bool,
END OF settings.

METHODS constructor.
@@ -105,7 +104,8 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
parameter_04 TYPE csequence OPTIONAL
is_include_specific TYPE sci_inclspec DEFAULT ' '
additional_information TYPE xstring OPTIONAL
checksum TYPE int4 OPTIONAL. "#EC OPTL_PARAM
checksum TYPE int4 OPTIONAL
pseudo_comments TYPE t_comments OPTIONAL. "#EC OPTL_PARAM

METHODS get_column_abs REDEFINITION.
METHODS get_column_rel REDEFINITION.
@@ -149,14 +149,14 @@ CLASS y_check_base DEFINITION PUBLIC ABSTRACT
METHODS is_structure_type_relevant IMPORTING structure TYPE sstruc
RETURNING VALUE(result) TYPE abap_bool.

METHODS is_app_comp_in_scope IMPORTING level TYPE stmnt_levl
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_app_comp_in_scope IMPORTING level TYPE stmnt_levl
RETURNING value(result) TYPE abap_bool.

ENDCLASS.



CLASS Y_CHECK_BASE IMPLEMENTATION.
CLASS y_check_base IMPLEMENTATION.


METHOD check_start_conditions.
@@ -181,7 +181,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
settings-apply_on_productive_code = abap_true.
settings-apply_on_test_code = abap_true.
settings-documentation = |{ c_docs_path-main }check_documentation.md|.
settings-allow_pseudo_comments = abap_true.

has_attributes = do_attributes_exist( ).

@@ -299,7 +298,7 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
check_configuration-object_creation_date = settings-object_created_on.
check_configuration-prio = settings-prio.
check_configuration-threshold = settings-threshold.
check_configuration-allow_pseudo_comments = settings-allow_pseudo_comments.

APPEND check_configuration TO check_configurations.
ENDIF.
EXPORT
@@ -308,7 +307,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
threshold = check_configuration-threshold
apply_on_productive_code = check_configuration-apply_on_productive_code
apply_on_testcode = check_configuration-apply_on_testcode
allow_pseudo_comments = check_configuration-allow_pseudo_comments
TO DATA BUFFER p_attributes.
ENDMETHOD.

@@ -514,7 +512,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
check_configuration-apply_on_productive_code = settings-apply_on_productive_code.
check_configuration-apply_on_testcode = settings-apply_on_test_code.
check_configuration-threshold = settings-threshold.
check_configuration-allow_pseudo_comments = settings-allow_pseudo_comments.
ENDIF.

INSERT VALUE #(
@@ -553,14 +550,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
) INTO TABLE sci_attributes.
ENDIF.

IF settings-pseudo_comment IS NOT INITIAL.
INSERT VALUE #(
kind = ''
ref = REF #( check_configuration-allow_pseudo_comments )
text = |Allow { settings-pseudo_comment }|
) INTO TABLE sci_attributes.
ENDIF.

title = description.

attributes_ok = abap_false.
@@ -608,7 +597,7 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
ENDIF.

IF clean_code_exemption_handler IS NOT BOUND.
clean_code_exemption_handler = NEW y_exemption_handler( ).
clean_code_exemption_handler = new y_exemption_handler( ).
ENDIF.

IF test_code_detector IS NOT BOUND.
@@ -649,7 +638,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
threshold = check_configuration-threshold
apply_on_productive_code = check_configuration-apply_on_productive_code
apply_on_testcode = check_configuration-apply_on_testcode
allow_pseudo_comments = check_configuration-allow_pseudo_comments
FROM DATA BUFFER p_attributes.
APPEND check_configuration TO check_configurations.
CATCH cx_root. "#EC NEED_CX_ROOT
@@ -659,15 +647,12 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.


METHOD raise_error.
DATA(pseudo_comment) = COND sci_pcom( WHEN settings-allow_pseudo_comments = abap_false THEN settings-pseudo_comment
ELSE space ).

statistics->collect( kind = error_priority
pc = NEW y_pseudo_comment_detector( )->is_pseudo_comment( ref_scan_manager = ref_scan_manager
scimessages = scimessages
test = myname
code = get_code( error_priority )
suppress = pseudo_comment
suppress = settings-pseudo_comment
position = statement_index ) ).

IF cl_abap_typedescr=>describe_by_object_ref( ref_scan_manager )->get_relative_name( ) EQ 'Y_REF_SCAN_MANAGER'.
@@ -680,15 +665,17 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
p_kind = error_priority
p_test = myname
p_code = get_code( error_priority )
p_suppress = pseudo_comment
p_suppress = settings-pseudo_comment
p_param_1 = parameter_01
p_param_2 = parameter_02
p_param_3 = parameter_03
p_param_4 = parameter_04
p_inclspec = is_include_specific
p_detail = additional_information
p_checksum_1 = checksum ).
p_checksum_1 = checksum
p_comments = pseudo_comments ).
ENDIF.

ENDMETHOD.


@@ -810,4 +797,6 @@ CLASS Y_CHECK_BASE IMPLEMENTATION.
result = abap_true.
ENDTRY.
ENDMETHOD.


ENDCLASS.
16 changes: 6 additions & 10 deletions src/foundation/y_clean_code_manager.clas.abap
Original file line number Diff line number Diff line change
@@ -4,20 +4,18 @@ CLASS y_clean_code_manager DEFINITION PUBLIC CREATE PUBLIC.
ALIASES calculate_obj_creation_date FOR y_if_clean_code_manager~calculate_obj_creation_date.
ALIASES read_check_customizing FOR y_if_clean_code_manager~read_check_customizing.

PROTECTED SECTION.
PRIVATE SECTION.
METHODS determine_profiles RETURNING VALUE(result) TYPE string_table
RAISING ycx_no_check_customizing.
RAISING ycx_no_check_customizing.

METHODS determine_checks IMPORTING profile TYPE ycicc_profile
checkid TYPE seoclsname
METHODS determine_checks IMPORTING profile TYPE ycicc_profile
checkid TYPE seoclsname
RETURNING VALUE(result) TYPE y_if_clean_code_manager=>check_configurations
RAISING ycx_no_check_customizing .
RAISING ycx_no_check_customizing .
ENDCLASS.



CLASS Y_CLEAN_CODE_MANAGER IMPLEMENTATION.
CLASS y_clean_code_manager IMPLEMENTATION.


METHOD determine_checks.
@@ -35,9 +33,7 @@ CLASS Y_CLEAN_CODE_MANAGER IMPLEMENTATION.
threshold = <check>-threshold
prio = <check>-prio
apply_on_productive_code = <check>-apply_on_productive_code
apply_on_testcode = <check>-apply_on_testcode
allow_pseudo_comments = <check>-ignore_pseudo_comments
).
apply_on_testcode = <check>-apply_on_testcode ).
result = VALUE #( BASE result ( CORRESPONDING #( check_configuration ) ) ).
ENDLOOP.
ENDMETHOD.
37 changes: 18 additions & 19 deletions src/foundation/y_if_clean_code_manager.intf.abap
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
INTERFACE y_if_clean_code_manager
PUBLIC .
interface Y_IF_CLEAN_CODE_MANAGER
public .


TYPES:
types:
BEGIN OF check_configuration,
object_creation_date TYPE datum,
threshold TYPE ycicc_threshold,
prio TYPE ycicc_message_kind,
apply_on_productive_code TYPE ycicc_productive_code,
apply_on_testcode TYPE ycicc_testcode,
allow_pseudo_comments TYPE ycicp_pseudo_comments,
END OF check_configuration .
TYPES:
types:
check_configurations TYPE STANDARD TABLE OF check_configuration WITH DEFAULT KEY .

METHODS read_check_customizing
IMPORTING
checkid TYPE seoclsname
RETURNING
VALUE(result) TYPE check_configurations
RAISING
ycx_no_check_customizing .
METHODS calculate_obj_creation_date
IMPORTING
object_name TYPE sobj_name
object_type TYPE trobjtype
RETURNING
VALUE(result) TYPE creationdt .
ENDINTERFACE.
methods READ_CHECK_CUSTOMIZING
importing
CHECKID type SEOCLSNAME
returning
value(RESULT) type CHECK_CONFIGURATIONS
raising
YCX_NO_CHECK_CUSTOMIZING .
methods CALCULATE_OBJ_CREATION_DATE
importing
OBJECT_NAME type SOBJ_NAME
OBJECT_TYPE type TROBJTYPE
returning
value(RESULT) type CREATIONDT .
endinterface.
23 changes: 0 additions & 23 deletions src/foundation/ycicp_pseudo_comments.dtel.xml

This file was deleted.

Loading