Skip to content

Commit 3ce6e4c

Browse files
Update number-public-attributes.md
1 parent f6250eb commit 3ce6e4c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

docs/checks/number-public-attributes.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Number of Public Attributes Check](number-public-attributes.md)
42

53
## Number of Public Attributes Check
64

75
### What is the Intent of the Check?
86

9-
The "Number of Public Attributes" Check counts the number of public attributes. All attributes should be private (by default) or protected (if needed). The [data encapsulation principle](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)) helps you to protect your attributes from being changed and adds readability for others; the basic principle: ["One only sees what is needed"](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed).
7+
This check counts the number of public attributes. All attributes should be private (by default) or protected (if needed). The [data encapsulation principle](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)) helps you to protect your attributes from being changed and adds readability for others; the basic principle: ["One only sees what is needed"](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed).
108

119
### How does the check work?
1210

1311
This Check counts only `DATA` and `CLASS-DATA` within a global or local, `CLASS DEFINITION` or `INTERFACE`. Inherited attributes and `CONSTANTS` aren't counted. A structure is counted as one attribute, no matter how many attributes are in the structure.
1412

15-
### Which attributes can be maintained?
16-
17-
![Attributes](./imgs/number_of_public_attributes.png)
18-
1913
### How to solve the issue?
2014

2115
Make those attributes `PRIVATE` or `PROTECTED`. You can grant the read access with a getter method (for example, `get_user_first_name`). With a setter, you can also grant write access and have the possibility to validate the inserted data (for example, `set_time_in_seconds` with a test to allow only positive numbers).
2216

2317
### What to do in case of exception?
2418

25-
You can suppress Code Inspector findings generated by this check using the pseudo comment `"#EC NUM_PUBLIC_ATTR`.
26-
The pseudo comment must be placed right after the class definition header.
19+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC NUM_PUBLIC_ATTR` which should be placed right after the class definition header:
2720

2821
```abap
2922
CLASS class_name DEFINITION. "#EC NUM_PUBLIC_ATTR

0 commit comments

Comments
 (0)