Check Name
Empty Catch
Number of Public Attributes
Actual Behavior
Although the checks are set up for production code only (we exluded the test code for these checks), we keep receiving findings from unit tests.
Expected Behavior
Exclude unit tests from these checks according to the configuration.
Possible solution
In the method IS_STATEMENT_IN_AUNIT_TAB of the class Y_CHECK_BASE it is assumed that the table for unit tests is already filled which is not the case.
TRY.
" Local Test Class
aunit = ref_scan->aunit_tab[ incl_name = include ].
CATCH cx_sy_itab_line_not_found.
" Global Test Class
aunit = ref_scan->aunit_tab[ incl_name = program_name ].
ENDTRY.
One possible solution could be adding
IF ref_scan->aunit_tab_determined = abap_false.
ref_scan->determine_aunit_lines( ).
ENDIF.
into the method INSTANTIATE_OBJECTS of the same class after the verification IF ref_scan IS INITIAL.
Check Name
Actual Behavior
Expected Behavior
Possible solution
into the method
INSTANTIATE_OBJECTSof the same class after the verificationIF ref_scan IS INITIAL.