Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (76 sloc) 2.5 KB
CLASS zcl_aoc_check_16 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_message_text
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_16 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_include TYPE sobj_name,
lv_ok TYPE token_row.
FIELD-SYMBOLS: <ls_token> LIKE LINE OF it_tokens,
<ls_statement> LIKE LINE OF it_statements.
LOOP AT it_statements ASSIGNING <ls_statement>
WHERE type <> scan_stmnt_type-empty
AND type <> scan_stmnt_type-macro_definition
AND type <> scan_stmnt_type-comment
AND type <> scan_stmnt_type-native_sql
AND type <> scan_stmnt_type-pragma
AND type <> scan_stmnt_type-comment_in_stmnt.
LOOP AT it_tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE type <> scan_token_type-comment
AND str <> ')'.
lv_ok = <ls_token>-row.
ENDLOOP.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
IF lv_ok <> <ls_statement>-trow.
READ TABLE it_tokens WITH KEY row = <ls_statement>-trow
type = scan_token_type-pragma TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
* allow if line contains pragma
CONTINUE.
ENDIF.
lv_include = get_include( p_level = <ls_statement>-level ).
inform( p_sub_obj_type = c_type_include
p_sub_obj_name = lv_include
p_line = <ls_statement>-trow
p_kind = mv_errty
p_test = myname
p_code = '001' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '016'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_errty = c_error.
ENDMETHOD. "CONSTRUCTOR
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'Line contains only "." or ")."'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD. "GET_MESSAGE_TEXT
ENDCLASS.
You can’t perform that action at this time.