Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude Checks for Test Code #628

Open
LuckySersh opened this issue Dec 19, 2024 · 0 comments
Open

Exclude Checks for Test Code #628

LuckySersh opened this issue Dec 19, 2024 · 0 comments
Labels
bug Something isn't working correctly

Comments

@LuckySersh
Copy link

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.

@LuckySersh LuckySersh added the bug Something isn't working correctly label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

1 participant