Skip to content

Commit 55735d8

Browse files
lucasborinEugen GüntherFrederik Hudákjan-jezek
authored
1.15.0 (#379)
* 1.15.0 * Update changelog.txt * CALL METHOD Usage does not check if the method call is dynamic (#397) * fixes #396 fixes #396 * Update changelog.txt * disabling fields (#395) * comment usage bugfix (#406) * bugfix * abaplint * small changes * some anti magic * unit test update * update * removal of constants * line break * Update changelog.txt Co-authored-by: Lucas Borin <[email protected]> * fixes #400 (#411) * fixes #400 * Update changelog.txt * False positive assert (#410) * fixes #400 * Update changelog.txt * Nesting Depth - Macro (#425) * resolves #422 * Update changelog.txt * Use | to assemble text (#416) * new check * Fixing Contains non 7 bit ascii character * Update changelog.txt * Update check_documentation.md * Update check_documentation.md * Create text-assembly.md * Update check_documentation.md * Update text-assembly.md * Update text-assembly.md * new name * new example * Update text-assembly.md * Prefer RETURNING to EXPORTING (#418) * new check * Update changelog.txt * exceptional cases * Update check_documentation.md * Create prefer-returning-to-exporting.md * Delete prefer-returning-to-exporting.md * Create prefer-returning-to-exporting.md * renaming file * Update prefer-returning-to-exporting.md * Variable "statement" not used * IF in IF. Use IF cond1 AND cond2 instead * adding example * Update equals-sign-chaining.md (#423) * Avoid Default Key (#414) * new check * skip comments and pragmas * Update check_documentation.md * Create avoid-default-key.md * Update changelog.txt * Make messages translatable (#428) * implements #420 * Update check_documentation.md * Update check_documentation.md * renaming * Create message-translation.md * new tests * Update changelog.txt * Update check_documentation.md * Update message-translation.md * simple-cspell (#432) * adding tool * Create main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Create main.yml * Create .cspell.json * Update main.yml * Update main.yml * Delete .cspell.json * Create cspell.json * Update main.yml * Delete cspell.json * Create cspell.json * Update main.yml * Update cspell.json * Update cspell.json * fixing typos * Delete .github/actions/spelling directory * Delete spelling.yml * typos * typo * Update cspell.json * master => main * typos * Update cspell.json * Update cspell.json * Update cspell.json * Update main.yml * Rename cspell.json to .cspell.json * Update bug-report.md * Update README.md * Update README.md * style guide -> clean abap * style guide -> clean abap * short urls * Update README.md * Update check-in-loop.md * Make Messages Easy to Find (#426) * new check * Escape SQL host variables * Line break multiple parameters * fixing hardcoded msgs * Update changelog.txt * Update check_documentation.md * fixing false positives * Create undetectable-message-statement.md * Update undetectable-message-statement.md * Update .cspell.json * renaming * Update check_documentation.md * Update and rename undetectable-message-statement.md to message-easy-to-find.md * Update message-easy-to-find.md * Fix syntax errors in code example (#435) method->methods definition public c is not a valid returning parameter (not fully typed) Co-authored-by: Eugen Günther <[email protected]> * Wrong pragma in example code (#434) Co-authored-by: Eugen Günther <[email protected]> * Update changelog.txt Adding fixes into the changelog: #434 #435 * Comment Usage Bug (#438) * enhancements * Missing space between string or character literal and parentheses * fixing issue detected in 1.15.0 (#439) * Update check_documentation.md Co-authored-by: Eugen Günther <[email protected]> Co-authored-by: Frederik Hudák <[email protected]> Co-authored-by: Jan Ježek <[email protected]>
1 parent 4e12476 commit 55735d8

File tree

73 files changed

+2132
-124
lines changed

Some content is hidden

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

73 files changed

+2132
-124
lines changed

.cspell.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// cSpell Settings
2+
{
3+
// Version of the setting file. Always 0.1
4+
"version": "0.1",
5+
// language - current active spelling language
6+
"language": "en",
7+
// words - list of words to be always considered correct
8+
"words": [
9+
"ABAP",
10+
"abap",
11+
"tadir",
12+
"Cyclomatic",
13+
"cyclomatic",
14+
"mandt",
15+
"delflag",
16+
"ENDLOOP",
17+
"ENDMETHOD",
18+
"symsgty",
19+
"INTF",
20+
"ENDINTERFACE",
21+
"ENDTRY",
22+
"ENDCLASS",
23+
"DDIC",
24+
"AMDP",
25+
"OSQL",
26+
"aunit",
27+
"ENDCATCH",
28+
"xsdbool",
29+
"SHORTDUMP",
30+
"SUBRC",
31+
"tabix",
32+
"imgs",
33+
"prio",
34+
"SCII",
35+
"SCI",
36+
"SATC",
37+
"SICF",
38+
"HANA",
39+
"SAP",
40+
"CLAS",
41+
"ENDFORM",
42+
"modularization",
43+
"ENDFUNCTION",
44+
"ENDDO",
45+
"NMBR",
46+
"OPTL",
47+
"ENDCASE",
48+
"itab",
49+
"reimplement",
50+
"USAG",
51+
"msgid",
52+
"msgty",
53+
"msgno",
54+
"UNDETEC"
55+
],
56+
// flagWords - list of words to be always considered incorrect
57+
// This is useful for offensive words and common spelling errors.
58+
// For example "hte" should be "the"
59+
"flagWords": [
60+
"hte"
61+
]
62+
}

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assignees: ''
77

88
---
99

10-
> 💡 Code pal for ABAP follows the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md) style guide. If the issue relates to coding style, please submit it [here](https://github.com/SAP/styleguides/issues).
10+
> 💡 Code pal for ABAP follows the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md). If the issue relates to coding style, please submit it [here](https://github.com/SAP/styleguides/issues).
1111
1212
**Check Name**
1313
> Use this section to identify the affected Check.

.github/workflows/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: lint
2+
3+
"on":
4+
pull_request:
5+
6+
jobs:
7+
spellcheck:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: zwaldowski/cspell-action@v1
12+
with:
13+
config: .cspell.json
14+
paths: "**/*.md"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![license](https://img.shields.io/github/license/SAP/code-pal-for-abap)](LICENSE)
55
[![REUSE status](https://api.reuse.software/badge/github.com/SAP/code-pal-for-abap)](https://api.reuse.software/info/github.com/SAP/code-pal-for-abap)
66

7-
Based on the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md) style guide, this tool contains a set of checks to guarantee the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md) adherence.
7+
Based on the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md), this tool contains a set of checks to guarantee the [Clean ABAP](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md) adherence.
88
Together, we both support you in writing a clean ABAP code.
99

1010
❣️ It's **free** and **open-source**.

changelog.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ Upgrade Note
1212
------------------
1313
Whenever you upgrade code pal for ABAP, it is highly recommended to execute the Y_CI_CHECK_REGISTRATION report to activate/reactivate the Checks (SE38 transaction) and regenerate the respective Code Inspector Variant (SCI transaction)
1414

15+
2021-05-XX v.1.15.0
16+
------------------
17+
+ Make Messages Easy to Find (#419)
18+
+ Make Messages Translatable (#420)
19+
+ Avoid DEFAULT KEY (#413)
20+
+ Prefer RETURNING to EXPORTING (#417)
21+
+ Use | to assemble text (#287)
22+
* Nesting Depth - Macro (#422)
23+
* False-Positive: Assert=>Fail (#400)
24+
* False-Positive: Generated Comments (#402)
25+
* CALL METHOD Usage does not check if the method call is dynamic (#396)
26+
* Pragma in the docu for "Interface in Class"
27+
* Code example in the docu for "Method Ouput Parameter"
28+
1529
2021-05-07 v.1.14.2
1630
------------------
1731
* Y_CHECK_UNIT_TEST_ASSERT: False-positive (#388)

docs/check_documentation.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## Check Documentation
66

7+
- [Avoid DEFAULT KEY](checks/avoid-default-key.md)
78
- [Boolean Input Parameter](checks/boolean-input-parameter.md)
89
- [CALL Method Usage](checks/call-method-usage.md)
910
- [Chain Declaration Usage](checks/chain-declaration-usage.md)
@@ -26,9 +27,11 @@
2627
- [External Call in Unit Test](checks/external-call-in-ut.md)
2728
- [FORM Routine Usage](checks/form-routine.md)
2829
- [FUNCTION Module Usage](checks/function-routine.md)
29-
- [Missing Interface](checks/interface-in-class.md)
3030
- [Magic Number Usage](checks/magic-number.md)
31+
- [Message Easy To Find](checks/message-easy-to-find.md)
32+
- [Message Translation](checks/message-translation.md)
3133
- [Method Return Bool](checks/method-return-bool.md)
34+
- [Missing Interface](checks/interface-in-class.md)
3235
- [Nesting Depth](checks/maximum-nesting-depth.md)
3336
- [Non-Class Exception Usage](checks/non-class-exception.md)
3437
- [Number of Attributes](checks/number-attributes.md)
@@ -39,6 +42,7 @@
3942
- [Number of Public Attributes](checks/number-public-attributes.md)
4043
- [Number of Output Parameter](checks/number-output-parameter.md)
4144
- [Prefer CASE to ELSEIF](checks/prefer-case-to-elseif.md)
45+
- [Prefer RETURNING to EXPORTING](checks/prefer-returning-to-exporting.md)
4246
- [Prefer IS NOT to NOT IS](checks/prefer-is-not-to-not-is.md)
4347
- [Prefer LINE_EXISTS or LINE_INDEX to READ TABLE or LOOP AT](checks/prefer-line-exists.md)
4448
- [Prefer NEW to CREATE OBJECT](checks/prefer-new-to-create-object.md)
@@ -51,5 +55,6 @@
5155
- [Scope of Variable](checks/scope-of-variable.md)
5256
- [Self-Reference](checks/self-reference.md)
5357
- [TEST-SEAM Statement Usage](checks/test-seam-usage.md)
58+
- [Text Assembly](checks/text-assembly.md)
5459
- [Unit-Test Coverages (Statement, Branch and Procedure)](checks/unit-test-coverages.md)
5560
- [Unit-Test Assert Validator](checks/unit_test_assert.md)

docs/checks/avoid-default-key.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[code pal for ABAP](../../README.md) > [Documentation](../check_documentation.md) > [Avoid DEFAULT KEY](avoid-default-key.md)
2+
3+
## Avoid DEFAULT KEY
4+
5+
### What is the Intent of the Check?
6+
7+
> Default keys are often only added to get the newer functional statements working. The keys themselves in fact are usually superfluous and waste resources for nothing. They can even lead to obscure mistakes because they ignore numeric data types. The `SORT` and `DELETE ADJACENT` statements without explicit field list will resort to the primary key of the internal table, which in case of usage of `DEFAULT KEY` can lead to very unexpected results when having e.g. numeric fields as component of the key, in particular in combination with `READ TABLE ... BINARY` etc.
8+
9+
Source: [Clean ABAP - Avoid DEFAULT KEY](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key).
10+
11+
Therefore, this check searches for the internal table definitions which forces the use of the default key.
12+
13+
### How to solve the issue?
14+
15+
> Either specify the key components explicitly
16+
> ```abap
17+
> DATA itab1 TYPE STANDARD TABLE OF row_type WITH NON-UNIQUE KEY comp1 comp2.
18+
> ```
19+
> or resort to `EMPTY KEY` if you don't need a key at all.
20+
> ```abap
21+
> DATA itab1 TYPE STANDARD TABLE OF row_type WITH EMPTY KEY.
22+
> ```
23+
24+
Source: [Clean ABAP - Avoid DEFAULT KEY](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key).
25+
26+
### What to do in case of exception?
27+
28+
In exceptional cases, you can suppress this finding by using the pseudo comment `"#EC DEFAULT_KEY` which has to be placed after the declaration:
29+
30+
```abap
31+
CLASS-DATA itab1 TYPE STANDARD TABLE OF row_type WITH DEFAULT KEY. "#EC DEFAULT_KEY
32+
```
33+
```abap
34+
DATA itab1 TYPE STANDARD TABLE OF row_type WITH DEFAULT KEY. "#EC DEFAULT_KEY
35+
```
36+
```abap
37+
TYPES: BEGIN OF type1, ' )
38+
non_unique TYPE STANDARD TABLE OF row_type WITH NON-UNIQUE KEY object,
39+
default_key TYPE STANDARD TABLE OF row_type WITH DEFAULT KEY, "#EC DEFAULT_KEY'
40+
empty_key TYPE STANDARD TABLE OF row_type WITH EMPTY KEY,
41+
END OF type1.
42+
```
43+
44+
### Example
45+
46+
Before the check:
47+
48+
```abap
49+
DATA itab1 TYPE STANDARD TABLE OF row_type WITH DEFAULT KEY.
50+
```
51+
52+
After the check:
53+
54+
```abap
55+
DATA itab1 TYPE STANDARD TABLE OF row_type WITH NON-UNIQUE KEY comp1 comp2.
56+
```
57+
```abap
58+
DATA itab1 TYPE STANDARD TABLE OF row_type WITH EMPTY KEY.
59+
```
60+
61+
### Further Readings & Knowledge
62+
63+
* [Clean ABAP: Avoid DEFAULT KEY](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key)

docs/checks/boolean-input-parameter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ After the check:
3737

3838
### Further Readings & Knowledge
3939

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)
40+
* [Clean ABAP: Boolean Input Parameter(s)](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#split-method-instead-of-boolean-input-parameter)

docs/checks/call-method-usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ class->method( ).
4040

4141
### Further Readings & Knowledge
4242

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)
43+
* [Clean ABAP: Avoid CALL METHOD Statement](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls)

docs/checks/chain-declaration-usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ DATA a TYPE c.
5151

5252
### Further Readings & Knowledge
5353

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)
54+
* [Clean ABAP: Do not chain up-front declarations](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#do-not-chain-up-front-declarations)

0 commit comments

Comments
 (0)