Skip to content

Commit b3ce674

Browse files
Update magic-number.md
1 parent ee02438 commit b3ce674

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

docs/checks/magic-number.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Magic Number Check](magic-number.md)
42

53
## Magic Number Usage Check
64

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

9-
The "Magic Number Usage" check searches for numbers which are present in the source code without being able to directly understand their meaning.
7+
This check searches for arbitrary values in the source code having no meaningful conotation.
108

119
Using magic numbers has disadvantages:
1210

@@ -15,28 +13,23 @@ Using magic numbers has disadvantages:
1513

1614
### How does the check work?
1715

18-
At the moment, the magic number check searches for numbers in the following statements only:
16+
It searches for numbers/values in the following statements:
1917

2018
1. `IF`
2119
2. `ELSEIF`
2220
3. `WHEN`
2321
4. `CHECK`
2422
5. `DO`
2523

26-
For now, Magic Numbers associated with `SY-SUBRC` are not considered in this check. In addition, the numbers `0` and `1` are ignored.
27-
28-
### Which attributes can be maintained?
29-
30-
![Attributes](./imgs/magic_number_usage.png)
24+
REMARK: Magic Numbers associated with `SY-SUBRC` are not considered by this check. In addition, the numbers `0` and `1` are ignored.
3125

3226
### How to solve the issue?
3327

34-
Create constants. By the name of the constants the number becomes a meaning which increases the readability. In addition, when maintaining the code, you only need to change the constant. This change can be done without the risk of introducing new errors or without forgetting some places where this change is required.
28+
Create constants. By the name of the constant the number becomes a meaning which increases the readability. In addition, when maintaining the code, you only need to change the constant. This change can be done without the risk of introducing new errors or without forgetting some places where this change is required.
3529

3630
### What to do in case of exception?
3731

38-
You can suppress Code Inspector findings generated by this check using the pseudo comment `"#EC CI_MAGIC`.
39-
The pseudo comment must be placed right after the statement containing the magic number.
32+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CI_MAGIC` which should be placed right after the statement containing the magic number:
4033

4134
```abap
4235
DO 5 TIMES. "#EC CI_MAGIC

0 commit comments

Comments
 (0)