Skip to content

Commit d5011ac

Browse files
authored
Merge pull request #307 from SAP/full_documentation_review
Full documentation review
2 parents 7e49c5f + 420493d commit d5011ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+211
-369
lines changed

docs/checks/boolean-input-parameter.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Boolean Input Parameter](boolean-input-parameter.md)
42

53
## Boolean Input Parameter
64

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

9-
Usage of boolean input parameters because they are often an indicator that a method does two things instead of one.
10-
Ps: Setter methods using boolean variables are ok.
7+
This check searches for the usage of boolean input parameters in a method signature. These parameters, could be an indicator of bad design where the Single Responsibility Principle is not followed (the method might be doing several things instead of a single thing).
8+
9+
REMARK: Setter methods using boolean input variables are acceptable.
1110

1211
### How to solve the issue?
1312

14-
Splitting the method may simplify the methods' code and describe the different intentions better.
13+
Splitting the method may simplify its code and provide a better description for the consumer.
1514

1615
### What to do in case of exception?
1716

18-
You can suppress Code Inspector findings generated by this check using the pseudo comment `"#EC BOOL_PARAM`.
19-
The pseudo comment has to be placed after the method declaration.
17+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC BOOL_PARAM` which has to be placed after the method declaration:
2018

2119
```abap
2220
METHODS update IMPORTING do_save TYPE abap_bool. "#EC BOOL_PARAM
@@ -34,9 +32,9 @@ After the check:
3432

3533
```abap
3634
METHODS update_without_saving.
37-
METHODS update_and_save.
35+
METHODS update_and_commit.
3836
```
3937

4038
### Further Readings & Knowledge
4139

42-
* [ABAP Styleguides on Clean Code](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#split-method-instead-of-boolean-input-parameter)
40+
* [ABAP Styleguides on Clean Code: Boolean Input Parameter(s)](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#split-method-instead-of-boolean-input-parameter)

docs/checks/call-method-usage.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [CALL METHOD Usage Check](call-method-usage.md)
42

53
## CALL METHOD Usage Check
64

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

9-
The "CALL METHOD Usage" check verifies the usage of the `CALL METHOD` ABAP statement. It is preferable not to call a method via this statement: CALL METHOD. Since it is preferable functional instead of procedural calls.
7+
This check verifies the usage of the `CALL METHOD` ABAP statement. It is preferable to call a method dynamically instead of via this statement: CALL METHOD. In other words, prefer a functional instead of a procedural call.
108

119
### How does the check work?
1210

13-
It simply checks if the code is using the `CALL METHOD` statement.
14-
15-
### Which attributes can be maintained?
16-
17-
![Attributes](./imgs/call_method_usage.png)
11+
It checks the usage of `CALL METHOD` statement in the code.
1812

1913
### How to solve the issue?
2014

21-
Change the long method calls using `CALL METHOD` statement to short method calls using parenthesis notation.
15+
Change the long method calls using `CALL METHOD` statement to short method calls using parenthesis notation (dynamic call).
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 CALL_METH_USAGE`. The pseudo comment has to be placed after the `CALL METHOD` statement.
19+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CALL_METH_USAGE` which has to be placed after the `CALL METHOD` statement:
2620

2721
```abap
2822
CALL METHOD method_name. "#EC CALL_METH_USAGE
@@ -46,4 +40,4 @@ class->method( ).
4640

4741
### Further Readings & Knowledge
4842

49-
* [ABAP Styleguides on Clean Code](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls)
43+
* [ABAP Styleguides on Clean Code: Avoid CALL METHOD Statement](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls)

docs/checks/chain-declaration-usage.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Chain Declaration Usage](chain-declaration-usage.md)
42

53
## Chain Declaration Usage
64

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

9-
The "Chain Declaration Usage" check verifies the usage of the chain up-front declarations.
7+
This check verifies the usage of chain up-front declarations.
108

119
### How to solve the issue?
1210

1311
Change the chain up-front declarations to inline declarations.
1412

1513
### What to do in case of exception?
1614

17-
You can suppress Code Inspector findings generated by this check using the pseudo comment `"#EC CHAIN_DECL_USAG`.
18-
The pseudo comment has to be placed after the `DATA:` statement.
15+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CHAIN_DECL_USAG` which should be placed after the `DATA:` statement:
1916

2017
```abap
2118
DATA: "#EC CHAIN_DECL_USAG
@@ -43,6 +40,15 @@ After the check:
4340
DATA client LIKE sy-mandt.
4441
```
4542

43+
Or even (which looks neat - but it won't be enforced):
44+
45+
```abap
46+
DATA var1 TYPE a.
47+
DATA var2 TYPE string.
48+
DATA my_var3 TYPE int.
49+
DATA a TYPE c.
50+
```
51+
4652
### Further Readings & Knowledge
4753

48-
* [ABAP Styleguides on Clean Code](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#do-not-chain-up-front-declarations)
54+
* [ABAP Styleguides on Clean Code: Do not chain up-front declarations](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#do-not-chain-up-front-declarations)

docs/checks/check-in-loop.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [CHECK in LOOP](check-in-loop.md)
42

53
## CHECK in LOOP
64

75
### What is the Intent of the Check?
8-
It verifies whether the `CHECK` statement is found inside of a `LOOP` statement. A CHECK within a LOOP, ends the current iteration and proceeds to the next one. This behaviour might lead to confusion: Does it end the method processing or does it exit the loop?
6+
This check verifies if a `CHECK` statement is being used inside of a `LOOP` structure. A CHECK within a LOOP, ends the current iteration and proceeds to the next one. This behaviour might lead to some confusion like: Does it end the method processing or does it exit the loop?
97

108
### How to solve the issue?
11-
Prefer using `CONTINUE` within an IF-Statement instead (since the keyword `CONTINUE` can only be used in loops, the intention is clear to everyone reading the code).
12-
Keep also in mind, the other Keywords like `EXIT` and `RETURN` are also more explicit.
9+
Prefer using `CONTINUE` (within an IF-Statement) instead of using the CHECK Statement in this case. Since the keyword `CONTINUE` can only be used in LOOPS, the intention is then automatic clear to everyone reading the code.
10+
Keep also in mind, that other Keywords like: `EXIT` or `RETURN` are also more explicit than `CHECK`.
1311

1412
### What to do in case of exception?
15-
In special cases you can suppress this finding by using the pseudo comment `"#EC CHECK_IN_LOOP`.
13+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CHECK_IN_LOOP` which should be placed after the `CHECK` Statement itself:
1614

1715
```abap
1816
LOOP AT tadir ASSIGNING FIELD-SYMBOL(<tadir>).
@@ -38,5 +36,5 @@ ENDLOOP.
3836
```
3937

4038
### Further Readings & Knowledge
41-
- [Avoid CHECK in other positions (Clean ABAP)](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#avoid-check-in-other-positions)
39+
- [ABAP Stylegruides on Clean Code: Avoid CHECK in other positions](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#avoid-check-in-other-positions)
4240
- [Exiting Loops -> Check](https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcheck_loop.htm)

docs/checks/check-statement-position.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [CHECK Statement Position Check](check-statement-position.md)
42

53
## CHECK Statement Position Check
64

75
### What is the Intent of the Check?
8-
It verifies whether the `CHECK` statement is the first statement within a method, function-module, or form-routine.
6+
This check verifies whether the `CHECK` statement is the very first statement within a method, function-module or form-routine.
97

108
The [Clean ABAP](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#avoid-check-in-other-positions) says:
119
> Do not use `CHECK` outside of the initialization section of a method. The statement behaves differently in different positions and may lead to unclear, unexpected effects.
1210
11+
REMARKS:
12+
1. CHECK statement inside of LOOPs will be disregard by check (for that, refer to: CHECK_IN_LOOP).
13+
2. The usage of CLEAR statement prior to CHECK statement is considered to be a bad coding practice! This is actually a workaround in bad designed code (against OO scope principles).
14+
3. DATA declarations (DATA / FIELD-SYMBOLS when not dynamic declared – inline declarations), might also come before the keyword CHECK.
15+
1316
### How to solve the issue?
1417
The `CHECK` statement shall be the first statement of a method. If it is not possible, try to substitute this keyword with an IF-statement instead.
1518

1619
### What to do in case of exception?
17-
In special cases you can suppress this finding by using the pseudo comment `"#EC CHECK_POSITION`.
20+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CHECK_POSITION` which has to be placed after the `CHECK` statement:
21+
22+
```abap
23+
METHOD example.
24+
some code...
25+
CHECK condition = abap_true. "#EC CHECK_POSITION
26+
```
1827

1928
### Example
2029
Before the check:
@@ -36,6 +45,8 @@ METHOD example.
3645
...
3746
ENDMETHOD.
3847
```
48+
OR
49+
3950
```abap
4051
METHOD example.
4152
CHECK sy-mandt = 000.
@@ -44,4 +55,4 @@ ENDMETHOD.
4455
```
4556

4657
### Further Readings & Knowledge
47-
- [Avoid CHECK in other positions (Clean ABAP)](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#avoid-check-in-other-positions)
58+
- [ABAP Styleguides on Clean Code: Avoid CHECK in other positions (Clean ABAP)](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#avoid-check-in-other-positions)

docs/checks/comment-position.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Comment Position](comment-position.md)
42

53
## Comment Position
64

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

9-
Quote comments indent along with the statements they comment.
7+
This check searches for "Quote comments" which are not indented along with the statements they belong to.
108

119
### How to solve the issue?
1210

13-
Identing the comments along with the statements.
11+
You should indent the comments along with the statements they are commenting.
1412

1513
### Example
1614

docs/checks/comment-type.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Comment Type](comment-type.md)
42

53
## Comment Type
64

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

9-
Comments with `"`, not with `*`, because asterisked comments tend to indent to weird places.
7+
This check searches for comments in the code marked up with `"` instead of with `*`. Comments marked up with an asterisk tend to be indented to weird/uncontrolled places.
108

119
### How to solve the issue?
1210

13-
Replacing the comment type from `*` to `"`.
11+
You should replace the comment sign from `*` to `"`.
1412

1513
### Example
1614

@@ -38,4 +36,4 @@ After the check:
3836

3937
### Further Readings & Knowledge
4038

41-
* [ABAP Styleguides on Clean Code](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#comment-with--not-with-)
39+
* [ABAP Styleguides on Clean Code: Comment sign](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#comment-with--not-with-)

docs/checks/comment-usage.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
# code pal for ABAP
2-
31
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Comment Usage Check](comment-usage.md)
42

53
## Comment Usage Check
64

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

9-
The “Comment Usage” Check is part of the Clean Code Check Repository. Express yourself in code, not in comments. Clean Code does not forbid you to comment your code - it encourages you to exploit better means, and resort to comments only if that fails.
7+
This check searches for comments in the code. Clean Code principles do not forbid you to comment your code - but it encourages you to exploit better means, meaningful names and resort to comments only if that fails. Express yourself in code, not in comments.
108

119
### How does the check work?
1210

13-
This check calculates the percentage of comments in relation to the absolute number of statements (productive code).
14-
15-
### Which attributes can be maintained?
16-
17-
![Attributes](./imgs/comment_usage.png)
11+
This check calculates an indicator; precisely, the percentage of comments in relation to the absolute number of real statements (productive code).
1812

1913
### How to solve the issue?
2014

21-
Remove unimportant comments.
15+
Remove unimportant and/or unnecessary comments.
2216

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

25-
There should be no exception as the check works as an indication. Thus, it is also not possible to suppress Code Inspector findings from this check.
19+
There is no exception for this check since it works as an indicator only. Thus, it is also not possible to suppress its findings.
2620

2721
### Further Readings & Knowledge
2822

29-
* [ABAP Styleguides on Clean Code](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#express-yourself-in-code-not-in-comments)
23+
* [ABAP Styleguides on Clean Code: Less is more](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#express-yourself-in-code-not-in-comments)

docs/checks/constants-interface.md

Lines changed: 2 additions & 9 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) > [Constants Interface Check](constants-interface.md)
42

53
## Constants Interface Check
64

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

9-
To avoid the creation and usage of an interface object for merely definying contants.
7+
This check intends to avoid the creation and usage of an interface object for merely definying contants.
108
You should always prefer [enumeration classes](https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#prefer-enumeration-classes-to-constants-interfaces) to constants interfaces.
119

1210
```abap
@@ -34,18 +32,13 @@ ENDCLASS.
3432

3533
The "Constant Interface" check searches for interfaces containing only constants.
3634

37-
### Which attributes can be maintained?
38-
39-
![Attributes](./imgs/constants_interface.png)
40-
4135
### How to solve the issue?
4236

4337
Use enumeration classes instead.
4438

4539
### What to do in case of exception?
4640

47-
In special cases, it is possible to suppress a finding by using the pseudo comment `"#EC CONS_INTF`.
48-
The pseudo comment must be placed right after the class definition header.
41+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC CONS_INTF` which should be placed right after the class definition header:
4942

5043
### Example
5144

docs/checks/cx-root-usage.md

Lines changed: 2 additions & 8 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) > [CX_ROOT Usage Check](cx-root-usage.md)
42

53
## CX_ROOT Usage Check
64

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

9-
The “CX_ROOT Usage" Check searches for merely "CX_ROOT" exceptions being directly used in the code (e.g.: In a TRY-CATCH block).
7+
This check searches for direct "CX_ROOT" exceptions being used in the code (e.g.: In a TRY-CATCH block).
108

119
### How does the check work?
1210

@@ -27,17 +25,13 @@ CLASS cx_my_exception DEFINITION INHERITING FROM cx_root.
2725
ENDCLASS.
2826
```
2927

30-
### Which attributes can be maintained?
31-
32-
![Attributes](./imgs/cx_root_usage.png)
33-
3428
### How to solve the issue?
3529

3630
The solution is to use well defined and specific class-based exceptions.
3731

3832
### What to do in case of exception?
3933

40-
In special cases you can suppress this Check’s finding by using the pseudo comment `“#EC NEED_CX_ROOT`.
34+
In exceptional cases, you can suppress this finding by using the pseudo comment `“#EC NEED_CX_ROOT` which should be placed after the CATCH statement:
4135

4236
```abap
4337
TRY.

0 commit comments

Comments
 (0)