Skip to content

Commit

Permalink
Version 2.0
Browse files Browse the repository at this point in the history
Based on Exit Factory for abapGit
  • Loading branch information
mbtools committed Mar 12, 2024
1 parent 49b4d56 commit 392b183
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 64 deletions.
8 changes: 8 additions & 0 deletions .abapgit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<NAME>abapgit-ext-abaplint</NAME>
<MASTER_LANGUAGE>E</MASTER_LANGUAGE>
<STARTING_FOLDER>/src/</STARTING_FOLDER>
<FOLDER_LOGIC>PREFIX</FOLDER_LOGIC>
<REQUIREMENTS>
<item>
<COMPONENT>SAP_BASIS</COMPONENT>
<MIN_RELEASE>702</MIN_RELEASE>
</item>
</REQUIREMENTS>
<VERSION_CONSTANT>ZCL_ABAPLINT_ABAPGIT_EXT_EXIT=&gt;C_VERSION</VERSION_CONSTANT>
</DATA>
</asx:values>
</asx:abap>
33 changes: 24 additions & 9 deletions src/zcl_abaplint_abapgit_ext_agent.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ CLASS zcl_abaplint_abapgit_ext_agent DEFINITION
FINAL
CREATE PRIVATE.

" Calling Github API for check runs and annotations
" https://docs.github.com/en/rest/reference/checks
************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
* Calling Github API for check runs and annotations
* https://docs.github.com/en/rest/reference/checks
************************************************************************
PUBLIC SECTION.

CONSTANTS c_github_api_version TYPE string VALUE '2022-11-28'.
Expand All @@ -19,11 +28,13 @@ CLASS zcl_abaplint_abapgit_ext_agent DEFINITION
VALUE(ro_instance) TYPE REF TO zcl_abaplint_abapgit_ext_agent
RAISING
zcx_abapgit_exception.

METHODS constructor
IMPORTING
!iv_url TYPE string
RAISING
zcx_abapgit_exception.

METHODS get_annotations
IMPORTING
!iv_check_run TYPE string
Expand All @@ -32,32 +43,36 @@ CLASS zcl_abaplint_abapgit_ext_agent DEFINITION
RAISING
zcx_abapgit_exception
zcx_abapgit_ajson_error.

METHODS get_check_runs
IMPORTING
!iv_commit TYPE zif_abaplint_abapgit_ext=>ty_sha1
!iv_commit TYPE zcl_abaplint_abapgit_ext_exit=>ty_sha1

Check failure on line 49 in src/zcl_abaplint_abapgit_ext_agent.clas.abap

View check run for this annotation

abaplint / abaplint

Contains unknown, Could not resolve top ZCL_ABAPLINT_ABAPGIT_EXT_EXIT, resolveTypeChain

https://rules.abaplint.org/unknown_types
RETURNING
VALUE(ri_json) TYPE REF TO zif_abapgit_ajson
RAISING
zcx_abapgit_exception
zcx_abapgit_ajson_error.

PROTECTED SECTION.
PRIVATE SECTION.

TYPES:
BEGIN OF ty_instance,
url TYPE string,
instanace TYPE REF TO zcl_abaplint_abapgit_ext_agent,
END OF ty_instance .
END OF ty_instance.

CLASS-DATA gt_instance TYPE HASHED TABLE OF ty_instance WITH UNIQUE KEY url.

DATA:
mv_url TYPE string,
mo_agent TYPE REF TO zif_abapgit_http_agent.

CLASS-DATA:
gt_instance TYPE HASHED TABLE OF ty_instance WITH UNIQUE KEY url .
DATA mv_url TYPE string .
DATA mo_agent TYPE REF TO zif_abapgit_http_agent .
ENDCLASS.



CLASS zcl_abaplint_abapgit_ext_agent IMPLEMENTATION.
CLASS ZCL_ABAPLINT_ABAPGIT_EXT_AGENT IMPLEMENTATION.


METHOD constructor.
Expand Down
11 changes: 10 additions & 1 deletion src/zcl_abaplint_abapgit_ext_annot.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ CLASS zcl_abaplint_abapgit_ext_annot DEFINITION
FINAL
CREATE PUBLIC.

************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
* GitHub REST API for Checks - Annotation
* https://docs.github.com/en/rest/reference/checks
************************************************************************
PUBLIC SECTION.

TYPES:
Expand Down Expand Up @@ -58,7 +67,7 @@ ENDCLASS.



CLASS zcl_abaplint_abapgit_ext_annot IMPLEMENTATION.
CLASS ZCL_ABAPLINT_ABAPGIT_EXT_ANNOT IMPLEMENTATION.


METHOD constructor.
Expand Down
28 changes: 20 additions & 8 deletions src/zcl_abaplint_abapgit_ext_chkrn.clas.abap
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
CLASS zcl_abaplint_abapgit_ext_chkrn DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

CREATE PUBLIC.

************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
* GitHub REST API for Checks - Check Run
* https://docs.github.com/en/rest/reference/checks
************************************************************************
PUBLIC SECTION.

TYPES:
Expand All @@ -23,25 +32,28 @@ CLASS zcl_abaplint_abapgit_ext_chkrn DEFINITION
METHODS constructor
IMPORTING
!iv_url TYPE string
!iv_commit TYPE zif_abaplint_abapgit_ext=>ty_sha1
!iv_commit TYPE zcl_abaplint_abapgit_ext_exit=>ty_sha1

Check failure on line 35 in src/zcl_abaplint_abapgit_ext_chkrn.clas.abap

View check run for this annotation

abaplint / abaplint

Contains unknown, Could not resolve top ZCL_ABAPLINT_ABAPGIT_EXT_EXIT, resolveTypeChain

https://rules.abaplint.org/unknown_types
RAISING
zcx_abapgit_exception .
zcx_abapgit_exception.

METHODS get
RETURNING
VALUE(rs_check_run) TYPE ty_check_run
RAISING
zcx_abapgit_exception .
zcx_abapgit_exception.

PROTECTED SECTION.
PRIVATE SECTION.

DATA mv_url TYPE string .
DATA mv_commit TYPE zif_abaplint_abapgit_ext=>ty_sha1 .
DATA:
mv_url TYPE string,
mv_commit TYPE zcl_abaplint_abapgit_ext_exit=>ty_sha1.

Check failure on line 50 in src/zcl_abaplint_abapgit_ext_chkrn.clas.abap

View check run for this annotation

abaplint / abaplint

Variable "MV_COMMIT" contains unknown: Could not resolve top ZCL_ABAPLINT_ABAPGIT_EXT_EXIT, resolveTypeChain

https://rules.abaplint.org/unknown_types

ENDCLASS.



CLASS zcl_abaplint_abapgit_ext_chkrn IMPLEMENTATION.
CLASS ZCL_ABAPLINT_ABAPGIT_EXT_CHKRN IMPLEMENTATION.


METHOD constructor.
Expand Down
68 changes: 33 additions & 35 deletions src/zcl_abaplint_abapgit_ext_exit.clas.abap
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
CLASS zcl_abaplint_abapgit_ext_exit DEFINITION

Check failure on line 1 in src/zcl_abaplint_abapgit_ext_exit.clas.abap

View check run for this annotation

abaplint / abaplint

Super class "zcl_abapgit_user_exit_super" not found or contains errors

https://rules.abaplint.org/check_syntax

Check failure on line 1 in src/zcl_abaplint_abapgit_ext_exit.clas.abap

View check run for this annotation

abaplint / abaplint

Super class "zcl_abapgit_user_exit_super" not found

https://rules.abaplint.org/superclass_final
PUBLIC
INHERITING FROM zcl_abapgit_user_exit_super
FINAL
CREATE PRIVATE.

CREATE PUBLIC.

************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
PUBLIC SECTION.

CLASS-METHODS get_instance
RETURNING
VALUE(ro_instance) TYPE REF TO zcl_abaplint_abapgit_ext_exit.
METHODS on_event
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RETURNING
VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result
RAISING
zcx_abapgit_exception.
METHODS wall_message_repo
IMPORTING
!is_repo_meta TYPE zif_abapgit_persistence=>ty_repo
!ii_html TYPE REF TO zif_abapgit_html.
METHODS get_last_url
CONSTANTS c_version TYPE string VALUE '2.0.0' ##NEEDED.

TYPES ty_sha1 TYPE c LENGTH 40.

METHODS:
zif_abapgit_user_exit~on_event REDEFINITION,
zif_abapgit_user_exit~wall_message_repo REDEFINITION.

CLASS-METHODS get_last_url
RETURNING
VALUE(rv_url) TYPE string.

PROTECTED SECTION.
PRIVATE SECTION.

Expand All @@ -34,14 +38,16 @@ CLASS zcl_abaplint_abapgit_ext_exit DEFINITION

CONSTANTS:
BEGIN OF c_action,
go_abaplint TYPE string VALUE 'go_abaplint',
go_abaplint TYPE string VALUE 'mbt_go_abaplint',
END OF c_action.

CONSTANTS:
BEGIN OF c_git_status,
queued TYPE string VALUE 'queued',
in_progress TYPE string VALUE 'in_progress',
completed TYPE string VALUE 'completed',
END OF c_git_status.

CONSTANTS:
BEGIN OF c_git_conclusion,
neutral TYPE string VALUE 'neutral',
Expand All @@ -53,10 +59,10 @@ CLASS zcl_abaplint_abapgit_ext_exit DEFINITION
stale TYPE string VALUE 'stale',
timed_out TYPE string VALUE 'timed_out',
END OF c_git_conclusion.
CLASS-DATA go_instance TYPE REF TO zcl_abaplint_abapgit_ext_exit.
DATA:
mt_wall TYPE HASHED TABLE OF ty_wall WITH UNIQUE KEY commit.
DATA mv_last_url TYPE string.

CLASS-DATA gv_last_url TYPE string.

DATA mt_wall TYPE HASHED TABLE OF ty_wall WITH UNIQUE KEY commit.

METHODS _wall_message_abaplint
IMPORTING
Expand All @@ -71,20 +77,12 @@ ENDCLASS.
CLASS zcl_abaplint_abapgit_ext_exit IMPLEMENTATION.


METHOD get_instance.
IF go_instance IS INITIAL.
CREATE OBJECT go_instance.
ENDIF.
ro_instance = go_instance.
ENDMETHOD.


METHOD get_last_url.
rv_url = mv_last_url.
rv_url = gv_last_url.
ENDMETHOD.


METHOD on_event.
METHOD zif_abapgit_user_exit~on_event.

IF ii_event->mv_action = c_action-go_abaplint.
rs_handled-page = zcl_abaplint_abapgit_ext_ui=>create(
Expand All @@ -97,12 +95,12 @@ CLASS zcl_abaplint_abapgit_ext_exit IMPLEMENTATION.
ENDMETHOD.


METHOD wall_message_repo.
METHOD zif_abapgit_user_exit~wall_message_repo.

DATA:
lx_error TYPE REF TO zcx_abapgit_exception,
lo_repo_online TYPE REF TO zcl_abapgit_repo_online,
lv_commit TYPE zif_abaplint_abapgit_ext=>ty_sha1,
lv_commit TYPE zcl_abaplint_abapgit_ext_exit=>ty_sha1,

Check failure on line 103 in src/zcl_abaplint_abapgit_ext_exit.clas.abap

View check run for this annotation

abaplint / abaplint

Reference to current class can be omitted: "ZCL_ABAPLINT_ABAPGIT_EXT_EXIT=>"

https://rules.abaplint.org/prefix_is_current_class
ls_wall TYPE ty_wall,
lo_check_run TYPE REF TO zcl_abaplint_abapgit_ext_chkrn,
ls_check_run TYPE zcl_abaplint_abapgit_ext_chkrn=>ty_check_run,
Expand Down Expand Up @@ -165,7 +163,7 @@ CLASS zcl_abaplint_abapgit_ext_exit IMPLEMENTATION.
ii_html->add( ls_wall-html->render( ) ).

" Remember URL of last shown check run
mv_last_url = ls_wall-url.
gv_last_url = ls_wall-url.

ENDMETHOD.

Expand Down
11 changes: 10 additions & 1 deletion src/zcl_abaplint_abapgit_ext_issue.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ CLASS zcl_abaplint_abapgit_ext_issue DEFINITION
FINAL
CREATE PUBLIC .

************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
* Derive abapGit issue from abaplint annotation
************************************************************************
PUBLIC SECTION.

TYPES:
Expand Down Expand Up @@ -132,7 +141,7 @@ ENDCLASS.



CLASS zcl_abaplint_abapgit_ext_issue IMPLEMENTATION.
CLASS ZCL_ABAPLINT_ABAPGIT_EXT_ISSUE IMPLEMENTATION.


METHOD constructor.
Expand Down
11 changes: 10 additions & 1 deletion src/zcl_abaplint_abapgit_ext_logo.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ CLASS zcl_abaplint_abapgit_ext_logo DEFINITION
FINAL
CREATE PUBLIC.

************************************************************************
* abaplint Extension for abapGit
*
* https://github.com/Marc-Bernard-Tools/abaplint-Ext-for-abapGit
*
* Copyright 2023 Marc Bernard <https://marcbernardtools.com/>
* SPDX-License-Identifier: MIT
************************************************************************
PUBLIC SECTION.

CONSTANTS c_logo TYPE string VALUE 'abaplint_logo.png'.
Expand All @@ -19,6 +27,7 @@ CLASS zcl_abaplint_abapgit_ext_logo DEFINITION
RETURNING
VALUE(rv_html) TYPE string.

PROTECTED SECTION.
PRIVATE SECTION.

CONSTANTS c_mime TYPE string VALUE 'ZABAPLINT_LOGO'.
Expand All @@ -27,7 +36,7 @@ ENDCLASS.



CLASS zcl_abaplint_abapgit_ext_logo IMPLEMENTATION.
CLASS ZCL_ABAPLINT_ABAPGIT_EXT_LOGO IMPLEMENTATION.


METHOD get_logo_html.
Expand Down
Loading

0 comments on commit 392b183

Please sign in to comment.