Skip to content

Commit

Permalink
Check 34 ignores single line comments (#1121)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Sebastian Stein <[email protected]>
Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 6, 2023
1 parent 108836f commit 410c25b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/checks/zcl_aoc_check_34.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CLASS ZCL_AOC_CHECK_34 IMPLEMENTATION.
lv_start = 0.
WHEN OTHERS.
IF <ls_statement>-type = io_scan->gc_statement-comment.
lv_comment_lines = lv_comment_lines + <ls_statement>-to - <ls_statement>-from.
lv_comment_lines = lv_comment_lines + <ls_statement>-to - <ls_statement>-from + 1.
ENDIF.
ENDCASE.

Expand Down
21 changes: 20 additions & 1 deletion src/checks/zcl_aoc_check_34.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ CLASS ltcl_test DEFINITION FOR TESTING
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test001_04 FOR TESTING RAISING cx_static_check,
test001_05 FOR TESTING RAISING cx_static_check.
test001_05 FOR TESTING RAISING cx_static_check,
test001_06 FOR TESTING RAISING cx_static_check.

ENDCLASS. "lcl_Test

Expand Down Expand Up @@ -151,4 +152,22 @@ CLASS ltcl_test IMPLEMENTATION.

ENDMETHOD.

METHOD test001_06.
* ===========
mo_check->mv_incl_comments = abap_false.
mo_check->mv_lines = 5.

_code 'CASE lv_foo.'.
_code ' WHEN ''bar''.'.
_code ' WRITE: ''hello''.'.
_code ' WRITE: ''hello''.'.
_code '*.'.
_code ' WRITE: ''hello''.'.
_code ' WRITE: ''hello''.'.
_code 'ENDCASE.'.

ms_result = zcl_aoc_unit_test=>check( mt_code ).

cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
ENDCLASS. "lcl_Test

0 comments on commit 410c25b

Please sign in to comment.