Skip to content

Exclude Checks for Test Code #628

Description

@LuckySersh

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions