Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_gui_page_codi_base DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component. PUBLIC SECTION. INTERFACES zif_abapgit_html_table. PROTECTED SECTION. CONSTANTS: BEGIN OF c_actions, rerun TYPE string VALUE 'rerun', stage TYPE string VALUE 'stage', commit TYPE string VALUE 'commit', filter_kind TYPE string VALUE 'filter_kind', apply_filter TYPE string VALUE 'apply_filter', END OF c_actions . DATA mo_repo TYPE REF TO zcl_abapgit_repo. DATA mt_result TYPE zif_abapgit_code_inspector=>ty_results. DATA mv_summary TYPE string. 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 render_ci_report IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_variant TYPE sci_chkv !iv_success_msg TYPE string RAISING zcx_abapgit_exception. METHODS render_head IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_variant TYPE sci_chkv !iv_summary TYPE string. METHODS render_detail IMPORTING !ii_html TYPE REF TO zif_abapgit_html !it_result TYPE zif_abapgit_code_inspector=>ty_results RAISING zcx_abapgit_exception. METHODS render_stats IMPORTING !ii_html TYPE REF TO zif_abapgit_html !it_result TYPE zif_abapgit_code_inspector=>ty_results RAISING zcx_abapgit_exception. METHODS render_success IMPORTING ii_html TYPE REF TO zif_abapgit_html iv_message TYPE string. METHODS build_base_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. PRIVATE SECTION. CONSTANTS c_object_separator TYPE c LENGTH 1 VALUE '|'. CONSTANTS c_ci_sig TYPE string VALUE 'cinav:'. CONSTANTS c_limit TYPE i VALUE 500. DATA mv_filter_kind TYPE string. DATA ms_sorting_state TYPE zif_abapgit_html_table=>ty_sorting_state. TYPES: BEGIN OF ty_result_view, kind TYPE zif_abapgit_code_inspector=>ty_result-kind, obj_type TYPE zif_abapgit_code_inspector=>ty_result-objtype, location TYPE string, text TYPE string, nav TYPE string, END OF ty_result_view, ty_view_tab TYPE STANDARD TABLE OF ty_result_view WITH DEFAULT KEY. METHODS convert_result_to_view IMPORTING it_result TYPE zif_abapgit_code_inspector=>ty_results RETURNING VALUE(rt_view) TYPE ty_view_tab. METHODS explain_include IMPORTING !is_result TYPE zif_abapgit_code_inspector=>ty_result RETURNING VALUE(rv_txt) TYPE string. METHODS render_limit_warning IMPORTING !ii_html TYPE REF TO zif_abapgit_html. METHODS build_nav_link IMPORTING !is_result TYPE zif_abapgit_code_inspector=>ty_result RETURNING VALUE(rv_link) TYPE string. METHODS jump IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !is_sub_item TYPE zif_abapgit_definitions=>ty_item !iv_line_number TYPE i RAISING zcx_abapgit_exception. METHODS apply_sorting CHANGING ct_view TYPE ty_view_tab. METHODS apply_filter_kind CHANGING ct_view TYPE ty_view_tab. METHODS handle_navigation IMPORTING iv_link TYPE string RAISING zcx_abapgit_exception. METHODS render_stat IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_count TYPE i !iv_type TYPE string !iv_title TYPE string RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_CODI_BASE IMPLEMENTATION. METHOD apply_filter_kind. CASE mv_filter_kind. WHEN 'error'. DELETE ct_view WHERE kind <> 'E'. WHEN 'warn'. DELETE ct_view WHERE kind <> 'W'. WHEN 'info'. DELETE ct_view WHERE NOT ( kind = 'E' OR kind = 'W' ). WHEN OTHERS. RETURN. ENDCASE. ENDMETHOD. METHOD apply_sorting. DATA lv_field TYPE abap_compname. CASE ms_sorting_state-column_id. WHEN 'kind' OR 'obj_type' OR 'location' OR 'text'. lv_field = to_upper( ms_sorting_state-column_id ). WHEN OTHERS. RETURN. ENDCASE. IF ms_sorting_state-descending = abap_true. SORT ct_view BY (lv_field) DESCENDING. ELSE. SORT ct_view BY (lv_field) ASCENDING. ENDIF. ENDMETHOD. METHOD build_base_menu. ro_menu = zcl_abapgit_html_toolbar=>create( )->add( iv_txt = 'Re-Run' iv_act = c_actions-rerun ). ENDMETHOD. METHOD build_nav_link. rv_link = |{ c_ci_sig }| && |{ is_result-objtype }{ is_result-objname }| && |{ c_object_separator }{ is_result-sobjtype }{ is_result-sobjname }| && |{ c_object_separator }{ is_result-line }|. ENDMETHOD. METHOD convert_result_to_view. FIELD-SYMBOLS <ls_r> LIKE LINE OF it_result. FIELD-SYMBOLS <ls_v> LIKE LINE OF rt_view. DATA lv_line TYPE i. LOOP AT it_result ASSIGNING <ls_r>. APPEND INITIAL LINE TO rt_view ASSIGNING <ls_v>. <ls_v>-kind = <ls_r>-kind. <ls_v>-obj_type = <ls_r>-objtype. <ls_v>-nav = build_nav_link( <ls_r> ). <ls_v>-text = <ls_r>-text. IF <ls_r>-sobjname IS INITIAL OR ( <ls_r>-sobjname = <ls_r>-objname AND <ls_r>-sobjtype = <ls_r>-objtype ). <ls_v>-location = to_lower( <ls_r>-objname ). ELSEIF <ls_r>-objtype = 'CLAS' OR ( <ls_r>-objtype = 'PROG' AND NOT <ls_r>-sobjname+30(*) IS INITIAL ). <ls_v>-location = explain_include( <ls_r> ). ENDIF. IF <ls_v>-location IS INITIAL. " Fallback to a reasonable default <ls_v>-location = to_lower( |{ <ls_r>-objname } > { <ls_r>-sobjtype } { <ls_r>-sobjname }| ). ENDIF. lv_line = <ls_r>-line. " convert from numc to integer <ls_v>-location = |{ <ls_v>-location } @{ lv_line }|. ENDLOOP. ENDMETHOD. METHOD explain_include. DATA ls_mtdkey TYPE seocpdkey. TRY. CASE is_result-sobjname+30(*). WHEN 'CCDEF'. rv_txt = |{ to_lower( is_result-objname ) }: Local Definitions|. WHEN 'CCIMP'. rv_txt = |{ to_lower( is_result-objname ) }: Local Implementations|. WHEN 'CCMAC'. rv_txt = |{ to_lower( is_result-objname ) }: Macros|. WHEN 'CCAU'. rv_txt = |{ to_lower( is_result-objname ) }: Test Classes|. WHEN 'CU'. rv_txt = |{ to_lower( is_result-objname ) }: Public Section|. WHEN 'CO'. rv_txt = |{ to_lower( is_result-objname ) }: Protected Section|. WHEN 'CI'. rv_txt = |{ to_lower( is_result-objname ) }: Private Section|. WHEN OTHERS. cl_oo_classname_service=>get_method_by_include( EXPORTING incname = is_result-sobjname RECEIVING mtdkey = ls_mtdkey EXCEPTIONS class_not_existing = 1 method_not_existing = 2 OTHERS = 3 ). IF sy-subrc = 0. rv_txt = to_lower( |{ ls_mtdkey-clsname }->{ ls_mtdkey-cpdname }| ). ELSE. rv_txt = to_lower( |{ is_result-sobjname }| ). ENDIF. ENDCASE. CATCH cx_root. " leave empty, fallback to default, defined elsewhere ENDTRY. ENDMETHOD. METHOD handle_navigation. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item, lv_main_object TYPE string, lv_sub_object TYPE string, lv_line_number_s TYPE string, lv_line_number TYPE i. SPLIT iv_link AT c_object_separator INTO lv_main_object lv_sub_object lv_line_number_s. ls_item-obj_type = to_upper( lv_main_object(4) ). ls_item-obj_name = to_upper( lv_main_object+4(*) ). IF lv_sub_object IS NOT INITIAL. ls_sub_item-obj_type = to_upper( lv_sub_object(4) ). ls_sub_item-obj_name = to_upper( lv_sub_object+4(*) ). ENDIF. lv_line_number = lv_line_number_s. jump( is_item = ls_item is_sub_item = ls_sub_item iv_line_number = lv_line_number ). ENDMETHOD. METHOD jump. DATA: lo_test TYPE REF TO cl_ci_test_root, ls_info TYPE scir_rest, lo_result TYPE REF TO cl_ci_result_root, lv_adt_jump_enabled TYPE abap_bool, lv_line_number TYPE i, ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS: <ls_result> LIKE LINE OF mt_result. IF is_sub_item IS NOT INITIAL. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name sobjtype = is_sub_item-obj_type sobjname = is_sub_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ELSE. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ENDIF. ASSERT <ls_result> IS ASSIGNED. ls_item-obj_name = <ls_result>-objname. ls_item-obj_type = <ls_result>-objtype. ls_sub_item-obj_name = <ls_result>-sobjname. ls_sub_item-obj_type = <ls_result>-sobjtype. " see SCI_LCL_DYNP_530 / HANDLE_DOUBLE_CLICK lv_adt_jump_enabled = zcl_abapgit_persist_factory=>get_settings( )->read( )->get_adt_jump_enabled( ). TRY. IF lv_adt_jump_enabled = abap_true. lv_line_number = <ls_result>-line. zcl_abapgit_objects=>jump( is_item = ls_item is_sub_item = ls_sub_item iv_line_number = lv_line_number ). RETURN. ENDIF. CATCH zcx_abapgit_exception. ENDTRY. TRY. CALL METHOD ('CL_CI_TESTS')=>('GET_TEST_REF') EXPORTING p_test = <ls_result>-test RECEIVING p_result = lo_test. CATCH cx_root. zcx_abapgit_exception=>raise( |Jump to object not supported in your NW release| ). ENDTRY. lo_result = lo_test->get_result_node( <ls_result>-kind ). MOVE-CORRESPONDING <ls_result> TO ls_info. lo_result->set_info( ls_info ). lo_result->if_ci_test~navigate( ). ENDMETHOD. METHOD on_event. DATA lv_temp TYPE string. DATA ls_sorting_req TYPE zif_abapgit_html_table=>ty_sorting_state. lv_temp = replace( val = ii_event->mv_action regex = |^{ c_ci_sig }| with = `` ). IF lv_temp <> ii_event->mv_action. " CI navigation request detected handle_navigation( lv_temp ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. ls_sorting_req = zcl_abapgit_html_table=>detect_sorting_request( ii_event->mv_action ). IF ls_sorting_req IS NOT INITIAL. ms_sorting_state = ls_sorting_req. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDIF. IF ii_event->mv_action = c_actions-filter_kind. mv_filter_kind = ii_event->query( )->get( 'kind' ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDIF. ENDMETHOD. METHOD render_ci_report. ii_html->add( '<div class="ci">' ). render_head( ii_html = ii_html iv_variant = iv_variant iv_summary = mv_summary ). IF lines( mt_result ) = 0. render_success( ii_html = ii_html iv_message = iv_success_msg ). ELSE. render_stats( ii_html = ii_html it_result = mt_result ). render_detail( ii_html = ii_html it_result = mt_result ). ENDIF. ii_html->add( '</div>' ). ENDMETHOD. METHOD render_detail. DATA li_table TYPE REF TO zcl_abapgit_html_table. DATA lt_view TYPE ty_view_tab. li_table = zcl_abapgit_html_table=>create( )->define_column( iv_column_id = 'kind' iv_column_title = zcl_abapgit_html=>icon( 'exclamation-circle' ) )->define_column( iv_column_id = 'obj_type' iv_column_title = 'Type' )->define_column( iv_column_id = 'location' iv_column_title = 'Obj. name / location' )->define_column( iv_column_id = 'text' iv_column_title = 'Text' ). lt_view = convert_result_to_view( it_result ). IF ms_sorting_state-column_id IS INITIAL. ms_sorting_state-column_id = 'kind'. ENDIF. apply_sorting( CHANGING ct_view = lt_view ). apply_filter_kind( CHANGING ct_view = lt_view ). ii_html->div( iv_class = 'ci-detail' ii_content = li_table->render( ii_renderer = me is_sorting_state = ms_sorting_state iv_wrap_in_div = 'default-table-container' iv_css_class = 'default-table' iv_with_cids = abap_true it_data = lt_view ) ). IF lines( it_result ) > c_limit. render_limit_warning( ii_html ). ENDIF. ENDMETHOD. METHOD render_head. ii_html->div( iv_class = 'ci-msg' iv_content = |Code inspector check variant <span class="ci-variant">{ iv_variant }</span> completed ({ iv_summary })| ). ENDMETHOD. METHOD render_limit_warning. ii_html->add( '<div class="dummydiv warning">' ). ii_html->add( ii_html->icon( 'exclamation-triangle' ) ). ii_html->add( |Only first { c_limit } findings shown in list!| ). ii_html->add( '</div>' ). ENDMETHOD. METHOD render_stat. DATA lv_txt TYPE string. lv_txt = |{ iv_count } { iv_title }|. IF iv_type <> mv_filter_kind. lv_txt = ii_html->a( iv_txt = lv_txt iv_act = |{ c_actions-filter_kind }?kind={ iv_type }| iv_typ = zif_abapgit_html=>c_action_type-sapevent ). ENDIF. ii_html->add( |<span class="count { iv_type }-count">{ lv_txt }</span>| ). ENDMETHOD. METHOD render_stats. FIELD-SYMBOLS <ls_i> LIKE LINE OF it_result. DATA lv_errors TYPE i. DATA lv_warnings TYPE i. DATA lv_infos TYPE i. IF mv_filter_kind IS INITIAL. mv_filter_kind = 'all'. ENDIF. LOOP AT it_result ASSIGNING <ls_i>. CASE <ls_i>-kind. WHEN 'E'. lv_errors = lv_errors + 1. WHEN 'W'. lv_warnings = lv_warnings + 1. WHEN OTHERS. lv_infos = lv_infos + 1. ENDCASE. ENDLOOP. ii_html->add( '<div class="ci-stats">' ). IF lv_errors > 0. render_stat( ii_html = ii_html iv_count = lv_errors iv_type = 'error' iv_title = 'errors' ). ENDIF. IF lv_warnings > 0. render_stat( ii_html = ii_html iv_count = lv_warnings iv_type = 'warn' iv_title = 'warnings' ). ENDIF. IF lv_infos > 0. render_stat( ii_html = ii_html iv_count = lv_infos iv_type = 'info' iv_title = 'infos' ). ENDIF. render_stat( ii_html = ii_html iv_count = lv_infos + lv_errors + lv_warnings iv_type = 'all' iv_title = 'all' ). ii_html->add( '</div>' ). ENDMETHOD. METHOD render_success. ii_html->add( '<div class="dummydiv success">' ). ii_html->add( ii_html->icon( 'check' ) ). ii_html->add( iv_message ). ii_html->add( '</div>' ). ENDMETHOD. METHOD zif_abapgit_html_table~get_row_attrs. FIELD-SYMBOLS <ls_item> TYPE ty_result_view. ASSIGN is_row TO <ls_item>. rs_attrs-data-name = 'kind'. CASE <ls_item>-kind. WHEN 'E'. rs_attrs-data-value = 'error'. WHEN 'W'. rs_attrs-data-value = 'warning'. WHEN OTHERS. rs_attrs-data-value = 'info'. ENDCASE. ENDMETHOD. METHOD zif_abapgit_html_table~render_cell. FIELD-SYMBOLS <ls_item> TYPE ty_result_view. ASSIGN is_row TO <ls_item>. CASE iv_column_id. WHEN 'kind'. rs_render-content = |<span>{ <ls_item>-kind }</span>|. WHEN 'obj_type'. rs_render-content = <ls_item>-obj_type. WHEN 'location'. rs_render-content = zcl_abapgit_html=>create( )->a( iv_txt = <ls_item>-location iv_act = <ls_item>-nav iv_typ = zif_abapgit_html=>c_action_type-sapevent ). WHEN 'text'. rs_render-content = escape( val = <ls_item>-text format = cl_abap_format=>e_html_attr ). ENDCASE. ENDMETHOD. ENDCLASS. |