@abaplint/core 2.119.66 → 2.120.0

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 (138) hide show
  1. package/README.md +6 -6
  2. package/build/abaplint.d.ts +2 -2
  3. package/build/src/abap/5_syntax/_current_scope.js +1 -1
  4. package/build/src/abap/5_syntax/expressions/_check_offset_length.js +59 -0
  5. package/build/src/abap/5_syntax/expressions/method_call_param.js +4 -0
  6. package/build/src/abap/5_syntax/expressions/method_parameters.js +20 -6
  7. package/build/src/abap/5_syntax/statements/catch.js +17 -1
  8. package/build/src/config.js +1 -1
  9. package/build/src/lsp/help.js +10 -10
  10. package/build/src/registry.js +1 -1
  11. package/build/src/rules/7bit_ascii.js +4 -4
  12. package/build/src/rules/abapdoc.js +4 -4
  13. package/build/src/rules/add_test_attributes.js +20 -20
  14. package/build/src/rules/align_parameters.js +40 -40
  15. package/build/src/rules/align_type_expressions.js +28 -28
  16. package/build/src/rules/ambiguous_statement.js +7 -7
  17. package/build/src/rules/avoid_use.js +10 -10
  18. package/build/src/rules/begin_end_names.js +4 -4
  19. package/build/src/rules/begin_single_include.js +13 -13
  20. package/build/src/rules/call_transaction_authority_check.js +3 -3
  21. package/build/src/rules/cds_association_name.js +6 -6
  22. package/build/src/rules/cds_comment_style.js +4 -4
  23. package/build/src/rules/cds_field_order.js +12 -12
  24. package/build/src/rules/cds_legacy_view.js +4 -4
  25. package/build/src/rules/cds_naming.js +7 -7
  26. package/build/src/rules/chain_mainly_declarations.js +4 -4
  27. package/build/src/rules/change_if_to_case.js +8 -8
  28. package/build/src/rules/check_abstract.js +2 -2
  29. package/build/src/rules/check_comments.js +4 -4
  30. package/build/src/rules/check_include.js +4 -4
  31. package/build/src/rules/check_subrc.js +8 -8
  32. package/build/src/rules/class_attribute_names.js +6 -6
  33. package/build/src/rules/classic_exceptions_overlap.js +10 -10
  34. package/build/src/rules/commented_code.js +1 -1
  35. package/build/src/rules/constructor_visibility_public.js +10 -10
  36. package/build/src/rules/contains_tab.js +2 -2
  37. package/build/src/rules/cyclic_oo.js +4 -4
  38. package/build/src/rules/dangerous_statement.js +1 -1
  39. package/build/src/rules/db_operation_in_loop.js +9 -9
  40. package/build/src/rules/definitions_top.js +6 -6
  41. package/build/src/rules/downport.js +92 -92
  42. package/build/src/rules/easy_to_find_messages.js +6 -6
  43. package/build/src/rules/empty_event.js +6 -6
  44. package/build/src/rules/empty_line_in_statement.js +2 -2
  45. package/build/src/rules/empty_structure.js +6 -6
  46. package/build/src/rules/exit_or_check.js +7 -7
  47. package/build/src/rules/expand_macros.js +5 -5
  48. package/build/src/rules/exporting.js +1 -1
  49. package/build/src/rules/forbidden_identifier.js +1 -1
  50. package/build/src/rules/forbidden_void_type.js +2 -2
  51. package/build/src/rules/form_tables_obsolete.js +2 -2
  52. package/build/src/rules/fully_type_itabs.js +2 -2
  53. package/build/src/rules/function_module_recommendations.js +2 -2
  54. package/build/src/rules/functional_writing.js +17 -17
  55. package/build/src/rules/global_class.js +10 -10
  56. package/build/src/rules/identical_conditions.js +12 -12
  57. package/build/src/rules/identical_contents.js +14 -14
  58. package/build/src/rules/identical_descriptions.js +6 -6
  59. package/build/src/rules/identical_move.js +2 -2
  60. package/build/src/rules/if_in_if.js +35 -35
  61. package/build/src/rules/implement_methods.js +3 -3
  62. package/build/src/rules/implicit_start_of_selection.js +4 -4
  63. package/build/src/rules/in_statement_indentation.js +11 -11
  64. package/build/src/rules/indentation.js +16 -16
  65. package/build/src/rules/index.js +1 -0
  66. package/build/src/rules/inline_data_old_versions.js +1 -1
  67. package/build/src/rules/intf_referencing_clas.js +3 -3
  68. package/build/src/rules/invalid_table_index.js +2 -2
  69. package/build/src/rules/line_break_style.js +2 -2
  70. package/build/src/rules/line_length.js +2 -2
  71. package/build/src/rules/line_only_punc.js +1 -1
  72. package/build/src/rules/local_class_naming.js +2 -2
  73. package/build/src/rules/local_variable_names.js +6 -6
  74. package/build/src/rules/macro_naming.js +2 -2
  75. package/build/src/rules/main_file_contents.js +4 -4
  76. package/build/src/rules/many_parentheses.js +10 -10
  77. package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
  78. package/build/src/rules/max_one_statement.js +5 -5
  79. package/build/src/rules/method_length.js +2 -2
  80. package/build/src/rules/method_overwrites_builtin.js +12 -12
  81. package/build/src/rules/method_parameter_names.js +4 -4
  82. package/build/src/rules/mix_returning.js +8 -8
  83. package/build/src/rules/nesting.js +1 -1
  84. package/build/src/rules/no_aliases.js +5 -5
  85. package/build/src/rules/no_chained_assignment.js +1 -1
  86. package/build/src/rules/no_comments_between_methods.js +12 -12
  87. package/build/src/rules/no_external_form_calls.js +2 -2
  88. package/build/src/rules/no_inline_in_optional_branches.js +12 -12
  89. package/build/src/rules/no_macros.js +4 -4
  90. package/build/src/rules/no_prefixes.js +6 -6
  91. package/build/src/rules/no_public_attributes.js +7 -7
  92. package/build/src/rules/no_yoda_conditions.js +4 -4
  93. package/build/src/rules/nrob_consistency.js +2 -2
  94. package/build/src/rules/obsolete_statement.js +51 -51
  95. package/build/src/rules/omit_parameter_name.js +3 -3
  96. package/build/src/rules/omit_receiving.js +13 -13
  97. package/build/src/rules/parser_702_chaining.js +2 -2
  98. package/build/src/rules/parser_error.js +2 -2
  99. package/build/src/rules/parser_missing_space.js +1 -1
  100. package/build/src/rules/prefer_inline.js +16 -16
  101. package/build/src/rules/prefer_is_not.js +9 -9
  102. package/build/src/rules/prefer_raise_exception_new.js +5 -5
  103. package/build/src/rules/prefer_returning_to_exporting.js +4 -4
  104. package/build/src/rules/prefer_xsdbool.js +2 -2
  105. package/build/src/rules/preferred_compare_operator.js +2 -2
  106. package/build/src/rules/prefix_is_current_class.js +6 -6
  107. package/build/src/rules/reduce_procedural_code.js +17 -17
  108. package/build/src/rules/redundant_conversion.js +253 -0
  109. package/build/src/rules/remove_descriptions.js +4 -4
  110. package/build/src/rules/rfc_error_handling.js +7 -7
  111. package/build/src/rules/select_add_order_by.js +5 -5
  112. package/build/src/rules/select_performance.js +5 -5
  113. package/build/src/rules/select_single_full_key.js +2 -2
  114. package/build/src/rules/selection_screen_texts_missing.js +2 -2
  115. package/build/src/rules/sicf_consistency.js +2 -2
  116. package/build/src/rules/slow_parameter_passing.js +16 -16
  117. package/build/src/rules/space_before_dot.js +2 -2
  118. package/build/src/rules/sql_escape_host_variables.js +1 -1
  119. package/build/src/rules/sql_value_conversion.js +6 -6
  120. package/build/src/rules/start_at_tab.js +1 -1
  121. package/build/src/rules/static_call_via_instance.js +4 -4
  122. package/build/src/rules/strict_sql.js +6 -6
  123. package/build/src/rules/sy_modification.js +6 -6
  124. package/build/src/rules/tabl_enhancement_category.js +2 -2
  125. package/build/src/rules/tables_declared_locally.js +2 -2
  126. package/build/src/rules/type_form_parameters.js +2 -2
  127. package/build/src/rules/unnecessary_pragma.js +29 -29
  128. package/build/src/rules/unnecessary_return.js +11 -11
  129. package/build/src/rules/unused_macros.js +6 -6
  130. package/build/src/rules/unused_methods.js +12 -12
  131. package/build/src/rules/unused_variables.js +12 -12
  132. package/build/src/rules/use_bool_expression.js +8 -8
  133. package/build/src/rules/use_class_based_exceptions.js +8 -8
  134. package/build/src/rules/use_line_exists.js +7 -7
  135. package/build/src/rules/use_new.js +4 -4
  136. package/build/src/rules/when_others_last.js +6 -6
  137. package/build/src/rules/xml_consistency.js +3 -3
  138. package/package.json +72 -72
@@ -0,0 +1,253 @@
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.RedundantConversion = exports.RedundantConversionConf = void 0;
37
+ const Expressions = __importStar(require("../abap/2_statements/expressions"));
38
+ const Statements = __importStar(require("../abap/2_statements/statements"));
39
+ const _reference_1 = require("../abap/5_syntax/_reference");
40
+ const constant_1 = require("../abap/5_syntax/expressions/constant");
41
+ const syntax_1 = require("../abap/5_syntax/syntax");
42
+ const nodes_1 = require("../abap/nodes");
43
+ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
44
+ const basic_1 = require("../abap/types/basic");
45
+ const issue_1 = require("../issue");
46
+ const _abap_object_1 = require("../objects/_abap_object");
47
+ const _basic_rule_config_1 = require("./_basic_rule_config");
48
+ const _irule_1 = require("./_irule");
49
+ const edit_helper_1 = require("../edit_helper");
50
+ const version_1 = require("../version");
51
+ class RedundantConversionConf extends _basic_rule_config_1.BasicRuleConfig {
52
+ }
53
+ exports.RedundantConversionConf = RedundantConversionConf;
54
+ class RedundantConversion {
55
+ constructor() {
56
+ this.conf = new RedundantConversionConf();
57
+ }
58
+ getMetadata() {
59
+ return {
60
+ key: "redundant_conversion",
61
+ title: "Redundant Conversion",
62
+ shortDescription: `Find redundant CONV expressions`,
63
+ extendedInformation: `Reports CONV expressions whose operand already has the conversion's target type.`,
64
+ tags: [_irule_1.RuleTag.Quickfix],
65
+ badExample: `DATA text TYPE string.
66
+ text = CONV string( text ).`,
67
+ goodExample: `DATA text TYPE string.
68
+ text = text.`,
69
+ };
70
+ }
71
+ getConfig() {
72
+ return this.conf;
73
+ }
74
+ setConfig(conf) {
75
+ this.conf = conf;
76
+ }
77
+ initialize(reg) {
78
+ this.reg = reg;
79
+ return this;
80
+ }
81
+ run(obj) {
82
+ var _a, _b;
83
+ if (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
84
+ && !this.reg.getConfig().isOpenABAP()) {
85
+ return [];
86
+ }
87
+ if (!(obj instanceof _abap_object_1.ABAPObject)) {
88
+ return [];
89
+ }
90
+ const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
91
+ if (syntax.issues.length > 0) {
92
+ return [];
93
+ }
94
+ const issues = [];
95
+ for (const file of obj.getABAPFiles()) {
96
+ const structure = file.getStructure();
97
+ if (structure === undefined) {
98
+ continue;
99
+ }
100
+ for (const source of structure.findAllExpressions(Expressions.Source)) {
101
+ if (source.getFirstToken().getStr().toUpperCase() !== "CONV") {
102
+ continue;
103
+ }
104
+ const typeExpression = source.findDirectExpression(Expressions.TypeNameOrInfer);
105
+ const bodySource = (_a = source.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);
106
+ if (typeExpression === undefined
107
+ || bodySource === undefined) {
108
+ continue;
109
+ }
110
+ const scope = syntax.spaghetti.lookupPosition(source.getFirstToken().getStart(), file.getFilename());
111
+ if (scope === undefined) {
112
+ continue;
113
+ }
114
+ const target = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.InferredType
115
+ && reference.position.getStart().equals(typeExpression.getFirstToken().getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
116
+ const operandType = this.sourceType(bodySource, scope);
117
+ if (!(target instanceof _typed_identifier_1.TypedIdentifier)) {
118
+ continue;
119
+ }
120
+ const operandHasSameType = operandType !== undefined && this.sameType(target.getType(), operandType);
121
+ const arithmeticHasSameContext = this.arithmeticUsesSameTargetType(source, bodySource, file, scope, target.getType());
122
+ if (operandHasSameType === false && arithmeticHasSameContext === false) {
123
+ continue;
124
+ }
125
+ const closingParen = source.getDirectTokens().find(token => token.getStr() === ")" && token.getStart().isAfter(bodySource.getLastToken().getStart()));
126
+ if (closingParen === undefined) {
127
+ continue;
128
+ }
129
+ const preserveParentheses = bodySource.findDirectExpression(Expressions.ArithOperator) !== undefined
130
+ || bodySource.findDirectTokenByText("&&") !== undefined;
131
+ // Apply the later edit first so the original positions remain valid when
132
+ // both parts of the CONV wrapper are changed on the same line.
133
+ const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.replaceRange(file, bodySource.getLastToken().getEnd(), closingParen.getEnd(), preserveParentheses ? ")" : ""), edit_helper_1.EditHelper.replaceRange(file, source.getFirstToken().getStart(), bodySource.getFirstToken().getStart(), preserveParentheses ? "(" : ""));
134
+ issues.push(issue_1.Issue.atRange(file, source.getFirstToken().getStart(), closingParen.getEnd(), "Redundant CONV expression", this.getMetadata().key, this.conf.severity, fix));
135
+ }
136
+ }
137
+ return issues;
138
+ }
139
+ arithmeticUsesSameTargetType(conversion, bodySource, file, scope, conversionType) {
140
+ var _a, _b;
141
+ if (bodySource.findDirectExpression(Expressions.ArithOperator) === undefined) {
142
+ return false;
143
+ }
144
+ const statement = file.getStatements().find(candidate => candidate.includesToken(conversion.getFirstToken()));
145
+ if (!((statement === null || statement === void 0 ? void 0 : statement.get()) instanceof Statements.Move)) {
146
+ return false;
147
+ }
148
+ const targetToken = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
149
+ if (targetToken === undefined) {
150
+ return false;
151
+ }
152
+ const assignmentTarget = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataWriteReference
153
+ && reference.position.getStart().equals(targetToken.getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
154
+ return assignmentTarget instanceof _typed_identifier_1.TypedIdentifier
155
+ && this.sameType(conversionType, assignmentTarget.getType());
156
+ }
157
+ sourceType(source, scope) {
158
+ let context;
159
+ for (const child of source.getChildren()) {
160
+ if (!(child instanceof nodes_1.ExpressionNode)) {
161
+ continue;
162
+ }
163
+ else if (child.get() instanceof Expressions.FieldChain) {
164
+ context = this.fieldChainType(child, scope);
165
+ if (context === undefined) {
166
+ return undefined;
167
+ }
168
+ }
169
+ else if (child.get() instanceof Expressions.Constant) {
170
+ context = this.infer(context, constant_1.Constant.runSyntax(child));
171
+ }
172
+ else if (child.get() instanceof Expressions.Source) {
173
+ context = this.infer(context, this.sourceType(child, scope));
174
+ }
175
+ else if (child.get() instanceof Expressions.ArithOperator) {
176
+ if (child.concatTokens() === "**") {
177
+ context = new basic_1.FloatType();
178
+ }
179
+ }
180
+ else {
181
+ return undefined;
182
+ }
183
+ }
184
+ if (source.findDirectTokenByText("&&")) {
185
+ return basic_1.StringType.get();
186
+ }
187
+ return context;
188
+ }
189
+ fieldChainType(fieldChain, scope) {
190
+ var _a;
191
+ const operand = (_a = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataReadReference
192
+ && reference.position.getStart().equals(fieldChain.getFirstToken().getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
193
+ if (!(operand instanceof _typed_identifier_1.TypedIdentifier)) {
194
+ return undefined;
195
+ }
196
+ let type = operand.getType();
197
+ for (const child of fieldChain.getChildren()) {
198
+ if (!(child instanceof nodes_1.ExpressionNode)
199
+ || child.get() instanceof Expressions.SourceField) {
200
+ continue;
201
+ }
202
+ else if (child.get() instanceof Expressions.ComponentName) {
203
+ if (type instanceof basic_1.TableType) {
204
+ type = type.getRowType();
205
+ }
206
+ if (!(type instanceof basic_1.StructureType)) {
207
+ return undefined;
208
+ }
209
+ type = type.getComponentByName(child.concatTokens());
210
+ }
211
+ else {
212
+ // Offsets, table expressions, attributes, and dereferences need more
213
+ // context than the initial data reference provides.
214
+ return undefined;
215
+ }
216
+ }
217
+ return type;
218
+ }
219
+ infer(context, found) {
220
+ if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
221
+ return context;
222
+ }
223
+ else if (context instanceof basic_1.IntegerType && found instanceof basic_1.HexType) {
224
+ return context;
225
+ }
226
+ else if ((context instanceof basic_1.IntegerType || context instanceof basic_1.FloatType) && (found === null || found === void 0 ? void 0 : found.isGeneric())) {
227
+ return context;
228
+ }
229
+ return found;
230
+ }
231
+ sameType(first, second) {
232
+ var _a, _b;
233
+ if (first instanceof basic_1.UnknownType
234
+ || second instanceof basic_1.UnknownType
235
+ || first instanceof basic_1.VoidType
236
+ || second instanceof basic_1.VoidType
237
+ || first.isGeneric()
238
+ || second.isGeneric()) {
239
+ return false;
240
+ }
241
+ if (first.constructor !== second.constructor) {
242
+ return false;
243
+ }
244
+ if (first instanceof basic_1.StructureType || first instanceof basic_1.TableType) {
245
+ const firstName = (_a = first.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
246
+ const secondName = (_b = second.getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
247
+ return firstName !== undefined && firstName === secondName;
248
+ }
249
+ return first.toABAP() === second.toABAP();
250
+ }
251
+ }
252
+ exports.RedundantConversion = RedundantConversion;
253
+ //# sourceMappingURL=redundant_conversion.js.map
@@ -59,10 +59,10 @@ class RemoveDescriptions {
59
59
  return {
60
60
  key: "remove_descriptions",
61
61
  title: "Remove descriptions",
62
- shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.
63
-
64
- Class descriptions are required, see rule description_empty.
65
-
62
+ shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.
63
+
64
+ Class descriptions are required, see rule description_empty.
65
+
66
66
  Consider using ABAP Doc for documentation.`,
67
67
  tags: [],
68
68
  };
@@ -55,14 +55,14 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
55
55
  tags: [_irule_1.RuleTag.SingleFile],
56
56
  shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,
57
57
  extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,
58
- badExample: `CALL FUNCTION 'ZRFC'
58
+ badExample: `CALL FUNCTION 'ZRFC'
59
59
  DESTINATION lv_rfc.`,
60
- goodExample: `CALL FUNCTION 'ZRFC'
61
- DESTINATION lv_rfc
62
- EXCEPTIONS
63
- system_failure = 1 MESSAGE msg
64
- communication_failure = 2 MESSAGE msg
65
- resource_failure = 3
60
+ goodExample: `CALL FUNCTION 'ZRFC'
61
+ DESTINATION lv_rfc
62
+ EXCEPTIONS
63
+ system_failure = 1 MESSAGE msg
64
+ communication_failure = 2 MESSAGE msg
65
+ resource_failure = 3
66
66
  OTHERS = 4.`,
67
67
  };
68
68
  }
@@ -58,11 +58,11 @@ class SelectAddOrderBy {
58
58
  key: "select_add_order_by",
59
59
  title: "SELECT add ORDER BY",
60
60
  shortDescription: `SELECTs add ORDER BY clause`,
61
- extendedInformation: `
62
- This will make sure that the SELECT statement returns results in the same sequence on different databases
63
-
64
- add ORDER BY PRIMARY KEY if in doubt
65
-
61
+ extendedInformation: `
62
+ This will make sure that the SELECT statement returns results in the same sequence on different databases
63
+
64
+ add ORDER BY PRIMARY KEY if in doubt
65
+
66
66
  If the target is a sorted/hashed table, no issue is reported`,
67
67
  tags: [_irule_1.RuleTag.SingleFile],
68
68
  badExample: `SELECT * FROM db INTO TABLE @DATA(tab).`,
@@ -67,14 +67,14 @@ class SelectPerformance {
67
67
  key: "select_performance",
68
68
  title: "SELECT performance",
69
69
  shortDescription: `Various checks regarding SELECT performance.`,
70
- extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE
71
-
70
+ extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE
71
+
72
72
  SELECT *: not reported if using INTO/APPENDING CORRESPONDING FIELDS OF`,
73
73
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],
74
- badExample: `SELECT field1, field2 FROM table
75
- INTO @DATA(structure) UP TO 1 ROWS ORDER BY field3 DESCENDING.
74
+ badExample: `SELECT field1, field2 FROM table
75
+ INTO @DATA(structure) UP TO 1 ROWS ORDER BY field3 DESCENDING.
76
76
  ENDSELECT.`,
77
- goodExample: `SELECT field1, field2 FROM table UP TO 1 ROWS
77
+ goodExample: `SELECT field1, field2 FROM table UP TO 1 ROWS
78
78
  INTO TABLE @DATA(table) ORDER BY field3 DESCENDING`,
79
79
  };
80
80
  }
@@ -59,8 +59,8 @@ class SelectSingleFullKey {
59
59
  key: "select_single_full_key",
60
60
  title: "Detect SELECT SINGLE which are possibily not unique",
61
61
  shortDescription: `Detect SELECT SINGLE which are possibily not unique`,
62
- extendedInformation: `Table definitions must be known, ie. inside the errorNamespace
63
-
62
+ extendedInformation: `Table definitions must be known, ie. inside the errorNamespace
63
+
64
64
  If the statement contains a JOIN it is not checked`,
65
65
  pseudoComment: "EC CI_NOORDER",
66
66
  tags: [_irule_1.RuleTag.Quickfix],
@@ -18,8 +18,8 @@ class SelectionScreenTextsMissing {
18
18
  key: "selection_screen_texts_missing",
19
19
  title: "Selection screen texts missing",
20
20
  shortDescription: `Checks that selection screen parameters and select-options have selection texts`,
21
- extendedInformation: `Excludes parameters and select-options that:
22
- * are inside a "SELECTION-SCREEN BEGIN OF LINE" block
21
+ extendedInformation: `Excludes parameters and select-options that:
22
+ * are inside a "SELECTION-SCREEN BEGIN OF LINE" block
23
23
  * have the addition "NO-DISPLAY"`,
24
24
  };
25
25
  }
@@ -24,8 +24,8 @@ class SICFConsistency {
24
24
  key: "sicf_consistency",
25
25
  title: "SICF consistency",
26
26
  shortDescription: `Checks the validity of ICF services`,
27
- extendedInformation: `* Class defined in handler must exist
28
- * Class must not have any syntax errors
27
+ extendedInformation: `* Class defined in handler must exist
28
+ * Class must not have any syntax errors
29
29
  * Class must implement interface IF_HTTP_EXTENSION`,
30
30
  };
31
31
  }
@@ -23,23 +23,23 @@ class SlowParameterPassing {
23
23
  shortDescription: `Detects slow pass by value passing for methods where parameter is not changed`,
24
24
  extendedInformation: `Method parameters defined in interfaces is not checked`,
25
25
  tags: [_irule_1.RuleTag.Performance, _irule_1.RuleTag.Quickfix],
26
- badExample: `CLASS lcl DEFINITION.
27
- PUBLIC SECTION.
28
- METHODS bar IMPORTING VALUE(sdf) TYPE string.
29
- ENDCLASS.
30
- CLASS lcl IMPLEMENTATION.
31
- METHOD bar.
32
- WRITE sdf.
33
- ENDMETHOD.
26
+ badExample: `CLASS lcl DEFINITION.
27
+ PUBLIC SECTION.
28
+ METHODS bar IMPORTING VALUE(sdf) TYPE string.
29
+ ENDCLASS.
30
+ CLASS lcl IMPLEMENTATION.
31
+ METHOD bar.
32
+ WRITE sdf.
33
+ ENDMETHOD.
34
34
  ENDCLASS.`,
35
- goodExample: `CLASS lcl DEFINITION.
36
- PUBLIC SECTION.
37
- METHODS bar IMPORTING sdf TYPE string.
38
- ENDCLASS.
39
- CLASS lcl IMPLEMENTATION.
40
- METHOD bar.
41
- WRITE sdf.
42
- ENDMETHOD.
35
+ goodExample: `CLASS lcl DEFINITION.
36
+ PUBLIC SECTION.
37
+ METHODS bar IMPORTING sdf TYPE string.
38
+ ENDCLASS.
39
+ CLASS lcl IMPLEMENTATION.
40
+ METHOD bar.
41
+ WRITE sdf.
42
+ ENDMETHOD.
43
43
  ENDCLASS.`,
44
44
  };
45
45
  }
@@ -62,8 +62,8 @@ class SpaceBeforeDot extends _abap_rule_1.ABAPRule {
62
62
  key: "space_before_dot",
63
63
  title: "Space before dot",
64
64
  shortDescription: `Checks for extra spaces before dots at the ends of statements`,
65
- extendedInformation: `
66
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent
65
+ extendedInformation: `
66
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent
67
67
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#condense-your-code`,
68
68
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
69
69
  badExample: `WRITE bar .`,
@@ -75,7 +75,7 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
75
75
  }
76
76
  if (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
77
77
  && this.reg.getConfig().getLanguageVersion() !== version_1.LanguageVersion.Cloud
78
- && !this.reg.getConfig().getOpenABAP()) {
78
+ && !this.reg.getConfig().isOpenABAP()) {
79
79
  return [];
80
80
  }
81
81
  for (const s of file.getStatements()) {
@@ -18,12 +18,12 @@ class SQLValueConversion {
18
18
  key: "sql_value_conversion",
19
19
  title: "Implicit SQL Value Conversion",
20
20
  shortDescription: `Ensure types match when selecting from database`,
21
- extendedInformation: `
22
- * Integer to CHAR conversion
23
- * Integer to NUMC conversion
24
- * NUMC to Integer conversion
25
- * CHAR to Integer conversion
26
- * Source field longer than database field, CHAR -> CHAR
21
+ extendedInformation: `
22
+ * Integer to CHAR conversion
23
+ * Integer to NUMC conversion
24
+ * NUMC to Integer conversion
25
+ * CHAR to Integer conversion
26
+ * Source field longer than database field, CHAR -> CHAR
27
27
  * Source field longer than database field, NUMC -> NUMC`,
28
28
  tags: [],
29
29
  };
@@ -20,7 +20,7 @@ class StartAtTab extends _abap_rule_1.ABAPRule {
20
20
  key: "start_at_tab",
21
21
  title: "Start at tab",
22
22
  shortDescription: `Checks that statements start at tabstops.`,
23
- extendedInformation: `Reports max 100 issues per file
23
+ extendedInformation: `Reports max 100 issues per file
24
24
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,
25
25
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
26
26
  badExample: ` WRITE a.`,
@@ -29,11 +29,11 @@ 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( ).
32
+ badExample: `METHOD run.
33
+ NEW lcl_helper( )->static_method( ).
34
34
  ENDMETHOD.`,
35
- goodExample: `METHOD run.
36
- lcl_helper=>static_method( ).
35
+ goodExample: `METHOD run.
36
+ lcl_helper=>static_method( ).
37
37
  ENDMETHOD.`,
38
38
  };
39
39
  }
@@ -55,12 +55,12 @@ class StrictSQL extends _abap_rule_1.ABAPRule {
55
55
  key: "strict_sql",
56
56
  title: "Strict SQL",
57
57
  shortDescription: `Strict SQL`,
58
- extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapinto_clause.htm
59
-
60
- https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
61
-
62
- Also see separate rule sql_escape_host_variables
63
-
58
+ extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapinto_clause.htm
59
+
60
+ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
61
+
62
+ Also see separate rule sql_escape_host_variables
63
+
64
64
  Activates from v750 and up`,
65
65
  tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
66
66
  badExample: `SELECT * FROM ztabl INTO TABLE @rt_content WHERE type = @iv_type ORDER BY PRIMARY KEY.`,
@@ -52,14 +52,14 @@ class SyModification extends _abap_rule_1.ABAPRule {
52
52
  key: "sy_modification",
53
53
  title: "Modification of SY fields",
54
54
  shortDescription: `Finds modification of sy fields`,
55
- extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm
56
-
57
- Changes to SY-TVAR* fields are not reported
58
-
59
- Modification of SY fields is not allwed in ABAP Cloud language version,
55
+ extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm
56
+
57
+ Changes to SY-TVAR* fields are not reported
58
+
59
+ Modification of SY fields is not allwed in ABAP Cloud language version,
60
60
  https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/ABENSYSTEM_FIELDS.html`,
61
61
  tags: [_irule_1.RuleTag.SingleFile],
62
- badExample: `sy-uname = 2.
62
+ badExample: `sy-uname = 2.
63
63
  sy = sy.`,
64
64
  };
65
65
  }
@@ -17,8 +17,8 @@ class TABLEnhancementCategory {
17
17
  key: "tabl_enhancement_category",
18
18
  title: "TABL enhancement category must be set",
19
19
  shortDescription: `Checks that tables do not have the enhancement category 'not classified'.`,
20
- extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.
21
-
20
+ extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.
21
+
22
22
  You may use standard report RS_DDIC_CLASSIFICATION_FINAL for adjustment.`,
23
23
  tags: [],
24
24
  };
@@ -55,8 +55,8 @@ class TablesDeclaredLocally extends _abap_rule_1.ABAPRule {
55
55
  shortDescription: `TABLES are always global, so declare them globally`,
56
56
  extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abaptables.htm`,
57
57
  tags: [_irule_1.RuleTag.SingleFile],
58
- badExample: `FORM foo.
59
- TABLES t100.
58
+ badExample: `FORM foo.
59
+ TABLES t100.
60
60
  ENDFORM.`,
61
61
  goodExample: `TABLES t000.`,
62
62
  };
@@ -54,9 +54,9 @@ class TypeFormParameters extends _abap_rule_1.ABAPRule {
54
54
  title: "Type FORM parameters",
55
55
  shortDescription: `Checks for untyped FORM parameters`,
56
56
  tags: [_irule_1.RuleTag.SingleFile],
57
- badExample: `FORM foo USING bar.
57
+ badExample: `FORM foo USING bar.
58
58
  ENDFORM.`,
59
- goodExample: `FORM foo USING bar TYPE string.
59
+ goodExample: `FORM foo USING bar TYPE string.
60
60
  ENDFORM.`,
61
61
  };
62
62
  }
@@ -62,38 +62,38 @@ class UnnecessaryPragma extends _abap_rule_1.ABAPRule {
62
62
  key: "unnecessary_pragma",
63
63
  title: "Unnecessary Pragma",
64
64
  shortDescription: `Finds pragmas which can be removed`,
65
- extendedInformation: `* NO_HANDLER with handler
66
-
67
- * NEEDED without definition
68
-
69
- * NO_TEXT without texts
70
-
71
- * SUBRC_OK where sy-subrc is checked
72
-
65
+ extendedInformation: `* NO_HANDLER with handler
66
+
67
+ * NEEDED without definition
68
+
69
+ * NO_TEXT without texts
70
+
71
+ * SUBRC_OK where sy-subrc is checked
72
+
73
73
  NO_HANDLER inside macros are not checked`,
74
74
  tags: [_irule_1.RuleTag.SingleFile],
75
- badExample: `TRY.
76
- ...
77
- CATCH zcx_abapgit_exception ##NO_HANDLER.
78
- RETURN. " it has a handler
79
- ENDTRY.
80
- MESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.
81
- SELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.
82
- IF sy-subrc <> 0.
75
+ badExample: `TRY.
76
+ ...
77
+ CATCH zcx_abapgit_exception ##NO_HANDLER.
78
+ RETURN. " it has a handler
79
+ ENDTRY.
80
+ MESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.
81
+ SELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.
82
+ IF sy-subrc <> 0.
83
83
  ENDIF.`,
84
- goodExample: `TRY.
85
- ...
86
- CATCH zcx_abapgit_exception.
87
- RETURN.
88
- ENDTRY.
89
- MESSAGE w125(zbar) WITH c_foo INTO message.
90
- SELECT SINGLE * FROM tadir INTO @DATA(sdfs).
91
- IF sy-subrc <> 0.
92
- ENDIF.
93
-
94
- DATA: BEGIN OF blah ##NEEDED,
95
- test1 TYPE string,
96
- test2 TYPE string,
84
+ goodExample: `TRY.
85
+ ...
86
+ CATCH zcx_abapgit_exception.
87
+ RETURN.
88
+ ENDTRY.
89
+ MESSAGE w125(zbar) WITH c_foo INTO message.
90
+ SELECT SINGLE * FROM tadir INTO @DATA(sdfs).
91
+ IF sy-subrc <> 0.
92
+ ENDIF.
93
+
94
+ DATA: BEGIN OF blah ##NEEDED,
95
+ test1 TYPE string,
96
+ test2 TYPE string,
97
97
  END OF blah.`,
98
98
  };
99
99
  }
@@ -61,18 +61,18 @@ class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
61
61
  shortDescription: `Finds unnecessary RETURN statements`,
62
62
  extendedInformation: `Finds unnecessary RETURN statements`,
63
63
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
64
- badExample: `FORM hello1.
65
- WRITE 'world'.
66
- RETURN.
67
- ENDFORM.
68
-
69
- FORM foo.
70
- IF 1 = 2.
71
- RETURN.
72
- ENDIF.
64
+ badExample: `FORM hello1.
65
+ WRITE 'world'.
66
+ RETURN.
67
+ ENDFORM.
68
+
69
+ FORM foo.
70
+ IF 1 = 2.
71
+ RETURN.
72
+ ENDIF.
73
73
  ENDFORM.`,
74
- goodExample: `FORM hello2.
75
- WRITE 'world'.
74
+ goodExample: `FORM hello2.
75
+ WRITE 'world'.
76
76
  ENDFORM.`,
77
77
  };
78
78
  }