@abaplint/core 2.105.4 → 2.105.5

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 (111) hide show
  1. package/README.md +6 -6
  2. package/build/abaplint.d.ts +37 -11
  3. package/build/src/abap/5_syntax/_builtin.js +202 -193
  4. package/build/src/abap/5_syntax/_current_scope.js +15 -11
  5. package/build/src/abap/5_syntax/basic_types.js +2 -2
  6. package/build/src/abap/5_syntax/expressions/field_chain.js +2 -2
  7. package/build/src/abap/5_syntax/expressions/method_call_param.js +7 -2
  8. package/build/src/abap/5_syntax/expressions/target.js +11 -0
  9. package/build/src/abap/5_syntax/spaghetti_scope.js +8 -21
  10. package/build/src/abap/5_syntax/statements/catch.js +3 -3
  11. package/build/src/abap/5_syntax/statements/class_local_friends.js +1 -1
  12. package/build/src/abap/5_syntax/statements/raise.js +2 -2
  13. package/build/src/abap/flow/flow_graph.js +7 -7
  14. package/build/src/abap/types/basic/void_type.js +2 -2
  15. package/build/src/lsp/help.js +7 -7
  16. package/build/src/objects/neptune_api.js +1 -1
  17. package/build/src/registry.js +1 -1
  18. package/build/src/rules/7bit_ascii.js +4 -4
  19. package/build/src/rules/abapdoc.js +4 -4
  20. package/build/src/rules/align_parameters.js +40 -40
  21. package/build/src/rules/ambiguous_statement.js +6 -6
  22. package/build/src/rules/avoid_use.js +10 -10
  23. package/build/src/rules/begin_end_names.js +4 -4
  24. package/build/src/rules/begin_single_include.js +12 -12
  25. package/build/src/rules/call_transaction_authority_check.js +3 -3
  26. package/build/src/rules/cds_comment_style.js +4 -4
  27. package/build/src/rules/cds_legacy_view.js +4 -4
  28. package/build/src/rules/chain_mainly_declarations.js +4 -4
  29. package/build/src/rules/change_if_to_case.js +8 -8
  30. package/build/src/rules/check_abstract.js +2 -2
  31. package/build/src/rules/check_comments.js +4 -4
  32. package/build/src/rules/check_include.js +3 -3
  33. package/build/src/rules/check_subrc.js +8 -8
  34. package/build/src/rules/classic_exceptions_overlap.js +10 -10
  35. package/build/src/rules/commented_code.js +1 -1
  36. package/build/src/rules/constructor_visibility_public.js +4 -4
  37. package/build/src/rules/contains_tab.js +2 -2
  38. package/build/src/rules/cyclic_oo.js +4 -4
  39. package/build/src/rules/dangerous_statement.js +1 -1
  40. package/build/src/rules/definitions_top.js +6 -6
  41. package/build/src/rules/downport.js +82 -82
  42. package/build/src/rules/easy_to_find_messages.js +6 -6
  43. package/build/src/rules/empty_line_in_statement.js +2 -2
  44. package/build/src/rules/exit_or_check.js +3 -3
  45. package/build/src/rules/expand_macros.js +5 -5
  46. package/build/src/rules/exporting.js +1 -1
  47. package/build/src/rules/forbidden_identifier.js +1 -1
  48. package/build/src/rules/forbidden_void_type.js +2 -2
  49. package/build/src/rules/fully_type_itabs.js +1 -1
  50. package/build/src/rules/functional_writing.js +17 -17
  51. package/build/src/rules/global_class.js +8 -8
  52. package/build/src/rules/identical_conditions.js +2 -2
  53. package/build/src/rules/identical_contents.js +14 -14
  54. package/build/src/rules/identical_descriptions.js +6 -6
  55. package/build/src/rules/if_in_if.js +35 -35
  56. package/build/src/rules/implement_methods.js +3 -3
  57. package/build/src/rules/in_statement_indentation.js +11 -11
  58. package/build/src/rules/intf_referencing_clas.js +3 -3
  59. package/build/src/rules/line_break_style.js +2 -2
  60. package/build/src/rules/line_length.js +1 -1
  61. package/build/src/rules/line_only_punc.js +1 -1
  62. package/build/src/rules/local_variable_names.js +2 -2
  63. package/build/src/rules/main_file_contents.js +4 -4
  64. package/build/src/rules/many_parentheses.js +10 -10
  65. package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
  66. package/build/src/rules/max_one_statement.js +5 -5
  67. package/build/src/rules/method_length.js +2 -2
  68. package/build/src/rules/method_overwrites_builtin.js +4 -4
  69. package/build/src/rules/nesting.js +1 -1
  70. package/build/src/rules/no_chained_assignment.js +1 -1
  71. package/build/src/rules/no_external_form_calls.js +2 -2
  72. package/build/src/rules/no_inline_in_optional_branches.js +11 -11
  73. package/build/src/rules/no_prefixes.js +6 -6
  74. package/build/src/rules/no_public_attributes.js +1 -1
  75. package/build/src/rules/no_yoda_conditions.js +4 -4
  76. package/build/src/rules/nrob_consistency.js +2 -2
  77. package/build/src/rules/obsolete_statement.js +51 -51
  78. package/build/src/rules/omit_parameter_name.js +3 -3
  79. package/build/src/rules/omit_receiving.js +13 -13
  80. package/build/src/rules/parser_702_chaining.js +2 -2
  81. package/build/src/rules/parser_error.js +2 -2
  82. package/build/src/rules/parser_missing_space.js +1 -1
  83. package/build/src/rules/prefer_inline.js +16 -16
  84. package/build/src/rules/prefer_is_not.js +9 -9
  85. package/build/src/rules/prefer_raise_exception_new.js +5 -5
  86. package/build/src/rules/prefer_returning_to_exporting.js +1 -1
  87. package/build/src/rules/prefer_xsdbool.js +2 -2
  88. package/build/src/rules/reduce_procedural_code.js +17 -17
  89. package/build/src/rules/remove_descriptions.js +4 -4
  90. package/build/src/rules/rfc_error_handling.js +9 -9
  91. package/build/src/rules/select_add_order_by.js +5 -5
  92. package/build/src/rules/select_performance.js +5 -5
  93. package/build/src/rules/select_single_full_key.js +2 -2
  94. package/build/src/rules/sicf_consistency.js +2 -2
  95. package/build/src/rules/space_before_dot.js +2 -2
  96. package/build/src/rules/sql_value_conversion.js +6 -6
  97. package/build/src/rules/start_at_tab.js +1 -1
  98. package/build/src/rules/strict_sql.js +6 -6
  99. package/build/src/rules/sy_modification.js +3 -3
  100. package/build/src/rules/tabl_enhancement_category.js +2 -2
  101. package/build/src/rules/type_form_parameters.js +2 -2
  102. package/build/src/rules/unknown_types.js +2 -1
  103. package/build/src/rules/unnecessary_pragma.js +29 -29
  104. package/build/src/rules/unnecessary_return.js +11 -11
  105. package/build/src/rules/unused_methods.js +11 -11
  106. package/build/src/rules/unused_variables.js +12 -12
  107. package/build/src/rules/use_bool_expression.js +8 -8
  108. package/build/src/rules/use_line_exists.js +6 -6
  109. package/build/src/rules/use_new.js +4 -4
  110. package/build/src/rules/when_others_last.js +6 -6
  111. package/package.json +70 -70
@@ -7,7 +7,6 @@ const position_1 = require("../../position");
7
7
  const spaghetti_scope_1 = require("./spaghetti_scope");
8
8
  const _identifier_1 = require("../4_file_information/_identifier");
9
9
  const _scope_type_1 = require("./_scope_type");
10
- const _reference_1 = require("./_reference");
11
10
  const syntax_1 = require("./syntax");
12
11
  class CurrentScope {
13
12
  static buildDefault(reg, obj) {
@@ -99,8 +98,14 @@ class CurrentScope {
99
98
  this.current.getData().forms.push(...f);
100
99
  }
101
100
  addInterfaceDefinition(i) {
102
- var _a;
103
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().idefs.push(i);
101
+ if (this.current === undefined) {
102
+ return;
103
+ }
104
+ const name = i.getName().toUpperCase();
105
+ if (this.current.getData().cdefs[name] !== undefined) {
106
+ throw new Error(`Interface "${name}" already defined`);
107
+ }
108
+ this.current.getData().idefs[name] = i;
104
109
  }
105
110
  addNamedIdentifier(name, identifier) {
106
111
  if (this.current === undefined) {
@@ -195,11 +200,10 @@ class CurrentScope {
195
200
  }
196
201
  return false;
197
202
  }
198
- // todo, found + type can be removed from method output?
199
203
  existsObject(name) {
200
204
  var _a, _b, _c;
201
205
  if (name === undefined) {
202
- return { found: false };
206
+ return undefined;
203
207
  }
204
208
  let prefixRTTI = "";
205
209
  if (this.parentObj.getType() === "PROG") {
@@ -213,28 +217,28 @@ class CurrentScope {
213
217
  if (findLocalClass.isGlobal() === true) {
214
218
  prefixRTTI = "";
215
219
  }
216
- return { found: true, id: findLocalClass, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: prefixRTTI + "\\CLASS=" + findLocalClass.getName() };
220
+ return { id: findLocalClass, ooType: "CLAS", RTTIName: prefixRTTI + "\\CLASS=" + findLocalClass.getName() };
217
221
  }
218
222
  const globalClas = this.reg.getObject("CLAS", name);
219
223
  if (globalClas) {
220
- return { found: true, id: globalClas.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "CLAS", RTTIName: "\\CLASS=" + globalClas.getName() };
224
+ return { id: globalClas.getIdentifier(), ooType: "CLAS", RTTIName: "\\CLASS=" + globalClas.getName() };
221
225
  }
222
226
  const findLocalInterface = (_b = this.current) === null || _b === void 0 ? void 0 : _b.findInterfaceDefinition(name);
223
227
  if (findLocalInterface) {
224
228
  if (findLocalInterface.isGlobal() === true) {
225
229
  prefixRTTI = "";
226
230
  }
227
- return { found: true, id: findLocalInterface, type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: prefixRTTI + "\\INTERFACE=" + findLocalInterface.getName() };
231
+ return { id: findLocalInterface, ooType: "INTF", RTTIName: prefixRTTI + "\\INTERFACE=" + findLocalInterface.getName() };
228
232
  }
229
233
  const globalIntf = this.reg.getObject("INTF", name);
230
234
  if (globalIntf) {
231
- return { found: true, id: globalIntf.getIdentifier(), type: _reference_1.ReferenceType.ObjectOrientedReference, ooType: "INTF", RTTIName: "\\INTERFACE=" + globalIntf.getName() };
235
+ return { id: globalIntf.getIdentifier(), ooType: "INTF", RTTIName: "\\INTERFACE=" + globalIntf.getName() };
232
236
  }
233
237
  const def = (_c = this.current) === null || _c === void 0 ? void 0 : _c.findDeferred(name);
234
238
  if (def !== undefined) {
235
- return { found: true, id: def };
239
+ return { id: def };
236
240
  }
237
- return { found: false };
241
+ return undefined;
238
242
  }
239
243
  ///////////////////////////
240
244
  /** Lookup class in local and global scope */
@@ -771,7 +771,7 @@ class BasicTypes {
771
771
  else if (firstNode.get() instanceof Expressions.ClassName) {
772
772
  const obj = this.scope.findObjectDefinition(firstName);
773
773
  if (obj === undefined) {
774
- if (this.scope.existsObject(firstName).found === true) {
774
+ if (this.scope.existsObject(firstName) !== undefined) {
775
775
  return undefined;
776
776
  }
777
777
  else if (this.scope.getDDIC().inErrorNamespace(firstName) === true) {
@@ -818,7 +818,7 @@ class BasicTypes {
818
818
  return new Types.GenericObjectReferenceType();
819
819
  }
820
820
  const search = this.scope.existsObject(name);
821
- if (search.found === true && search.id) {
821
+ if (search === null || search === void 0 ? void 0 : search.id) {
822
822
  this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });
823
823
  return new Types.ObjectReferenceType(search.id, { qualifiedName: name, RTTIName: search.RTTIName });
824
824
  }
@@ -171,8 +171,8 @@ class FieldChain {
171
171
  return new basic_1.GenericObjectReferenceType();
172
172
  }
173
173
  const found = scope.existsObject(classNam);
174
- if (found.found === true && found.id) {
175
- scope.addReference(classTok, found.id, found.type, filename);
174
+ if (found === null || found === void 0 ? void 0 : found.id) {
175
+ scope.addReference(classTok, found.id, _reference_1.ReferenceType.ObjectOrientedReference, filename);
176
176
  return new basic_1.ObjectReferenceType(found.id);
177
177
  }
178
178
  else if (scope.getDDIC().inErrorNamespace(classNam) === false) {
@@ -29,8 +29,13 @@ class MethodCallParam {
29
29
  else if (child instanceof nodes_1.ExpressionNode
30
30
  && (child.get() instanceof Expressions.Source
31
31
  || child.get() instanceof Expressions.ConstantString)) {
32
- if (!(method instanceof basic_1.VoidType) && method.getParameters().getImporting().length === 0) {
33
- throw new Error("Method \"" + method.getName() + "\" has no importing parameters");
32
+ if (!(method instanceof basic_1.VoidType)) {
33
+ if (method.getParameters().getImporting().length === 0) {
34
+ throw new Error("Method \"" + method.getName() + "\" has no importing parameters");
35
+ }
36
+ else if (method.getParameters().getRequiredParameters().length > 1) {
37
+ throw new Error("Method \"" + method.getName() + "\" has more than one importing or changing parameter");
38
+ }
34
39
  }
35
40
  let targetType = undefined;
36
41
  if (!(method instanceof basic_1.VoidType)) {
@@ -12,6 +12,7 @@ const field_offset_1 = require("./field_offset");
12
12
  const _reference_1 = require("../_reference");
13
13
  const table_expression_1 = require("./table_expression");
14
14
  const expressions_1 = require("../../2_statements/expressions");
15
+ const field_length_1 = require("./field_length");
15
16
  class Target {
16
17
  runSyntax(node, scope, filename) {
17
18
  const concat = node.concatTokens();
@@ -94,8 +95,18 @@ class Target {
94
95
  }
95
96
  const offset = node.findDirectExpression(Expressions.FieldOffset);
96
97
  if (offset) {
98
+ if (context instanceof basic_1.XStringType || context instanceof basic_1.StringType) {
99
+ throw new Error("xstring/string offset/length in writer position not possible");
100
+ }
97
101
  new field_offset_1.FieldOffset().runSyntax(offset, scope, filename);
98
102
  }
103
+ const length = node.findDirectExpression(Expressions.FieldLength);
104
+ if (length) {
105
+ if (context instanceof basic_1.XStringType || context instanceof basic_1.StringType) {
106
+ throw new Error("xstring/string offset/length in writer position not possible");
107
+ }
108
+ new field_length_1.FieldLength().runSyntax(length, scope, filename);
109
+ }
99
110
  return context;
100
111
  }
101
112
  /////////////////////////////////
@@ -9,7 +9,7 @@ class ScopeData {
9
9
  this.data = {
10
10
  vars: {},
11
11
  cdefs: {},
12
- idefs: [], // todo, refactor to object
12
+ idefs: {},
13
13
  forms: [], // todo, refactor to object
14
14
  types: {},
15
15
  extraLikeTypes: {},
@@ -111,26 +111,13 @@ class SpaghettiScopeNode extends ScopeData {
111
111
  }
112
112
  return undefined;
113
113
  }
114
- // todo, can be deleted, not called from anywhere?
115
- listFormDefinitions() {
116
- let search = this;
117
- const ret = [];
118
- while (search !== undefined) {
119
- for (const form of search.getData().forms) {
120
- ret.push(form);
121
- }
122
- search = search.getParent();
123
- }
124
- return ret;
125
- }
126
- // todo, optimize
127
114
  findInterfaceDefinition(name) {
128
115
  let search = this;
116
+ const upper = name.toUpperCase();
129
117
  while (search !== undefined) {
130
- for (const idef of search.getData().idefs) {
131
- if (idef.getName().toUpperCase() === name.toUpperCase()) {
132
- return idef;
133
- }
118
+ const idef = search.getData().idefs[upper];
119
+ if (idef) {
120
+ return idef;
134
121
  }
135
122
  search = search.getParent();
136
123
  }
@@ -140,9 +127,9 @@ class SpaghettiScopeNode extends ScopeData {
140
127
  let search = this;
141
128
  const upper = name.toUpperCase();
142
129
  while (search !== undefined) {
143
- const data = search.getData();
144
- if (data.types[upper]) {
145
- return data.types[upper];
130
+ const found = search.getData().types[upper];
131
+ if (found) {
132
+ return found;
146
133
  }
147
134
  search = search.getParent();
148
135
  }
@@ -15,8 +15,8 @@ class Catch {
15
15
  const token = c.getFirstToken();
16
16
  const className = token.getStr().toUpperCase();
17
17
  const found = scope.existsObject(className);
18
- if (found.found === true && found.id) {
19
- scope.addReference(token, found.id, found.type, filename);
18
+ if (found === null || found === void 0 ? void 0 : found.id) {
19
+ scope.addReference(token, found.id, _reference_1.ReferenceType.ObjectOrientedReference, filename);
20
20
  }
21
21
  else if (scope.getDDIC().inErrorNamespace(className) === false) {
22
22
  const extra = { ooName: className, ooType: "Void" };
@@ -35,7 +35,7 @@ class Catch {
35
35
  if (target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData)) {
36
36
  const token = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
37
37
  const found = scope.existsObject(firstClassName);
38
- if (token && found.found === true && firstClassName && found.id) {
38
+ if (token && firstClassName && (found === null || found === void 0 ? void 0 : found.id)) {
39
39
  const identifier = new _typed_identifier_1.TypedIdentifier(token, filename, new basic_1.ObjectReferenceType(found.id), ["inline" /* IdentifierMeta.InlineDefinition */]);
40
40
  scope.addIdentifier(identifier);
41
41
  scope.addReference(token, identifier, _reference_1.ReferenceType.DataWriteReference, filename);
@@ -26,7 +26,7 @@ class ClassLocalFriends {
26
26
  const className = classNames[i].concatTokens();
27
27
  // make sure to check also DEFINITION DEFERRED
28
28
  const found = scope.existsObject(className);
29
- if (found.found === false) {
29
+ if (found === undefined) {
30
30
  throw new Error(`Class ${className.toUpperCase()} not found`);
31
31
  }
32
32
  }
@@ -20,8 +20,8 @@ class Raise {
20
20
  const className = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
21
21
  if (className) {
22
22
  const found = scope.existsObject(className);
23
- if (found.found === true && found.id) {
24
- scope.addReference(classTok, found.id, found.type, filename);
23
+ if (found === null || found === void 0 ? void 0 : found.id) {
24
+ scope.addReference(classTok, found.id, _reference_1.ReferenceType.ObjectOrientedReference, filename);
25
25
  const def = scope.findObjectDefinition(className);
26
26
  method = (_b = helper.searchMethodName(def, "CONSTRUCTOR")) === null || _b === void 0 ? void 0 : _b.method;
27
27
  }
@@ -84,13 +84,13 @@ class FlowGraph {
84
84
  this.label = label;
85
85
  }
86
86
  toDigraph() {
87
- return `digraph G {
88
- labelloc="t";
89
- label="${this.label}";
90
- graph [fontname = "helvetica"];
91
- node [fontname = "helvetica", shape="box"];
92
- edge [fontname = "helvetica"];
93
- ${this.toTextEdges()}
87
+ return `digraph G {
88
+ labelloc="t";
89
+ label="${this.label}";
90
+ graph [fontname = "helvetica"];
91
+ node [fontname = "helvetica", shape="box"];
92
+ edge [fontname = "helvetica"];
93
+ ${this.toTextEdges()}
94
94
  }`;
95
95
  }
96
96
  listSources(node) {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VoidType = void 0;
4
4
  const _abstract_type_1 = require("./_abstract_type");
5
5
  class VoidType extends _abstract_type_1.AbstractType {
6
- constructor(voided, name) {
7
- super({ qualifiedName: name });
6
+ constructor(voided, qualifiedName) {
7
+ super({ qualifiedName: qualifiedName });
8
8
  this.voided = voided;
9
9
  }
10
10
  getVoided() {
@@ -19,13 +19,13 @@ class Help {
19
19
  /////////////////////////////////////////////////
20
20
  static dumpABAP(file, reg, textDocument, position) {
21
21
  let content = "";
22
- content = `
23
- <a href="#_tokens" rel="no-refresh">Tokens</a> |
24
- <a href="#_statements" rel="no-refresh">Statements</a> |
25
- <a href="#_structure" rel="no-refresh">Structure</a> |
26
- <a href="#_files" rel="no-refresh">Files</a> |
27
- <a href="#_info" rel="no-refresh">Info Dump</a>
28
- <hr>
22
+ content = `
23
+ <a href="#_tokens" rel="no-refresh">Tokens</a> |
24
+ <a href="#_statements" rel="no-refresh">Statements</a> |
25
+ <a href="#_structure" rel="no-refresh">Structure</a> |
26
+ <a href="#_files" rel="no-refresh">Files</a> |
27
+ <a href="#_info" rel="no-refresh">Info Dump</a>
28
+ <hr>
29
29
  ` +
30
30
  "<tt>" + textDocument.uri + " (" +
31
31
  (position.line + 1) + ", " +
@@ -8,7 +8,7 @@ class NeptuneAPI extends _abstract_object_1.AbstractObject {
8
8
  }
9
9
  getAllowedNaming() {
10
10
  return {
11
- maxLength: 30,
11
+ maxLength: 100,
12
12
  allowNamespace: true,
13
13
  };
14
14
  }
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.105.4";
68
+ return "2.105.5";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -17,10 +17,10 @@ class SevenBitAscii {
17
17
  key: "7bit_ascii",
18
18
  title: "Check for 7bit ascii",
19
19
  shortDescription: `Only allow characters from the 7bit ASCII set.`,
20
- extendedInformation: `https://docs.abapopenchecks.org/checks/05/
21
-
22
- https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_guidl.htm
23
-
20
+ extendedInformation: `https://docs.abapopenchecks.org/checks/05/
21
+
22
+ https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_guidl.htm
23
+
24
24
  Checkes files with extensions ".abap" and ".asddls"`,
25
25
  tags: [_irule_1.RuleTag.SingleFile],
26
26
  };
@@ -26,10 +26,10 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
26
26
  key: "abapdoc",
27
27
  title: "Check abapdoc",
28
28
  shortDescription: `Various checks regarding abapdoc.`,
29
- extendedInformation: `Base rule checks for existence of abapdoc for public class methods and all interface methods.
30
-
31
- Plus class and interface definitions.
32
-
29
+ extendedInformation: `Base rule checks for existence of abapdoc for public class methods and all interface methods.
30
+
31
+ Plus class and interface definitions.
32
+
33
33
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-only-for-public-apis`,
34
34
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
35
35
  };
@@ -22,49 +22,49 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
22
22
  key: "align_parameters",
23
23
  title: "Align Parameters",
24
24
  shortDescription: `Checks for vertially aligned parameters`,
25
- extendedInformation: `Checks:
26
- * function module calls
27
- * method calls
28
- * VALUE constructors
29
- * NEW constructors
30
- * RAISE EXCEPTION statements
31
- * CREATE OBJECT statements
32
- * RAISE EVENT statements
33
-
34
- https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
35
-
36
- Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
37
-
38
- If parameters are on the same row, no issues are reported, see
25
+ extendedInformation: `Checks:
26
+ * function module calls
27
+ * method calls
28
+ * VALUE constructors
29
+ * NEW constructors
30
+ * RAISE EXCEPTION statements
31
+ * CREATE OBJECT statements
32
+ * RAISE EVENT statements
33
+
34
+ https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
35
+
36
+ Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
37
+
38
+ If parameters are on the same row, no issues are reported, see
39
39
  https://rules.abaplint.org/max_one_method_parameter_per_line/ for splitting parameters to lines`,
40
40
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
41
- badExample: `CALL FUNCTION 'FOOBAR'
42
- EXPORTING
43
- foo = 2
44
- parameter = 3.
45
-
46
- foobar( moo = 1
47
- param = 1 ).
48
-
49
- foo = VALUE #(
50
- foo = bar
41
+ badExample: `CALL FUNCTION 'FOOBAR'
42
+ EXPORTING
43
+ foo = 2
44
+ parameter = 3.
45
+
46
+ foobar( moo = 1
47
+ param = 1 ).
48
+
49
+ foo = VALUE #(
50
+ foo = bar
51
51
  moo = 2 ).`,
52
- goodExample: `CALL FUNCTION 'FOOBAR'
53
- EXPORTING
54
- foo = 2
55
- parameter = 3.
56
-
57
- foobar( moo = 1
58
- param = 1 ).
59
-
60
- foo = VALUE #(
61
- foo = bar
62
- moo = 2 ).
63
-
64
- DATA(sdf) = VALUE type(
65
- common_val = 2
66
- another_common = 5
67
- ( row_value = 4
52
+ goodExample: `CALL FUNCTION 'FOOBAR'
53
+ EXPORTING
54
+ foo = 2
55
+ parameter = 3.
56
+
57
+ foobar( moo = 1
58
+ param = 1 ).
59
+
60
+ foo = VALUE #(
61
+ foo = bar
62
+ moo = 2 ).
63
+
64
+ DATA(sdf) = VALUE type(
65
+ common_val = 2
66
+ another_common = 5
67
+ ( row_value = 4
68
68
  value_foo = 5 ) ).`,
69
69
  };
70
70
  }
@@ -20,15 +20,15 @@ class AmbiguousStatement extends _abap_rule_1.ABAPRule {
20
20
  return {
21
21
  key: "ambiguous_statement",
22
22
  title: "Check for ambigious statements",
23
- shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
24
- Add "TABLE" keyword or "@" for escaping SQL variables
25
-
23
+ shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
24
+ Add "TABLE" keyword or "@" for escaping SQL variables
25
+
26
26
  Only works if the target version is 740sp05 or above`,
27
27
  tags: [_irule_1.RuleTag.SingleFile],
28
- badExample: `DELETE foo FROM bar.
28
+ badExample: `DELETE foo FROM bar.
29
29
  MODIFY foo FROM bar.`,
30
- goodExample: `DELETE foo FROM @bar.
31
- MODIFY TABLE foo FROM bar.
30
+ goodExample: `DELETE foo FROM @bar.
31
+ MODIFY TABLE foo FROM bar.
32
32
  MODIFY zfoo FROM @wa.`,
33
33
  };
34
34
  }
@@ -43,16 +43,16 @@ class AvoidUse extends _abap_rule_1.ABAPRule {
43
43
  key: "avoid_use",
44
44
  title: "Avoid use of certain statements",
45
45
  shortDescription: `Detects usage of certain statements.`,
46
- extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
47
-
48
- Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
49
-
50
- STATICS: use CLASS-DATA instead
51
-
52
- DESCRIBE TABLE LINES: use lines() instead (quickfix exists)
53
-
54
- TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround
55
-
46
+ extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
47
+
48
+ Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
49
+
50
+ STATICS: use CLASS-DATA instead
51
+
52
+ DESCRIBE TABLE LINES: use lines() instead (quickfix exists)
53
+
54
+ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround
55
+
56
56
  BREAK points`,
57
57
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
58
58
  };
@@ -23,11 +23,11 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
23
23
  title: "Check BEGIN END names",
24
24
  shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,
25
25
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
26
- badExample: `DATA: BEGIN OF stru,
27
- field TYPE i,
26
+ badExample: `DATA: BEGIN OF stru,
27
+ field TYPE i,
28
28
  END OF structure_not_the_same.`,
29
- goodExample: `DATA: BEGIN OF stru,
30
- field TYPE i,
29
+ goodExample: `DATA: BEGIN OF stru,
30
+ field TYPE i,
31
31
  END OF stru.`,
32
32
  };
33
33
  }
@@ -21,19 +21,19 @@ class BeginSingleInclude extends _abap_rule_1.ABAPRule {
21
21
  title: "BEGIN contains single INCLUDE",
22
22
  shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,
23
23
  tags: [_irule_1.RuleTag.SingleFile],
24
- badExample: `TYPES: BEGIN OF dummy1.
25
- INCLUDE TYPE dselc.
26
- TYPES: END OF dummy1.
27
-
28
- DATA BEGIN OF foo.
29
- INCLUDE STRUCTURE syst.
30
- DATA END OF foo.
31
-
32
- STATICS BEGIN OF bar.
33
- INCLUDE STRUCTURE syst.
24
+ badExample: `TYPES: BEGIN OF dummy1.
25
+ INCLUDE TYPE dselc.
26
+ TYPES: END OF dummy1.
27
+
28
+ DATA BEGIN OF foo.
29
+ INCLUDE STRUCTURE syst.
30
+ DATA END OF foo.
31
+
32
+ STATICS BEGIN OF bar.
33
+ INCLUDE STRUCTURE syst.
34
34
  STATICS END OF bar.`,
35
- goodExample: `DATA BEGIN OF foo.
36
- INCLUDE STRUCTURE dselc.
35
+ goodExample: `DATA BEGIN OF foo.
36
+ INCLUDE STRUCTURE dselc.
37
37
  DATA END OF foo.`,
38
38
  };
39
39
  }
@@ -24,9 +24,9 @@ class CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {
24
24
  extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,
25
25
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
26
26
  badExample: `CALL TRANSACTION 'FOO'.`,
27
- goodExample: `TRY.
28
- CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
29
- CATCH cx_sy_authorization_error.
27
+ goodExample: `TRY.
28
+ CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
29
+ CATCH cx_sy_authorization_error.
30
30
  ENDTRY.`,
31
31
  };
32
32
  }
@@ -19,10 +19,10 @@ class CDSCommentStyle {
19
19
  key: "cds_comment_style",
20
20
  title: "CDS Comment Style",
21
21
  shortDescription: `Check for obsolete comment style`,
22
- extendedInformation: `Check for obsolete comment style
23
-
24
- Comments starting with "--" are considered obsolete
25
-
22
+ extendedInformation: `Check for obsolete comment style
23
+
24
+ Comments starting with "--" are considered obsolete
25
+
26
26
  https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_general_syntax_rules.htm`,
27
27
  tags: [_irule_1.RuleTag.SingleFile],
28
28
  badExample: "-- this is a comment",
@@ -19,10 +19,10 @@ class CDSLegacyView {
19
19
  title: "CDS Legacy View",
20
20
  shortDescription: `Identify CDS Legacy Views`,
21
21
  // eslint-disable-next-line max-len
22
- extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW
23
-
24
- https://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/
25
-
22
+ extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW
23
+
24
+ https://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/
25
+
26
26
  v755 and up`,
27
27
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport],
28
28
  };
@@ -45,10 +45,10 @@ class ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {
45
45
  key: "chain_mainly_declarations",
46
46
  title: "Chain mainly declarations",
47
47
  shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,
48
- extendedInformation: `
49
- https://docs.abapopenchecks.org/checks/23/
50
-
51
- https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm
48
+ extendedInformation: `
49
+ https://docs.abapopenchecks.org/checks/23/
50
+
51
+ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm
52
52
  `,
53
53
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
54
54
  badExample: `CALL METHOD: bar.`,
@@ -29,17 +29,17 @@ class ChangeIfToCase extends _abap_rule_1.ABAPRule {
29
29
  title: "Change IF to CASE",
30
30
  shortDescription: `Finds IF constructs that can be changed to CASE`,
31
31
  // eslint-disable-next-line max-len
32
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions
33
-
32
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions
33
+
34
34
  If the first comparison is a boolean compare, no issue is reported.`,
35
35
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
36
- badExample: `IF l_fcat-fieldname EQ 'FOO'.
37
- ELSEIF l_fcat-fieldname = 'BAR'
38
- OR l_fcat-fieldname = 'MOO'.
36
+ badExample: `IF l_fcat-fieldname EQ 'FOO'.
37
+ ELSEIF l_fcat-fieldname = 'BAR'
38
+ OR l_fcat-fieldname = 'MOO'.
39
39
  ENDIF.`,
40
- goodExample: `CASE l_fcat-fieldname.
41
- WHEN 'FOO'.
42
- WHEN 'BAR' OR 'MOO'.
40
+ goodExample: `CASE l_fcat-fieldname.
41
+ WHEN 'FOO'.
42
+ WHEN 'BAR' OR 'MOO'.
43
43
  ENDCASE.`,
44
44
  };
45
45
  }