SAP / SAP/code-pal-for-abap

[Number of Public Attributes Check] Should ignore local test doubles

Open
#471 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
ABAP
Stars
435
Forks
77
PR merge metrics
No merged PRs in 30d

Description

💡 Code pal for ABAP follows the Clean ABAP. If the issue relates to coding style, please submit it here.

Check Name
Number of Public Attributes Check

Actual Behavior
The current check also covers and reports findings for local test doubles, like the following:

CLASS ltd_my_double DEFINITION FOR TESTING.

  PUBLIC SECTION.
    INTERFACES if_my_interface.

    DATA mv_my_injected_attribute TYPE string.
ENDCLASS.

As an explanation: According to this test design pattern, the double behavior is controlled by these attributes. In addition, getter/setters are not needed due to the locality and the scope of the test fixture.

Still, the application of this pattern is reported by the check.

Expected Behavior
The check should ignore local classes for testing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the implementation of the Number of Public Attributes Check and the tests covering local test doubles. Start by tracing how local classes declared FOR TESTING are represented, then verify that their public attributes are excluded while ordinary classes remain checked. Done means the regression behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Domain
testing, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.