Skip to content

Commit

Permalink
Check-47: DESTINATION parameter not recognized any more #1148 (#1152)
Browse files Browse the repository at this point in the history
Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
  • Loading branch information
BiberM and abaplint[bot] authored Jul 3, 2024
1 parent f168162 commit 2013088
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/checks/zcl_aoc_check_47.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ CLASS ZCL_AOC_CHECK_47 IMPLEMENTATION.
* MIT License

DATA: lv_include TYPE sobj_name,
lv_count TYPE i,
lv_fourth TYPE string,
lv_statement TYPE string.

FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements,
Expand All @@ -39,11 +41,19 @@ CLASS ZCL_AOC_CHECK_47 IMPLEMENTATION.
AND type <> io_scan->gc_statement-pragma.

CLEAR lv_statement.
CLEAR lv_fourth.
lv_count = 0.

LOOP AT io_scan->tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE type = io_scan->gc_token-identifier
OR type = io_scan->gc_token-literal.
lv_count = lv_count + 1.

IF lv_count = 4.
lv_fourth = <ls_token>-str.
ENDIF.

IF lv_statement IS INITIAL.
lv_statement = <ls_token>-str.
ELSE.
Expand All @@ -52,7 +62,12 @@ CLASS ZCL_AOC_CHECK_47 IMPLEMENTATION.
ENDIF.
ENDLOOP.

IF lv_statement CP 'CALL FUNCTION * DESTINATION *'
" The keyword DESTINATION needs to be checked only at fourth position
" as a parameter could also be named like the keyword (e.g. module GET_PRINT_PARAMETERS).
" This could have also been checked by a regex (when followed by or lead by '=' it is a parameter)
" but this would require a pretty high SAP_BASIS release.
IF lv_statement CP 'CALL FUNCTION *'
AND lv_fourth = 'DESTINATION'
AND lv_statement NP '* EXCEPTIONS * MESSAGE *'
AND lv_statement NP '* DESTINATION ''NONE'' *'.
lv_include = io_scan->get_include( <ls_statement>-level ).
Expand Down

0 comments on commit 2013088

Please sign in to comment.