Naming of class constants (#4945)

* Naming of class constants

This is in preparation of enforcing a naming convention for constants in classes/interfaces. At the end, the following lint rule shall be set:

```json
    "class_attribute_names": {
      "constants": "^C_.+$",
...
    },
```

After this, the only remaining constants not following this rule are in `zcl_abapgit_version`.

* Update zif_abapgit_dot_abapgit.intf.abap

* Update zcl_abapgit_gui_chunk_lib.clas.abap

* Update zcl_abapgit_gui_router.clas.abap

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Marc Bernard 2021-09-14 10:47:48 -04:00 committed by GitHub
parent 89507dc971
commit b331de6bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 66 additions and 65 deletions

View File

@ -71,20 +71,20 @@ CLASS zcl_abapgit_apack_helper IMPLEMENTATION.
DATA: lt_dependencies_status TYPE ty_dependency_statuses.
IF it_dependencies IS INITIAL.
rv_status = zif_abapgit_definitions=>gc_yes.
rv_status = zif_abapgit_definitions=>c_yes.
RETURN.
ENDIF.
lt_dependencies_status = get_dependencies_met_status( it_dependencies ).
LOOP AT lt_dependencies_status TRANSPORTING NO FIELDS WHERE met <> zif_abapgit_definitions=>gc_yes.
LOOP AT lt_dependencies_status TRANSPORTING NO FIELDS WHERE met <> zif_abapgit_definitions=>c_yes.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
rv_status = zif_abapgit_definitions=>gc_no.
rv_status = zif_abapgit_definitions=>c_no.
ELSE.
rv_status = zif_abapgit_definitions=>gc_yes.
rv_status = zif_abapgit_definitions=>c_yes.
ENDIF.
ENDMETHOD.
@ -123,14 +123,14 @@ CLASS zcl_abapgit_apack_helper IMPLEMENTATION.
WITH KEY group_id = ls_dependecy-group_id
artifact_id = ls_dependecy-artifact_id.
IF sy-subrc <> 0.
ls_dependecy_popup-met = zif_abapgit_definitions=>gc_no.
ls_dependecy_popup-met = zif_abapgit_definitions=>c_no.
ELSE.
TRY.
zcl_abapgit_version=>check_dependant_version( is_current = ls_installed_package-sem_version
is_dependant = ls_dependecy-sem_version ).
ls_dependecy_popup-met = zif_abapgit_definitions=>gc_yes.
ls_dependecy_popup-met = zif_abapgit_definitions=>c_yes.
CATCH zcx_abapgit_exception.
ls_dependecy_popup-met = zif_abapgit_definitions=>gc_partial.
ls_dependecy_popup-met = zif_abapgit_definitions=>c_partial.
ENDTRY.
ENDIF.
@ -286,13 +286,13 @@ CLASS zcl_abapgit_apack_helper IMPLEMENTATION.
MOVE-CORRESPONDING <ls_dependency> TO <ls_line>.
CASE <ls_line>-met.
WHEN zif_abapgit_definitions=>gc_yes.
WHEN zif_abapgit_definitions=>c_yes.
<ls_line>-color = lt_color_positive.
<ls_line>-exception = '3'.
WHEN zif_abapgit_definitions=>gc_partial.
WHEN zif_abapgit_definitions=>c_partial.
<ls_line>-color = lt_color_normal.
<ls_line>-exception = '2'.
WHEN zif_abapgit_definitions=>gc_no.
WHEN zif_abapgit_definitions=>c_no.
<ls_line>-color = lt_color_negative.
<ls_line>-exception = '1'.
ENDCASE.

View File

@ -11,7 +11,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_BACKGROUND_PULL IMPLEMENTATION.
CLASS zcl_abapgit_background_pull IMPLEMENTATION.
METHOD zif_abapgit_background~get_description.
@ -36,7 +36,7 @@ CLASS ZCL_ABAPGIT_BACKGROUND_PULL IMPLEMENTATION.
ls_checks = io_repo->deserialize_checks( ).
LOOP AT ls_checks-overwrite ASSIGNING <ls_overwrite>.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_yes.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_yes.
ENDLOOP.
io_repo->deserialize( is_checks = ls_checks

View File

@ -110,7 +110,7 @@ CLASS lcl_transport_zipper DEFINITION FINAL.
TYPES ty_filename TYPE string.
* File extension
CONSTANTS gc_zip_ext TYPE string VALUE '.zip'.
CONSTANTS c_zip_ext TYPE string VALUE '.zip'.
METHODS constructor IMPORTING iv_folder TYPE ty_folder
RAISING zcx_abapgit_exception.
@ -235,7 +235,7 @@ CLASS lcl_transport_zipper IMPLEMENTATION.
METHOD get_filename.
* Generate filename
CONCATENATE is_trkorr-trkorr '_' is_trkorr-as4text '_' mv_timestamp gc_zip_ext
CONCATENATE is_trkorr-trkorr '_' is_trkorr-as4text '_' mv_timestamp c_zip_ext
INTO rv_filename.
* Remove reserved characters (for Windows based systems)

View File

@ -123,7 +123,7 @@ CLASS zcl_abapgit_objects_check IMPLEMENTATION.
<ls_overwrite>-obj_name } undecided| ).
ENDIF.
IF ls_overwrite-decision = zif_abapgit_definitions=>gc_no.
IF ls_overwrite-decision = zif_abapgit_definitions=>c_no.
DELETE ct_results WHERE
obj_type = <ls_overwrite>-obj_type AND
obj_name = <ls_overwrite>-obj_name.
@ -234,7 +234,7 @@ CLASS zcl_abapgit_objects_check IMPLEMENTATION.
<ls_overwrite>-obj_name } undecided| ).
ENDIF.
IF ls_overwrite-decision = zif_abapgit_definitions=>gc_no.
IF ls_overwrite-decision = zif_abapgit_definitions=>c_no.
DELETE ct_results WHERE
obj_type = <ls_overwrite>-obj_type AND
obj_name = <ls_overwrite>-obj_name.

View File

@ -217,7 +217,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION.
CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD bind_listener.
@ -340,11 +340,11 @@ CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION.
check_write_protect( ).
check_language( ).
IF is_checks-requirements-met = zif_abapgit_definitions=>gc_no AND is_checks-requirements-decision IS INITIAL.
IF is_checks-requirements-met = zif_abapgit_definitions=>c_no AND is_checks-requirements-decision IS INITIAL.
zcx_abapgit_exception=>raise( 'Requirements not met and undecided' ).
ENDIF.
IF is_checks-dependencies-met = zif_abapgit_definitions=>gc_no.
IF is_checks-dependencies-met = zif_abapgit_definitions=>c_no.
zcx_abapgit_exception=>raise( 'APACK dependencies not met' ).
ENDIF.

View File

@ -414,7 +414,7 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION.
lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-create_repo ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-create_repo ) = abap_false.
zcx_abapgit_exception=>raise( 'Not authorized' ).
ENDIF.
@ -462,7 +462,7 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION.
lv_url = condense( iv_url ).
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-create_repo ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-create_repo ) = abap_false.
zcx_abapgit_exception=>raise( 'Not authorized' ).
ENDIF.
@ -519,7 +519,7 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION.
IF io_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot purge. Local code is write-protected by repo config' ).
ELSEIF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-uninstall ) = abap_false.
ELSEIF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-uninstall ) = abap_false.
zcx_abapgit_exception=>raise( 'Not authorized' ).
ENDIF.

View File

@ -270,7 +270,7 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?key={ mv_key }| ).
CLEAR lv_crossout.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-transport_to_branch ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-transport_to_branch ) = abap_false.
lv_crossout = zif_abapgit_html=>c_html_opt-crossout.
ENDIF.
ro_advanced_dropdown->add(
@ -291,7 +291,7 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }?key={ mv_key }| ).
CLEAR lv_crossout.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-update_local_checksum ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-update_local_checksum ) = abap_false.
lv_crossout = zif_abapgit_html=>c_html_opt-crossout.
ENDIF.
ro_advanced_dropdown->add( iv_txt = 'Update Local Checksums'
@ -315,7 +315,7 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
CLEAR lv_crossout.
IF mo_repo->get_local_settings( )-write_protected = abap_true
OR zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-uninstall ) = abap_false.
OR zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-uninstall ) = abap_false.
lv_crossout = zif_abapgit_html=>c_html_opt-crossout.
ENDIF.
ro_advanced_dropdown->add( iv_txt = 'Uninstall'
@ -972,6 +972,18 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
ENDMETHOD.
METHOD render_item_changed_by.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
IF is_item-changes = 0 OR is_item-changed_by IS INITIAL.
ri_html->add( '&nbsp;' ).
ELSE.
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_user_name( is_item-changed_by ) ).
ENDIF.
ENDMETHOD.
METHOD render_item_command.
DATA: lv_difflink TYPE string,
@ -1285,15 +1297,4 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDMETHOD.
METHOD render_item_changed_by.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
IF is_item-changes = 0 OR is_item-changed_by IS INITIAL.
ri_html->add( '&nbsp;' ).
ELSE.
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_user_name( is_item-changed_by ) ).
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@ -136,7 +136,7 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
LOOP AT is_checks-overwrite ASSIGNING <ls_overwrite>
WHERE ( action = zif_abapgit_objects=>c_deserialize_action-delete
OR action = zif_abapgit_objects=>c_deserialize_action-delete_add )
AND decision = zif_abapgit_definitions=>gc_yes.
AND decision = zif_abapgit_definitions=>c_yes.
ls_tadir-pgmid = 'R3TR'.
ls_tadir-object = <ls_overwrite>-obj_type.
@ -276,13 +276,13 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
popup_overwrite( CHANGING ct_overwrite = lt_decision ).
popup_package_overwrite( CHANGING ct_overwrite = cs_checks-warning_package ).
IF cs_checks-requirements-met = zif_abapgit_definitions=>gc_no.
IF cs_checks-requirements-met = zif_abapgit_definitions=>c_no.
lt_requirements = io_repo->get_dot_abapgit( )->get_data( )-requirements.
zcl_abapgit_requirement_helper=>requirements_popup( lt_requirements ).
cs_checks-requirements-decision = zif_abapgit_definitions=>gc_yes.
cs_checks-requirements-decision = zif_abapgit_definitions=>c_yes.
ENDIF.
IF cs_checks-dependencies-met = zif_abapgit_definitions=>gc_no.
IF cs_checks-dependencies-met = zif_abapgit_definitions=>c_no.
lt_dependencies = io_repo->get_dot_apack( )->get_manifest_descriptor( )-dependencies.
zcl_abapgit_apack_helper=>dependencies_popup( lt_dependencies ).
ENDIF.
@ -304,10 +304,10 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
CASE <ls_overwrite>-action.
WHEN zif_abapgit_objects=>c_deserialize_action-delete
OR zif_abapgit_objects=>c_deserialize_action-delete_add.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_no.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_no.
WHEN zif_abapgit_objects=>c_deserialize_action-add
OR zif_abapgit_objects=>c_deserialize_action-update.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_yes.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_yes.
WHEN OTHERS.
ASSERT 0 = 1.
ENDCASE.
@ -361,9 +361,9 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
obj_name = <ls_overwrite>-obj_name
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_yes.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_yes.
ELSE.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_no.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_no.
ENDIF.
ENDLOOP.
@ -408,9 +408,9 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
obj_name = <ls_overwrite>-obj_name
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_yes.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_yes.
ELSE.
<ls_overwrite>-decision = zif_abapgit_definitions=>gc_no.
<ls_overwrite>-decision = zif_abapgit_definitions=>c_no.
ENDIF.
ENDLOOP.
@ -494,7 +494,7 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
lo_repo TYPE REF TO zcl_abapgit_repo.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-update_local_checksum ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-update_local_checksum ) = abap_false.
zcx_abapgit_exception=>raise( 'Not authorized' ).
ENDIF.
@ -589,7 +589,7 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
ls_transport_to_branch TYPE zif_abapgit_definitions=>ty_transport_to_branch.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-transport_to_branch ) = abap_false.
IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>c_authorization-transport_to_branch ) = abap_false.
zcx_abapgit_exception=>raise( 'Not authorized' ).
ENDIF.

View File

@ -54,7 +54,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_REQUIREMENT_HELPER IMPLEMENTATION.
CLASS zcl_abapgit_requirement_helper IMPLEMENTATION.
METHOD get_requirement_met_status.
@ -111,9 +111,9 @@ CLASS ZCL_ABAPGIT_REQUIREMENT_HELPER IMPLEMENTATION.
READ TABLE lt_met_status TRANSPORTING NO FIELDS WITH KEY met = abap_false.
IF sy-subrc = 0.
rv_status = zif_abapgit_definitions=>gc_no.
rv_status = zif_abapgit_definitions=>c_no.
ELSE.
rv_status = zif_abapgit_definitions=>gc_yes.
rv_status = zif_abapgit_definitions=>c_yes.
ENDIF.
ENDMETHOD.

View File

@ -5,7 +5,7 @@ CLASS zcl_abapgit_user_record DEFINITION
PUBLIC SECTION.
CONSTANTS gc_cc_category TYPE string VALUE 'C'.
CONSTANTS c_cc_category TYPE string VALUE 'C'.
CLASS-METHODS reset.
CLASS-METHODS get_instance
@ -163,7 +163,7 @@ CLASS zcl_abapgit_user_record IMPLEMENTATION.
" Could not find the user Try other development clients
SELECT mandt FROM t000 INTO TABLE lt_dev_clients
WHERE cccategory = gc_cc_category AND mandt <> sy-mandt
WHERE cccategory = c_cc_category AND mandt <> sy-mandt
ORDER BY PRIMARY KEY.
LOOP AT lt_dev_clients ASSIGNING <lv_dev_client>.

View File

@ -7,7 +7,7 @@ CLASS ltcl_user_record DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
CONSTANTS gc_wrong_user TYPE sy-uname VALUE 'WRONG_USER'.
CONSTANTS c_wrong_user TYPE sy-uname VALUE 'WRONG_USER'.
METHODS:
test_invalid_user FOR TESTING RAISING cx_static_check.
ENDCLASS.
@ -19,12 +19,12 @@ CLASS ltcl_user_record IMPLEMENTATION.
DATA: lo_user_record TYPE REF TO zcl_abapgit_user_record.
zcl_abapgit_user_record=>reset( ).
lo_user_record = zcl_abapgit_user_record=>get_instance( gc_wrong_user ).
lo_user_record = zcl_abapgit_user_record=>get_instance( c_wrong_user ).
cl_abap_unit_assert=>assert_equals(
exp = 0
act = lines( zcl_abapgit_user_record=>gt_user )
msg = |User { gc_wrong_user } is missing in the list| ).
msg = |User { c_wrong_user } is missing in the list| ).
ENDMETHOD.
ENDCLASS.

View File

@ -85,7 +85,7 @@ CLASS zcx_abapgit_exception DEFINITION
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS gc_generic_error_msg TYPE string VALUE `An error occured (ZCX_ABAPGIT_EXCEPTION)` ##NO_TEXT.
CONSTANTS c_generic_error_msg TYPE string VALUE `An error occured (ZCX_ABAPGIT_EXCEPTION)` ##NO_TEXT.
CLASS-METHODS split_text_to_symsg
IMPORTING
@ -297,7 +297,7 @@ CLASS zcx_abapgit_exception IMPLEMENTATION.
DATA lv_text TYPE string.
IF iv_text IS INITIAL.
lv_text = gc_generic_error_msg.
lv_text = c_generic_error_msg.
ELSE.
lv_text = iv_text.
ENDIF.

View File

@ -79,7 +79,7 @@ CLASS ltcl_test IMPLEMENTATION.
CATCH zcx_abapgit_exception INTO lx_ex.
cl_abap_unit_assert=>assert_equals(
act = get_exc_text( lx_ex )
exp = zcx_abapgit_exception=>gc_generic_error_msg ).
exp = zcx_abapgit_exception=>c_generic_error_msg ).
ENDTRY.
FREE lx_ex.
@ -94,7 +94,7 @@ CLASS ltcl_test IMPLEMENTATION.
CATCH zcx_abapgit_exception INTO lx_ex.
cl_abap_unit_assert=>assert_equals(
act = get_exc_text( lx_ex )
exp = zcx_abapgit_exception=>gc_generic_error_msg ).
exp = zcx_abapgit_exception=>c_generic_error_msg ).
ENDTRY.
ENDMETHOD.

View File

@ -2,12 +2,12 @@ INTERFACE zif_abapgit_auth PUBLIC.
TYPES: ty_authorization TYPE string.
CONSTANTS: BEGIN OF gc_authorization,
CONSTANTS: BEGIN OF c_authorization,
uninstall TYPE ty_authorization VALUE 'UNINSTALL',
create_repo TYPE ty_authorization VALUE 'CREATE_REPO',
transport_to_branch TYPE ty_authorization VALUE 'TRANSPORT_TO_BRANCH',
update_local_checksum TYPE ty_authorization VALUE 'UPDATE_LOCAL_CHECKSUM',
END OF gc_authorization.
END OF c_authorization.
METHODS:
is_allowed

View File

@ -493,9 +493,9 @@ INTERFACE zif_abapgit_definitions
END OF c_action.
CONSTANTS c_spagpa_param_repo_key TYPE c LENGTH 20 VALUE 'REPO_KEY' ##NO_TEXT.
CONSTANTS c_spagpa_param_package TYPE c LENGTH 20 VALUE 'PACKAGE' ##NO_TEXT.
CONSTANTS gc_yes TYPE ty_yes_no VALUE 'Y'.
CONSTANTS gc_no TYPE ty_yes_no VALUE 'N'.
CONSTANTS gc_partial TYPE ty_yes_no_partial VALUE 'P'.
CONSTANTS c_yes TYPE ty_yes_no VALUE 'Y'.
CONSTANTS c_no TYPE ty_yes_no VALUE 'N'.
CONSTANTS c_partial TYPE ty_yes_no_partial VALUE 'P'.
TYPES:
ty_method TYPE c LENGTH 1 .