@abaplint/core 2.119.48 → 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.
Files changed (29) hide show
  1. package/build/src/abap/2_statements/expand_macros.js +14 -7
  2. package/build/src/abap/2_statements/expressions/_derived_types.js +53 -0
  3. package/build/src/abap/2_statements/expressions/type_structure.js +8 -16
  4. package/build/src/abap/2_statements/expressions/type_table.js +4 -1
  5. package/build/src/abap/2_statements/statements/_statement.js +7 -1
  6. package/build/src/abap/3_structures/structures/_combi.js +1 -1
  7. package/build/src/abap/3_structures/structures/normal.js +1 -1
  8. package/build/src/abap/5_syntax/basic_types.js +2 -15
  9. package/build/src/registry.js +1 -1
  10. package/build/src/rules/avoid_use.js +2 -0
  11. package/build/src/rules/class_attribute_names.js +8 -0
  12. package/build/src/rules/constructor_visibility_public.js +8 -0
  13. package/build/src/rules/dangerous_statement.js +2 -0
  14. package/build/src/rules/db_operation_in_loop.js +11 -0
  15. package/build/src/rules/exit_or_check.js +6 -0
  16. package/build/src/rules/form_tables_obsolete.js +4 -0
  17. package/build/src/rules/function_module_recommendations.js +4 -0
  18. package/build/src/rules/index.js +1 -0
  19. package/build/src/rules/line_length.js +3 -0
  20. package/build/src/rules/local_class_naming.js +4 -0
  21. package/build/src/rules/method_parameter_names.js +6 -0
  22. package/build/src/rules/no_aliases.js +7 -0
  23. package/build/src/rules/no_comments_between_methods.js +15 -1
  24. package/build/src/rules/no_macros.js +82 -0
  25. package/build/src/rules/no_public_attributes.js +8 -0
  26. package/build/src/rules/parser_error.js +15 -11
  27. package/build/src/rules/prefix_is_current_class.js +8 -0
  28. package/build/src/rules/static_call_via_instance.js +6 -0
  29. package/package.json +1 -1
@@ -134,7 +134,7 @@ class ExpandMacros {
134
134
  }
135
135
  }
136
136
  }
137
- handleMacros(statements, file) {
137
+ handleMacros(statements, file, seen = new Set()) {
138
138
  var _a;
139
139
  const result = [];
140
140
  let containsUnknown = false;
@@ -152,13 +152,20 @@ class ExpandMacros {
152
152
  });
153
153
  }
154
154
  result.push(new statement_node_1.StatementNode(new _statement_1.MacroCall(), statement.getColon()).setChildren(this.tokensToNodes(statement.getTokens())));
155
- const expanded = this.expandContents(macroName, statement);
156
- const handled = this.handleMacros(expanded, file);
157
- for (const e of handled.statements) {
158
- result.push(e);
155
+ if (!seen.has(macroName.toUpperCase())) {
156
+ const expanded = this.expandContents(macroName, statement);
157
+ const nextSeen = new Set(seen).add(macroName.toUpperCase());
158
+ const handled = this.handleMacros(expanded, file, nextSeen);
159
+ for (const e of handled.statements) {
160
+ result.push(e);
161
+ }
162
+ if (handled.containsUnknown === true) {
163
+ containsUnknown = true;
164
+ }
159
165
  }
160
- if (handled.containsUnknown === true) {
161
- containsUnknown = true;
166
+ else {
167
+ const node = new statement_node_1.StatementNode(new _statement_1.MacroRecursion(), statement.getColon());
168
+ result.push(node.setChildren(this.tokensToNodes(statement.getTokens())));
162
169
  }
163
170
  continue;
164
171
  }
@@ -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
- // todo, add version,
9
- const hier = (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName);
10
- const create = (0, combi_1.seq)("CREATE", (0, combi_1.alt)(_1.NamespaceSimpleName, _1.EntityAssociation));
11
- const update = (0, combi_1.seq)("UPDATE", (0, combi_1.alt)(_1.NamespaceSimpleName, _1.EntityAssociation));
12
- const readResult = (0, combi_1.seq)("READ RESULT", (0, combi_1.alt)(_1.NamespaceSimpleName, _1.EntityAssociation));
13
- const readLink = (0, combi_1.seq)("READ LINK", _1.EntityAssociation);
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 derived = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("ACTION IMPORT", "ACTION RESULT", "CREATE", "EVENT", "REPORTED EARLY", "READ IMPORT", "FAILED EARLY", "FAILED", "LOCK", "DETERMINATION", "READ RESULT", "UPDATE", "DELETE"), (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation)), { also: combi_1.AlsoIn.OpenABAP });
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);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.Empty = exports.Comment = exports.Unknown = void 0;
3
+ exports.NativeSQL = exports.MacroRecursion = exports.MacroContent = exports.MacroCall = exports.Empty = exports.Comment = exports.Unknown = void 0;
4
4
  class Unknown {
5
5
  getMatcher() {
6
6
  throw new Error("Unknown Statement, get_matcher");
@@ -31,6 +31,12 @@ class MacroContent {
31
31
  }
32
32
  }
33
33
  exports.MacroContent = MacroContent;
34
+ class MacroRecursion {
35
+ getMatcher() {
36
+ throw new Error("MacroRecursion Statement, get_matcher");
37
+ }
38
+ }
39
+ exports.MacroRecursion = MacroRecursion;
34
40
  class NativeSQL {
35
41
  getMatcher() {
36
42
  throw new Error("NativeSQL Statement, get_matcher");
@@ -266,7 +266,7 @@ class SubStatement {
266
266
  }
267
267
  first() {
268
268
  const o = new this.obj();
269
- if (o instanceof _statement_1.MacroCall || o instanceof _statement_1.NativeSQL) {
269
+ if (o instanceof _statement_1.MacroCall || o instanceof _statement_1.MacroRecursion || o instanceof _statement_1.NativeSQL) {
270
270
  return [""];
271
271
  }
272
272
  return o.getMatcher().first();
@@ -41,7 +41,7 @@ const _statement_1 = require("../../2_statements/statements/_statement");
41
41
  class Normal {
42
42
  getMatcher() {
43
43
  // note that the sequence of alternatives here influences performance
44
- return (0, _combi_1.alt)((0, _combi_1.sta)(Statements.Move), (0, _combi_1.sta)(Statements.Call), (0, _combi_1.sta)(Statements.Data), (0, _combi_1.sub)(Structures.If), (0, _combi_1.sta)(Statements.Clear), (0, _combi_1.sta)(Statements.FieldSymbol), (0, _combi_1.sta)(Statements.CreateObject), (0, _combi_1.sta)(Statements.CallFunction), (0, _combi_1.sta)(_statement_1.MacroCall), (0, _combi_1.sub)(Structures.LoopAtScreen), (0, _combi_1.sub)(Structures.Loop), (0, _combi_1.sub)(Structures.LoopExtract), (0, _combi_1.sta)(Statements.Append), (0, _combi_1.sub)(Structures.Try), (0, _combi_1.sub)(Structures.OnChange), (0, _combi_1.sta)(Statements.ReadTable), (0, _combi_1.sta)(Statements.Assert), (0, _combi_1.sta)(Statements.Return), (0, _combi_1.sta)(Statements.Select), (0, _combi_1.sta)(Statements.Assign), (0, _combi_1.sta)(Statements.InsertInternal), (0, _combi_1.sta)(Statements.DeleteInternal), (0, _combi_1.sta)(Statements.Concatenate), (0, _combi_1.sub)(Structures.Case), (0, _combi_1.sub)(Structures.CaseType), (0, _combi_1.sub)(Structures.Enhancement), (0, _combi_1.sub)(Structures.EnhancementSection), (0, _combi_1.sta)(Statements.AddCorresponding), (0, _combi_1.sta)(Statements.Add), (0, _combi_1.sta)(Statements.AssignLocalCopy), (0, _combi_1.sta)(Statements.AuthorityCheck), (0, _combi_1.sta)(Statements.Back), (0, _combi_1.sta)(Statements.Break), (0, _combi_1.sta)(Statements.BreakId), (0, _combi_1.sta)(Statements.CallDatabase), (0, _combi_1.sta)(Statements.CallDialog), (0, _combi_1.sta)(Statements.CallKernel), (0, _combi_1.sta)(Statements.CallOLE), (0, _combi_1.sta)(Statements.CallScreen), (0, _combi_1.sta)(Statements.ModifyScreen), (0, _combi_1.sta)(Statements.CallSelectionScreen), (0, _combi_1.sta)(Statements.CallTransaction), (0, _combi_1.sta)(Statements.CallTransformation), (0, _combi_1.sta)(Statements.Check), (0, _combi_1.sta)(Statements.ClassDefinitionLoad), (0, _combi_1.sta)(Statements.CloseCursor), (0, _combi_1.sta)(Statements.CloseDataset), (0, _combi_1.sta)(Statements.Collect), (0, _combi_1.sta)(Statements.Commit), (0, _combi_1.sta)(Statements.Communication), (0, _combi_1.sta)(Statements.Compute), (0, _combi_1.sta)(Statements.CallBadi), (0, _combi_1.sta)(Statements.Condense), (0, _combi_1.sta)(Statements.Constant), (0, _combi_1.sta)(Statements.Contexts), (0, _combi_1.sta)(Statements.Continue), (0, _combi_1.sta)(Statements.ConvertText), (0, _combi_1.sta)(Statements.Convert), (0, _combi_1.sta)(Statements.CreateData), (0, _combi_1.sta)(Statements.CreateOLE), (0, _combi_1.sta)(Statements.DeleteCluster), (0, _combi_1.sta)(Statements.DeleteDatabase), (0, _combi_1.sta)(Statements.DeleteDataset), (0, _combi_1.sta)(Statements.DeleteDynpro), (0, _combi_1.sta)(Statements.DeleteMemory), (0, _combi_1.sta)(Statements.DeleteReport), (0, _combi_1.sta)(Statements.DeleteTextpool), (0, _combi_1.sta)(Statements.Demand), (0, _combi_1.sta)(Statements.Describe), (0, _combi_1.sta)(Statements.Detail), (0, _combi_1.sta)(Statements.Divide), (0, _combi_1.sta)(Statements.EditorCall), (0, _combi_1.sta)(Statements.EnhancementPoint), (0, _combi_1.sta)(Statements.Exit), (0, _combi_1.sta)(Statements.ExportDynpro), (0, _combi_1.sta)(Statements.Export), (0, _combi_1.sta)(Statements.Extract), (0, _combi_1.sta)(Statements.FetchNextCursor), (0, _combi_1.sta)(Statements.FieldGroup), (0, _combi_1.sta)(Statements.Fields), (0, _combi_1.sta)(Statements.Find), (0, _combi_1.sta)(Statements.Format), (0, _combi_1.sta)(Statements.FreeMemory), (0, _combi_1.sta)(Statements.FreeObject), (0, _combi_1.sta)(Statements.Free), (0, _combi_1.sta)(Statements.GenerateDynpro), (0, _combi_1.sta)(Statements.GenerateReport), (0, _combi_1.sta)(Statements.GenerateSubroutine), (0, _combi_1.sta)(Statements.GetBadi), (0, _combi_1.sta)(Statements.GetBit), (0, _combi_1.sta)(Statements.GetCursor), (0, _combi_1.sta)(Statements.GetDataset), (0, _combi_1.sta)(Statements.GetLocale), (0, _combi_1.sta)(Statements.GetParameter), (0, _combi_1.sta)(Statements.GetPFStatus), (0, _combi_1.sta)(Statements.GetProperty), (0, _combi_1.sta)(Statements.GetReference), (0, _combi_1.sta)(Statements.GetRunTime), (0, _combi_1.sta)(Statements.GetTime), (0, _combi_1.sta)(Statements.Hide), (0, _combi_1.sta)(Statements.Nodes), (0, _combi_1.sta)(Statements.ImportDynpro), (0, _combi_1.sta)(Statements.ImportNametab), (0, _combi_1.sta)(Statements.MoveCorresponding), (0, _combi_1.sta)(Statements.Import), (0, _combi_1.sta)(Statements.Infotypes), (0, _combi_1.sta)(Statements.Include), // include does not have to be at top level
44
+ return (0, _combi_1.alt)((0, _combi_1.sta)(Statements.Move), (0, _combi_1.sta)(Statements.Call), (0, _combi_1.sta)(Statements.Data), (0, _combi_1.sub)(Structures.If), (0, _combi_1.sta)(Statements.Clear), (0, _combi_1.sta)(Statements.FieldSymbol), (0, _combi_1.sta)(Statements.CreateObject), (0, _combi_1.sta)(Statements.CallFunction), (0, _combi_1.sta)(_statement_1.MacroCall), (0, _combi_1.sta)(_statement_1.MacroRecursion), (0, _combi_1.sub)(Structures.LoopAtScreen), (0, _combi_1.sub)(Structures.Loop), (0, _combi_1.sub)(Structures.LoopExtract), (0, _combi_1.sta)(Statements.Append), (0, _combi_1.sub)(Structures.Try), (0, _combi_1.sub)(Structures.OnChange), (0, _combi_1.sta)(Statements.ReadTable), (0, _combi_1.sta)(Statements.Assert), (0, _combi_1.sta)(Statements.Return), (0, _combi_1.sta)(Statements.Select), (0, _combi_1.sta)(Statements.Assign), (0, _combi_1.sta)(Statements.InsertInternal), (0, _combi_1.sta)(Statements.DeleteInternal), (0, _combi_1.sta)(Statements.Concatenate), (0, _combi_1.sub)(Structures.Case), (0, _combi_1.sub)(Structures.CaseType), (0, _combi_1.sub)(Structures.Enhancement), (0, _combi_1.sub)(Structures.EnhancementSection), (0, _combi_1.sta)(Statements.AddCorresponding), (0, _combi_1.sta)(Statements.Add), (0, _combi_1.sta)(Statements.AssignLocalCopy), (0, _combi_1.sta)(Statements.AuthorityCheck), (0, _combi_1.sta)(Statements.Back), (0, _combi_1.sta)(Statements.Break), (0, _combi_1.sta)(Statements.BreakId), (0, _combi_1.sta)(Statements.CallDatabase), (0, _combi_1.sta)(Statements.CallDialog), (0, _combi_1.sta)(Statements.CallKernel), (0, _combi_1.sta)(Statements.CallOLE), (0, _combi_1.sta)(Statements.CallScreen), (0, _combi_1.sta)(Statements.ModifyScreen), (0, _combi_1.sta)(Statements.CallSelectionScreen), (0, _combi_1.sta)(Statements.CallTransaction), (0, _combi_1.sta)(Statements.CallTransformation), (0, _combi_1.sta)(Statements.Check), (0, _combi_1.sta)(Statements.ClassDefinitionLoad), (0, _combi_1.sta)(Statements.CloseCursor), (0, _combi_1.sta)(Statements.CloseDataset), (0, _combi_1.sta)(Statements.Collect), (0, _combi_1.sta)(Statements.Commit), (0, _combi_1.sta)(Statements.Communication), (0, _combi_1.sta)(Statements.Compute), (0, _combi_1.sta)(Statements.CallBadi), (0, _combi_1.sta)(Statements.Condense), (0, _combi_1.sta)(Statements.Constant), (0, _combi_1.sta)(Statements.Contexts), (0, _combi_1.sta)(Statements.Continue), (0, _combi_1.sta)(Statements.ConvertText), (0, _combi_1.sta)(Statements.Convert), (0, _combi_1.sta)(Statements.CreateData), (0, _combi_1.sta)(Statements.CreateOLE), (0, _combi_1.sta)(Statements.DeleteCluster), (0, _combi_1.sta)(Statements.DeleteDatabase), (0, _combi_1.sta)(Statements.DeleteDataset), (0, _combi_1.sta)(Statements.DeleteDynpro), (0, _combi_1.sta)(Statements.DeleteMemory), (0, _combi_1.sta)(Statements.DeleteReport), (0, _combi_1.sta)(Statements.DeleteTextpool), (0, _combi_1.sta)(Statements.Demand), (0, _combi_1.sta)(Statements.Describe), (0, _combi_1.sta)(Statements.Detail), (0, _combi_1.sta)(Statements.Divide), (0, _combi_1.sta)(Statements.EditorCall), (0, _combi_1.sta)(Statements.EnhancementPoint), (0, _combi_1.sta)(Statements.Exit), (0, _combi_1.sta)(Statements.ExportDynpro), (0, _combi_1.sta)(Statements.Export), (0, _combi_1.sta)(Statements.Extract), (0, _combi_1.sta)(Statements.FetchNextCursor), (0, _combi_1.sta)(Statements.FieldGroup), (0, _combi_1.sta)(Statements.Fields), (0, _combi_1.sta)(Statements.Find), (0, _combi_1.sta)(Statements.Format), (0, _combi_1.sta)(Statements.FreeMemory), (0, _combi_1.sta)(Statements.FreeObject), (0, _combi_1.sta)(Statements.Free), (0, _combi_1.sta)(Statements.GenerateDynpro), (0, _combi_1.sta)(Statements.GenerateReport), (0, _combi_1.sta)(Statements.GenerateSubroutine), (0, _combi_1.sta)(Statements.GetBadi), (0, _combi_1.sta)(Statements.GetBit), (0, _combi_1.sta)(Statements.GetCursor), (0, _combi_1.sta)(Statements.GetDataset), (0, _combi_1.sta)(Statements.GetLocale), (0, _combi_1.sta)(Statements.GetParameter), (0, _combi_1.sta)(Statements.GetPFStatus), (0, _combi_1.sta)(Statements.GetProperty), (0, _combi_1.sta)(Statements.GetReference), (0, _combi_1.sta)(Statements.GetRunTime), (0, _combi_1.sta)(Statements.GetTime), (0, _combi_1.sta)(Statements.Hide), (0, _combi_1.sta)(Statements.Nodes), (0, _combi_1.sta)(Statements.ImportDynpro), (0, _combi_1.sta)(Statements.ImportNametab), (0, _combi_1.sta)(Statements.MoveCorresponding), (0, _combi_1.sta)(Statements.Import), (0, _combi_1.sta)(Statements.Infotypes), (0, _combi_1.sta)(Statements.Include), // include does not have to be at top level
45
45
  (0, _combi_1.sta)(Statements.InsertDatabase), (0, _combi_1.sta)(Statements.InsertReport), (0, _combi_1.sta)(Statements.InsertTextpool), (0, _combi_1.sta)(Statements.InsertFieldGroup), (0, _combi_1.sta)(Statements.InterfaceLoad), (0, _combi_1.sta)(Statements.Leave), (0, _combi_1.sta)(Statements.LoadReport), (0, _combi_1.sta)(Statements.Local), (0, _combi_1.sta)(Statements.With), (0, _combi_1.sta)(Statements.LogPoint), (0, _combi_1.sta)(Statements.Message), (0, _combi_1.sta)(Statements.MergeDatabase), (0, _combi_1.sta)(Statements.ModifyLine), (0, _combi_1.sta)(Statements.ModifyDatabase), (0, _combi_1.sta)(Statements.ModifyInternal), (0, _combi_1.sta)(Statements.Multiply), (0, _combi_1.sta)(Statements.NewLine), (0, _combi_1.sta)(Statements.NewPage), (0, _combi_1.sta)(Statements.OpenCursor), (0, _combi_1.sta)(Statements.OpenDataset), (0, _combi_1.sta)(Statements.Overlay), (0, _combi_1.sta)(Statements.Pack), (0, _combi_1.sta)(Statements.Perform), (0, _combi_1.sta)(Statements.FormDefinition), (0, _combi_1.sta)(Statements.Position), (0, _combi_1.sta)(Statements.Put), (0, _combi_1.sta)(Statements.PrintControl), (0, _combi_1.sta)(Statements.RaiseEvent), (0, _combi_1.sta)(Statements.RaiseEntityEvent), (0, _combi_1.sta)(Statements.Raise), (0, _combi_1.sta)(Statements.Ranges), (0, _combi_1.sta)(Statements.ReadDataset), (0, _combi_1.sta)(Statements.ReadLine), (0, _combi_1.sta)(Statements.ReadReport), (0, _combi_1.sta)(Statements.ReadTextpool), (0, _combi_1.sta)(Statements.Receive), (0, _combi_1.sta)(Statements.RefreshControl), (0, _combi_1.sta)(Statements.Refresh), (0, _combi_1.sta)(Statements.Reject), (0, _combi_1.sta)(Statements.Replace), (0, _combi_1.sta)(Statements.Reserve), (0, _combi_1.sta)(Statements.Resume), (0, _combi_1.sta)(Statements.Retry), (0, _combi_1.sta)(Statements.Rollback), (0, _combi_1.sta)(Statements.Scan), (0, _combi_1.sta)(Statements.ScrollList), (0, _combi_1.sta)(Statements.Search), (0, _combi_1.sta)(Statements.SetBit), (0, _combi_1.sta)(Statements.SetBlank), (0, _combi_1.sta)(Statements.SetCountry), (0, _combi_1.sta)(Statements.SetCursor), (0, _combi_1.sta)(Statements.SetDataset), (0, _combi_1.sta)(Statements.SetExtendedCheck), (0, _combi_1.sta)(Statements.SetHandler), (0, _combi_1.sta)(Statements.SetLanguage), (0, _combi_1.sta)(Statements.SetLeft), (0, _combi_1.sta)(Statements.SetLocale), (0, _combi_1.sta)(Statements.SetMargin), (0, _combi_1.sta)(Statements.SetParameter), (0, _combi_1.sta)(Statements.SetPFStatus), (0, _combi_1.sta)(Statements.SetProperty), (0, _combi_1.sta)(Statements.SetRunTime), (0, _combi_1.sta)(Statements.SetScreen), (0, _combi_1.sta)(Statements.SetTitlebar), (0, _combi_1.sta)(Statements.SetUserCommand), (0, _combi_1.sta)(Statements.SetUpdateTask), (0, _combi_1.sta)(Statements.Shift), (0, _combi_1.sta)(Statements.Skip), (0, _combi_1.sta)(Statements.SortDataset), (0, _combi_1.sta)(Statements.Sort), (0, _combi_1.sta)(Statements.Static), (0, _combi_1.sta)(Statements.Split), (0, _combi_1.sta)(Statements.Stop), (0, _combi_1.sta)(Statements.Submit), (0, _combi_1.sta)(Statements.Summary), (0, _combi_1.sta)(Statements.SubtractCorresponding), (0, _combi_1.sta)(Statements.Subtract), (0, _combi_1.sta)(Statements.SuppressDialog), (0, _combi_1.sta)(Statements.Supply), (0, _combi_1.sta)(Statements.Sum), (0, _combi_1.sta)(Statements.SyntaxCheck), (0, _combi_1.sta)(Statements.SystemCall), (0, _combi_1.sta)(Statements.Tables), (0, _combi_1.sta)(Statements.Transfer), (0, _combi_1.sta)(Statements.Translate), (0, _combi_1.sta)(Statements.Type), (0, _combi_1.sta)(Statements.TypePools), (0, _combi_1.sta)(Statements.Uline), (0, _combi_1.sta)(Statements.Unassign), (0, _combi_1.sta)(Statements.Unpack), (0, _combi_1.sta)(Statements.UpdateDatabase), (0, _combi_1.sta)(Statements.Wait), (0, _combi_1.sta)(Statements.Window), (0, _combi_1.sta)(Statements.Write), (0, _combi_1.sta)(Statements.CommitEntities), (0, _combi_1.sta)(Statements.GetPermissions), (0, _combi_1.sta)(Statements.SetLocks), (0, _combi_1.sta)(Statements.ModifyEntities), (0, _combi_1.sta)(Statements.ReadEntities), (0, _combi_1.sta)(Statements.RollbackEntities), (0, _combi_1.sta)(Statements.Module), // todo, should be dynpro specific
46
46
  (0, _combi_1.sta)(Statements.Field), // todo, should be dynpro specific
47
47
  (0, _combi_1.sub)(Structures.Chain), // todo, should be dynpro specific
@@ -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 ACTION IMPORT ")
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 CHANGE ");
692
+ || text.startsWith("TYPE REQUEST FOR ");
706
693
  }
707
694
  // todo, rewrite this method
708
695
  resolveTypeChain(expr) {
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.js"
77
- return "2.119.48";
77
+ return "2.119.50";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -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() {
@@ -124,6 +124,7 @@ __exportStar(require("./no_chained_assignment"), exports);
124
124
  __exportStar(require("./no_comments_between_methods"), exports);
125
125
  __exportStar(require("./no_external_form_calls"), exports);
126
126
  __exportStar(require("./no_inline_in_optional_branches"), exports);
127
+ __exportStar(require("./no_macros"), exports);
127
128
  __exportStar(require("./no_prefixes"), exports);
128
129
  __exportStar(require("./no_public_attributes"), exports);
129
130
  __exportStar(require("./no_yoda_conditions"), exports);
@@ -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: `Its not possible to have comments between methods in global classes.`,
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() {
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.NoMacros = exports.NoMacrosConf = void 0;
37
+ const issue_1 = require("../issue");
38
+ const _abap_rule_1 = require("./_abap_rule");
39
+ const Statements = __importStar(require("../abap/2_statements/statements"));
40
+ const _basic_rule_config_1 = require("./_basic_rule_config");
41
+ const _irule_1 = require("./_irule");
42
+ class NoMacrosConf extends _basic_rule_config_1.BasicRuleConfig {
43
+ }
44
+ exports.NoMacrosConf = NoMacrosConf;
45
+ class NoMacros extends _abap_rule_1.ABAPRule {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.conf = new NoMacrosConf();
49
+ }
50
+ getMetadata() {
51
+ return {
52
+ key: "no_macros",
53
+ title: "No macros",
54
+ shortDescription: `Checks that macros are not used`,
55
+ extendedInformation: `Macros reduce readability and are difficult to debug, use methods or form routines instead.
56
+
57
+ https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abenmacros_guidl.htm`,
58
+ tags: [_irule_1.RuleTag.SingleFile],
59
+ badExample: `DEFINE _macro.
60
+ WRITE 'hello'.
61
+ END-OF-DEFINITION.`,
62
+ goodExample: `WRITE 'hello'.`,
63
+ };
64
+ }
65
+ getConfig() {
66
+ return this.conf;
67
+ }
68
+ setConfig(conf) {
69
+ this.conf = conf;
70
+ }
71
+ runParsed(file) {
72
+ const issues = [];
73
+ for (const stat of file.getStatements()) {
74
+ if (stat.get() instanceof Statements.Define) {
75
+ issues.push(issue_1.Issue.atStatement(file, stat, "Do not define macros", this.getMetadata().key, this.conf.severity));
76
+ }
77
+ }
78
+ return issues;
79
+ }
80
+ }
81
+ exports.NoMacros = NoMacros;
82
+ //# sourceMappingURL=no_macros.js.map
@@ -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) {
@@ -41,19 +41,23 @@ See recognized syntax at https://syntax.abaplint.org`,
41
41
  if (obj instanceof _abap_object_1.ABAPObject) {
42
42
  for (const file of obj.getABAPFiles()) {
43
43
  for (const statement of file.getStatements()) {
44
- if (!(statement.get() instanceof _statement_1.Unknown)) {
45
- continue;
46
- }
47
- if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {
48
- const message = "Statement too long, refactor statement";
49
- const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);
50
- issues.push(issue);
44
+ if (statement.get() instanceof _statement_1.Unknown) {
45
+ if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {
46
+ const message = "Statement too long, refactor statement";
47
+ const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);
48
+ issues.push(issue);
49
+ }
50
+ else {
51
+ const tok = statement.getFirstToken();
52
+ const message = "Statement does not exist in ABAP " + this.reg.getConfig().getRelease().name + " (or a parser error), \"" + tok.getStr() + "\"";
53
+ const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);
54
+ issues.push(issue);
55
+ }
51
56
  }
52
- else {
57
+ else if (statement.get() instanceof _statement_1.MacroRecursion) {
53
58
  const tok = statement.getFirstToken();
54
- const message = "Statement does not exist in ABAP" + this.reg.getConfig().getRelease().name + "(or a parser error), \"" + tok.getStr() + "\"";
55
- const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);
56
- issues.push(issue);
59
+ const message = "Macro recursion detected involving \"" + tok.getStr() + "\"";
60
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
57
61
  }
58
62
  }
59
63
  if (this.reg.getConfig().getRelease() === version_1.Release.v700) {
@@ -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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.48",
3
+ "version": "2.119.50",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",