@abaplint/core 2.119.49 → 2.119.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/abap/2_statements/expressions/_derived_types.js +53 -0
- package/build/src/abap/2_statements/expressions/type_structure.js +8 -16
- package/build/src/abap/2_statements/expressions/type_table.js +4 -1
- package/build/src/abap/5_syntax/basic_types.js +2 -15
- package/build/src/registry.js +1 -1
- package/build/src/rules/avoid_use.js +2 -0
- package/build/src/rules/class_attribute_names.js +8 -0
- package/build/src/rules/constructor_visibility_public.js +8 -0
- package/build/src/rules/dangerous_statement.js +2 -0
- package/build/src/rules/db_operation_in_loop.js +11 -0
- package/build/src/rules/exit_or_check.js +6 -0
- package/build/src/rules/form_tables_obsolete.js +4 -0
- package/build/src/rules/function_module_recommendations.js +4 -0
- package/build/src/rules/line_length.js +3 -0
- package/build/src/rules/local_class_naming.js +4 -0
- package/build/src/rules/method_parameter_names.js +6 -0
- package/build/src/rules/no_aliases.js +7 -0
- package/build/src/rules/no_comments_between_methods.js +15 -1
- package/build/src/rules/no_public_attributes.js +8 -0
- package/build/src/rules/prefix_is_current_class.js +8 -0
- package/build/src/rules/static_call_via_instance.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commonDerivedTypes = commonDerivedTypes;
|
|
4
|
+
exports.derivedTypesAlt = derivedTypesAlt;
|
|
5
|
+
const combi_1 = require("../combi");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const version_1 = require("../../../version");
|
|
8
|
+
function commonDerivedTypes() {
|
|
9
|
+
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
10
|
+
// more-specific keyword phrases (e.g. "FAILED LATE") must precede less-specific ones ("FAILED")
|
|
11
|
+
return [
|
|
12
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity)),
|
|
13
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity)),
|
|
14
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity)),
|
|
15
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity)),
|
|
16
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity)),
|
|
17
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity)),
|
|
18
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity)),
|
|
19
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity)),
|
|
20
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity)),
|
|
21
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity)),
|
|
22
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity)),
|
|
23
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity)),
|
|
24
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity)),
|
|
25
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity)),
|
|
26
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity)),
|
|
27
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity)),
|
|
28
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity)),
|
|
29
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity)),
|
|
30
|
+
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity)),
|
|
31
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity)),
|
|
32
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity)),
|
|
33
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity)),
|
|
34
|
+
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity)),
|
|
35
|
+
(0, combi_1.seq)("READ IMPORT", entity),
|
|
36
|
+
(0, combi_1.seq)("READ RESULT", entity),
|
|
37
|
+
(0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity)),
|
|
38
|
+
(0, combi_1.seq)("CREATE", entity),
|
|
39
|
+
(0, combi_1.seq)("DELETE", entity),
|
|
40
|
+
(0, combi_1.seq)("UPDATE", entity),
|
|
41
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity)),
|
|
42
|
+
(0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity)),
|
|
43
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity)),
|
|
44
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity)),
|
|
45
|
+
(0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity)),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
function derivedTypesAlt(...extra) {
|
|
49
|
+
const all = [...extra, ...commonDerivedTypes()];
|
|
50
|
+
const [first, second, ...rest] = all;
|
|
51
|
+
return (0, combi_1.altPrio)(first, second, ...rest);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=_derived_types.js.map
|
|
@@ -3,24 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TypeStructure = void 0;
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
const _1 = require(".");
|
|
6
|
+
const version_1 = require("../../../version");
|
|
7
|
+
const _derived_types_1 = require("./_derived_types");
|
|
6
8
|
class TypeStructure extends combi_1.Expression {
|
|
7
9
|
getRunnable() {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const action = (0, combi_1.seq)("ACTION IMPORT", _1.Source);
|
|
15
|
-
const permissionsRequest = (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName);
|
|
16
|
-
const evt = (0, combi_1.seq)("EVENT", _1.EventName);
|
|
17
|
-
const failedEarly = (0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName);
|
|
18
|
-
const mappedEarly = (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName);
|
|
19
|
-
const reportedEarly = (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName);
|
|
20
|
-
const structure = (0, combi_1.seq)("STRUCTURE FOR", (0, combi_1.altPrio)(hier, evt, create, update, action, permissionsRequest, readLink, readResult));
|
|
21
|
-
const response = (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)(failedEarly, mappedEarly, reportedEarly));
|
|
22
|
-
const request = (0, combi_1.seq)("REQUEST FOR CHANGE", _1.NamespaceSimpleName);
|
|
23
|
-
return (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(structure, response, request));
|
|
10
|
+
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
11
|
+
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity)), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity)), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity)), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity)), (0, combi_1.seq)("PERMISSIONS REQUEST", _1.NamespaceSimpleName), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity)), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
|
|
12
|
+
const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes));
|
|
13
|
+
const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))));
|
|
14
|
+
const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName));
|
|
15
|
+
return (0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(structure, response, request), (0, combi_1.optPrio)("VALUE IS INITIAL"));
|
|
24
16
|
}
|
|
25
17
|
}
|
|
26
18
|
exports.TypeStructure = TypeStructure;
|
|
@@ -6,6 +6,7 @@ const _1 = require(".");
|
|
|
6
6
|
const field_chain_1 = require("./field_chain");
|
|
7
7
|
const type_table_key_1 = require("./type_table_key");
|
|
8
8
|
const version_1 = require("../../../version");
|
|
9
|
+
const _derived_types_1 = require("./_derived_types");
|
|
9
10
|
class TypeTable extends combi_1.Expression {
|
|
10
11
|
getRunnable() {
|
|
11
12
|
const header = "WITH HEADER LINE";
|
|
@@ -19,7 +20,9 @@ class TypeTable extends combi_1.Expression {
|
|
|
19
20
|
// "WITH" is not allowed as a field name in keys
|
|
20
21
|
const typetable = (0, combi_1.alt)(generic, (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))), (0, combi_1.optPrio)("VALUE IS INITIAL")));
|
|
21
22
|
const occurs = (0, combi_1.seq)("OCCURS", (0, combi_1.altPrio)(_1.Integer, field_chain_1.FieldChain));
|
|
22
|
-
const
|
|
23
|
+
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
24
|
+
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity)), (0, combi_1.seq)("READ LINK", entity), (0, combi_1.seq)("EVENT", entity));
|
|
25
|
+
const derived = (0, combi_1.ver)(version_1.Release.v770, (0, combi_1.seq)("TABLE FOR", derivedTypes, (0, combi_1.optPrio)("VALUE IS INITIAL")), { also: combi_1.AlsoIn.OpenABAP });
|
|
23
26
|
const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
24
27
|
const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
25
28
|
const typeLine = (0, combi_1.seq)("LINE OF", _1.TypeName, occurs, header);
|
|
@@ -684,25 +684,12 @@ class BasicTypes {
|
|
|
684
684
|
return name.includes("\\") || name.includes("~");
|
|
685
685
|
}
|
|
686
686
|
isRAPTableFor(text) {
|
|
687
|
-
return text.startsWith("TYPE TABLE FOR
|
|
688
|
-
|| text.startsWith("TYPE TABLE FOR ACTION RESULT ")
|
|
689
|
-
|| text.startsWith("TYPE TABLE FOR CREATE ")
|
|
690
|
-
|| text.startsWith("TYPE TABLE FOR DELETE ")
|
|
691
|
-
|| text.startsWith("TYPE TABLE FOR DETERMINATION ")
|
|
692
|
-
|| text.startsWith("TYPE TABLE FOR EVENT ")
|
|
693
|
-
|| text.startsWith("TYPE TABLE FOR FAILED ")
|
|
694
|
-
|| text.startsWith("TYPE TABLE FOR FAILED EARLY ")
|
|
695
|
-
|| text.startsWith("TYPE TABLE FOR LOCK ")
|
|
696
|
-
|| text.startsWith("TYPE TABLE FOR READ ")
|
|
697
|
-
|| text.startsWith("TYPE TABLE FOR READ IMPORT ")
|
|
698
|
-
|| text.startsWith("TYPE TABLE FOR READ RESULT ")
|
|
699
|
-
|| text.startsWith("TYPE TABLE FOR REPORTED EARLY ")
|
|
700
|
-
|| text.startsWith("TYPE TABLE FOR UPDATE ");
|
|
687
|
+
return text.startsWith("TYPE TABLE FOR ");
|
|
701
688
|
}
|
|
702
689
|
isRAPTypeStructure(text) {
|
|
703
690
|
return text.startsWith("TYPE STRUCTURE FOR ")
|
|
704
691
|
|| text.startsWith("TYPE RESPONSE FOR ")
|
|
705
|
-
|| text.startsWith("TYPE REQUEST FOR
|
|
692
|
+
|| text.startsWith("TYPE REQUEST FOR ");
|
|
706
693
|
}
|
|
707
694
|
// todo, rewrite this method
|
|
708
695
|
resolveTypeChain(expr) {
|
package/build/src/registry.js
CHANGED
|
@@ -89,6 +89,8 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
|
|
|
89
89
|
|
|
90
90
|
BREAK points`,
|
|
91
91
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
92
|
+
badExample: `DESCRIBE TABLE items LINES count.`,
|
|
93
|
+
goodExample: `count = lines( items ).`,
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
getDescription(statement) {
|
|
@@ -37,6 +37,14 @@ class ClassAttributeNames extends _abap_rule_1.ABAPRule {
|
|
|
37
37
|
title: "Class attributes naming",
|
|
38
38
|
shortDescription: `Allows you to enforce a pattern, such as a prefix, for class variable names.`,
|
|
39
39
|
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
|
|
40
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
41
|
+
PUBLIC SECTION.
|
|
42
|
+
DATA counter TYPE i.
|
|
43
|
+
ENDCLASS.`,
|
|
44
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
45
|
+
PUBLIC SECTION.
|
|
46
|
+
DATA mv_counter TYPE i.
|
|
47
|
+
ENDCLASS.`,
|
|
40
48
|
};
|
|
41
49
|
}
|
|
42
50
|
getDescription(actual, expected) {
|
|
@@ -24,6 +24,14 @@ This only applies to global classes.
|
|
|
24
24
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public
|
|
25
25
|
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,
|
|
26
26
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
27
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC CREATE PRIVATE.
|
|
28
|
+
PRIVATE SECTION.
|
|
29
|
+
METHODS constructor.
|
|
30
|
+
ENDCLASS.`,
|
|
31
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC CREATE PRIVATE.
|
|
32
|
+
PUBLIC SECTION.
|
|
33
|
+
METHODS constructor.
|
|
34
|
+
ENDCLASS.`,
|
|
27
35
|
};
|
|
28
36
|
}
|
|
29
37
|
getMessage() {
|
|
@@ -79,6 +79,8 @@ class DangerousStatement extends _abap_rule_1.ABAPRule {
|
|
|
79
79
|
extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,
|
|
80
80
|
dynamic SQL can potentially create SQL injection problems`,
|
|
81
81
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
82
|
+
badExample: `SELECT * FROM (lv_table_name) INTO TABLE @DATA(lt_rows).`,
|
|
83
|
+
goodExample: `SELECT * FROM zknown_table INTO TABLE @DATA(lt_rows).`,
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
getDescription(statement) {
|
|
@@ -54,6 +54,17 @@ class DbOperationInLoop extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
title: "Database operation in loop",
|
|
55
55
|
shortDescription: `Database operation in LOOP/DO/WHILE`,
|
|
56
56
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],
|
|
57
|
+
badExample: `LOOP AT lt_items INTO DATA(ls_item).
|
|
58
|
+
SELECT SINGLE name FROM zcustomer INTO @DATA(lv_name) WHERE id = @ls_item-customer_id.
|
|
59
|
+
ENDLOOP.`,
|
|
60
|
+
goodExample: `ASSERT lines( lt_items ) > 0.
|
|
61
|
+
SELECT id, name FROM zcustomer INTO TABLE @DATA(lt_customers)
|
|
62
|
+
FOR ALL ENTRIES IN @lt_items
|
|
63
|
+
WHERE id = @lt_items-customer_id.
|
|
64
|
+
|
|
65
|
+
LOOP AT lt_items INTO DATA(ls_item).
|
|
66
|
+
READ TABLE lt_customers INTO DATA(ls_customer) WITH KEY id = ls_item-customer_id.
|
|
67
|
+
ENDLOOP.`,
|
|
57
68
|
};
|
|
58
69
|
}
|
|
59
70
|
getConfig() {
|
|
@@ -63,6 +63,12 @@ Use RETURN to leave procesing blocks instead.`,
|
|
|
63
63
|
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
64
64
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,
|
|
65
65
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
66
|
+
badExample: `CHECK is_valid = abap_true.
|
|
67
|
+
do_something( ).`,
|
|
68
|
+
goodExample: `IF is_valid = abap_false.
|
|
69
|
+
RETURN.
|
|
70
|
+
ENDIF.
|
|
71
|
+
do_something( ).`,
|
|
66
72
|
};
|
|
67
73
|
}
|
|
68
74
|
getConfig() {
|
|
@@ -55,6 +55,10 @@ class FormTablesObsolete extends _abap_rule_1.ABAPRule {
|
|
|
55
55
|
shortDescription: `Checks for TABLES parameters in forms.`,
|
|
56
56
|
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapform_tables.htm`,
|
|
57
57
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
58
|
+
badExample: `FORM update_items TABLES items.
|
|
59
|
+
ENDFORM.`,
|
|
60
|
+
goodExample: `FORM update_items CHANGING items TYPE ty_items.
|
|
61
|
+
ENDFORM.`,
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
64
|
getMessage() {
|
|
@@ -110,6 +110,10 @@ class FunctionModuleRecommendations extends _abap_rule_1.ABAPRule {
|
|
|
110
110
|
shortDescription: `Suggests replacements for various function modules`,
|
|
111
111
|
extendedInformation: `https://docs.abapopenchecks.org/checks/53/`,
|
|
112
112
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
113
|
+
badExample: `CALL FUNCTION 'GUID_CREATE'
|
|
114
|
+
IMPORTING
|
|
115
|
+
ev_guid_32 = guid.`,
|
|
116
|
+
goodExample: `guid = cl_system_uuid=>create_uuid_c32_static( ).`,
|
|
113
117
|
};
|
|
114
118
|
}
|
|
115
119
|
getConfig() {
|
|
@@ -27,6 +27,9 @@ class LineLength extends _abap_rule_1.ABAPRule {
|
|
|
27
27
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#stick-to-a-reasonable-line-length
|
|
28
28
|
https://docs.abapopenchecks.org/checks/04/`,
|
|
29
29
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
30
|
+
badExample: "DATA long_text TYPE string VALUE 'this line keeps going until it is longer than the configured maximum'.",
|
|
31
|
+
goodExample: `DATA long_text TYPE string.
|
|
32
|
+
long_text = 'split long expressions across multiple lines'.`,
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
getConfig() {
|
|
@@ -30,6 +30,10 @@ class LocalClassNaming extends _abap_rule_1.ABAPRule {
|
|
|
30
30
|
title: "Local class naming conventions",
|
|
31
31
|
shortDescription: `Allows you to enforce a pattern, such as a prefix, for local class names.`,
|
|
32
32
|
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
|
|
33
|
+
badExample: `CLASS helper DEFINITION.
|
|
34
|
+
ENDCLASS.`,
|
|
35
|
+
goodExample: `CLASS lcl_helper DEFINITION.
|
|
36
|
+
ENDCLASS.`,
|
|
33
37
|
};
|
|
34
38
|
}
|
|
35
39
|
getDescription(expected, actual) {
|
|
@@ -34,6 +34,12 @@ class MethodParameterNames {
|
|
|
34
34
|
title: "Method parameter naming conventions",
|
|
35
35
|
shortDescription: `Allows you to enforce a pattern, such as a prefix, for method parameter names`,
|
|
36
36
|
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
|
|
37
|
+
badExample: `METHODS get_name
|
|
38
|
+
IMPORTING customer TYPE string
|
|
39
|
+
RETURNING VALUE(name) TYPE string.`,
|
|
40
|
+
goodExample: `METHODS get_name
|
|
41
|
+
IMPORTING iv_customer TYPE string
|
|
42
|
+
RETURNING VALUE(rv_name) TYPE string.`,
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
getDescription(expected, actual) {
|
|
@@ -25,6 +25,13 @@ class NoAliases extends _abap_rule_1.ABAPRule {
|
|
|
25
25
|
title: "No ALIASES",
|
|
26
26
|
shortDescription: `Detects use of the ALIAS statement`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
28
|
+
badExample: `INTERFACE lif_foo.
|
|
29
|
+
METHODS long_method_name.
|
|
30
|
+
ALIASES short FOR long_method_name.
|
|
31
|
+
ENDINTERFACE.`,
|
|
32
|
+
goodExample: `INTERFACE lif_foo.
|
|
33
|
+
METHODS long_method_name.
|
|
34
|
+
ENDINTERFACE.`,
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
getConfig() {
|
|
@@ -53,8 +53,22 @@ class NoCommentsBetweenMethods extends _abap_rule_1.ABAPRule {
|
|
|
53
53
|
return {
|
|
54
54
|
key: "no_comments_between_methods",
|
|
55
55
|
title: "No comments between methods in global classes",
|
|
56
|
-
shortDescription: `
|
|
56
|
+
shortDescription: `It's not possible to have comments between methods in global classes.`,
|
|
57
57
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Syntax],
|
|
58
|
+
badExample: `CLASS zcl_foo IMPLEMENTATION.
|
|
59
|
+
METHOD first.
|
|
60
|
+
ENDMETHOD.
|
|
61
|
+
" comment
|
|
62
|
+
METHOD second.
|
|
63
|
+
ENDMETHOD.
|
|
64
|
+
ENDCLASS.`,
|
|
65
|
+
goodExample: `CLASS zcl_foo IMPLEMENTATION.
|
|
66
|
+
METHOD first.
|
|
67
|
+
ENDMETHOD.
|
|
68
|
+
|
|
69
|
+
METHOD second.
|
|
70
|
+
ENDMETHOD.
|
|
71
|
+
ENDCLASS.`,
|
|
58
72
|
};
|
|
59
73
|
}
|
|
60
74
|
getConfig() {
|
|
@@ -31,6 +31,14 @@ class NoPublicAttributes extends _abap_rule_1.ABAPRule {
|
|
|
31
31
|
Exceptions are excluded from this rule.`,
|
|
32
32
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed`,
|
|
33
33
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
34
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
35
|
+
PUBLIC SECTION.
|
|
36
|
+
DATA counter TYPE i.
|
|
37
|
+
ENDCLASS.`,
|
|
38
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
39
|
+
PRIVATE SECTION.
|
|
40
|
+
DATA counter TYPE i.
|
|
41
|
+
ENDCLASS.`,
|
|
34
42
|
};
|
|
35
43
|
}
|
|
36
44
|
getDescription(name) {
|
|
@@ -67,6 +67,14 @@ class PrefixIsCurrentClass extends _abap_rule_1.ABAPRule {
|
|
|
67
67
|
// eslint-disable-next-line max-len
|
|
68
68
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-self-reference-me-when-calling-an-instance-attribute-or-method`,
|
|
69
69
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
70
|
+
badExample: `METHOD run.
|
|
71
|
+
zcl_current=>helper( ).
|
|
72
|
+
me->do_work( ).
|
|
73
|
+
ENDMETHOD.`,
|
|
74
|
+
goodExample: `METHOD run.
|
|
75
|
+
helper( ).
|
|
76
|
+
do_work( ).
|
|
77
|
+
ENDMETHOD.`,
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
getConfig() {
|
|
@@ -29,6 +29,12 @@ class StaticCallViaInstance extends _abap_rule_1.ABAPRule {
|
|
|
29
29
|
shortDescription: `Static method call via instance variable`,
|
|
30
30
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-call-static-methods-through-instance-variables`,
|
|
31
31
|
tags: [_irule_1.RuleTag.Styleguide],
|
|
32
|
+
badExample: `METHOD run.
|
|
33
|
+
NEW lcl_helper( )->static_method( ).
|
|
34
|
+
ENDMETHOD.`,
|
|
35
|
+
goodExample: `METHOD run.
|
|
36
|
+
lcl_helper=>static_method( ).
|
|
37
|
+
ENDMETHOD.`,
|
|
32
38
|
};
|
|
33
39
|
}
|
|
34
40
|
getConfig() {
|