@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.
- package/README.md +6 -6
- package/build/abaplint.d.ts +2 -2
- package/build/src/abap/5_syntax/_current_scope.js +1 -1
- package/build/src/abap/5_syntax/expressions/_check_offset_length.js +59 -0
- package/build/src/abap/5_syntax/expressions/method_call_param.js +4 -0
- package/build/src/abap/5_syntax/expressions/method_parameters.js +20 -6
- package/build/src/abap/5_syntax/statements/catch.js +17 -1
- package/build/src/config.js +1 -1
- package/build/src/lsp/help.js +10 -10
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +4 -4
- package/build/src/rules/abapdoc.js +4 -4
- package/build/src/rules/add_test_attributes.js +20 -20
- package/build/src/rules/align_parameters.js +40 -40
- package/build/src/rules/align_type_expressions.js +28 -28
- package/build/src/rules/ambiguous_statement.js +7 -7
- package/build/src/rules/avoid_use.js +10 -10
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +13 -13
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/cds_association_name.js +6 -6
- package/build/src/rules/cds_comment_style.js +4 -4
- package/build/src/rules/cds_field_order.js +12 -12
- package/build/src/rules/cds_legacy_view.js +4 -4
- package/build/src/rules/cds_naming.js +7 -7
- package/build/src/rules/chain_mainly_declarations.js +4 -4
- package/build/src/rules/change_if_to_case.js +8 -8
- package/build/src/rules/check_abstract.js +2 -2
- package/build/src/rules/check_comments.js +4 -4
- package/build/src/rules/check_include.js +4 -4
- package/build/src/rules/check_subrc.js +8 -8
- package/build/src/rules/class_attribute_names.js +6 -6
- package/build/src/rules/classic_exceptions_overlap.js +10 -10
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +10 -10
- package/build/src/rules/contains_tab.js +2 -2
- package/build/src/rules/cyclic_oo.js +4 -4
- package/build/src/rules/dangerous_statement.js +1 -1
- package/build/src/rules/db_operation_in_loop.js +9 -9
- package/build/src/rules/definitions_top.js +6 -6
- package/build/src/rules/downport.js +92 -92
- package/build/src/rules/easy_to_find_messages.js +6 -6
- package/build/src/rules/empty_event.js +6 -6
- package/build/src/rules/empty_line_in_statement.js +2 -2
- package/build/src/rules/empty_structure.js +6 -6
- package/build/src/rules/exit_or_check.js +7 -7
- package/build/src/rules/expand_macros.js +5 -5
- package/build/src/rules/exporting.js +1 -1
- package/build/src/rules/forbidden_identifier.js +1 -1
- package/build/src/rules/forbidden_void_type.js +2 -2
- package/build/src/rules/form_tables_obsolete.js +2 -2
- package/build/src/rules/fully_type_itabs.js +2 -2
- package/build/src/rules/function_module_recommendations.js +2 -2
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +10 -10
- package/build/src/rules/identical_conditions.js +12 -12
- package/build/src/rules/identical_contents.js +14 -14
- package/build/src/rules/identical_descriptions.js +6 -6
- package/build/src/rules/identical_move.js +2 -2
- package/build/src/rules/if_in_if.js +35 -35
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/implicit_start_of_selection.js +4 -4
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/indentation.js +16 -16
- package/build/src/rules/index.js +1 -0
- package/build/src/rules/inline_data_old_versions.js +1 -1
- package/build/src/rules/intf_referencing_clas.js +3 -3
- package/build/src/rules/invalid_table_index.js +2 -2
- package/build/src/rules/line_break_style.js +2 -2
- package/build/src/rules/line_length.js +2 -2
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_class_naming.js +2 -2
- package/build/src/rules/local_variable_names.js +6 -6
- package/build/src/rules/macro_naming.js +2 -2
- package/build/src/rules/main_file_contents.js +4 -4
- package/build/src/rules/many_parentheses.js +10 -10
- package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
- package/build/src/rules/max_one_statement.js +5 -5
- package/build/src/rules/method_length.js +2 -2
- package/build/src/rules/method_overwrites_builtin.js +12 -12
- package/build/src/rules/method_parameter_names.js +4 -4
- package/build/src/rules/mix_returning.js +8 -8
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_aliases.js +5 -5
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_comments_between_methods.js +12 -12
- package/build/src/rules/no_external_form_calls.js +2 -2
- package/build/src/rules/no_inline_in_optional_branches.js +12 -12
- package/build/src/rules/no_macros.js +4 -4
- package/build/src/rules/no_prefixes.js +6 -6
- package/build/src/rules/no_public_attributes.js +7 -7
- package/build/src/rules/no_yoda_conditions.js +4 -4
- package/build/src/rules/nrob_consistency.js +2 -2
- package/build/src/rules/obsolete_statement.js +51 -51
- package/build/src/rules/omit_parameter_name.js +3 -3
- package/build/src/rules/omit_receiving.js +13 -13
- package/build/src/rules/parser_702_chaining.js +2 -2
- package/build/src/rules/parser_error.js +2 -2
- package/build/src/rules/parser_missing_space.js +1 -1
- package/build/src/rules/prefer_inline.js +16 -16
- package/build/src/rules/prefer_is_not.js +9 -9
- package/build/src/rules/prefer_raise_exception_new.js +5 -5
- package/build/src/rules/prefer_returning_to_exporting.js +4 -4
- package/build/src/rules/prefer_xsdbool.js +2 -2
- package/build/src/rules/preferred_compare_operator.js +2 -2
- package/build/src/rules/prefix_is_current_class.js +6 -6
- package/build/src/rules/reduce_procedural_code.js +17 -17
- package/build/src/rules/redundant_conversion.js +253 -0
- package/build/src/rules/remove_descriptions.js +4 -4
- package/build/src/rules/rfc_error_handling.js +7 -7
- package/build/src/rules/select_add_order_by.js +5 -5
- package/build/src/rules/select_performance.js +5 -5
- package/build/src/rules/select_single_full_key.js +2 -2
- package/build/src/rules/selection_screen_texts_missing.js +2 -2
- package/build/src/rules/sicf_consistency.js +2 -2
- package/build/src/rules/slow_parameter_passing.js +16 -16
- package/build/src/rules/space_before_dot.js +2 -2
- package/build/src/rules/sql_escape_host_variables.js +1 -1
- package/build/src/rules/sql_value_conversion.js +6 -6
- package/build/src/rules/start_at_tab.js +1 -1
- package/build/src/rules/static_call_via_instance.js +4 -4
- package/build/src/rules/strict_sql.js +6 -6
- package/build/src/rules/sy_modification.js +6 -6
- package/build/src/rules/tabl_enhancement_category.js +2 -2
- package/build/src/rules/tables_declared_locally.js +2 -2
- package/build/src/rules/type_form_parameters.js +2 -2
- package/build/src/rules/unnecessary_pragma.js +29 -29
- package/build/src/rules/unnecessary_return.js +11 -11
- package/build/src/rules/unused_macros.js +6 -6
- package/build/src/rules/unused_methods.js +12 -12
- package/build/src/rules/unused_variables.js +12 -12
- package/build/src/rules/use_bool_expression.js +8 -8
- package/build/src/rules/use_class_based_exceptions.js +8 -8
- package/build/src/rules/use_line_exists.js +7 -7
- package/build/src/rules/use_new.js +4 -4
- package/build/src/rules/when_others_last.js +6 -6
- package/build/src/rules/xml_consistency.js +3 -3
- package/package.json +72 -72
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @abaplint/core
|
|
2
|
-
|
|
3
|
-
[abaplint](https://abaplint.org) core library
|
|
4
|
-
|
|
5
|
-
Exposes functionality like the parser and rules, which can be used in other projects.
|
|
6
|
-
|
|
1
|
+
# @abaplint/core
|
|
2
|
+
|
|
3
|
+
[abaplint](https://abaplint.org) core library
|
|
4
|
+
|
|
5
|
+
Exposes functionality like the parser and rules, which can be used in other projects.
|
|
6
|
+
|
|
7
7
|
For more information see https://github.com/abaplint/abaplint
|
package/build/abaplint.d.ts
CHANGED
|
@@ -1491,7 +1491,7 @@ export declare class Config implements IConfiguration {
|
|
|
1491
1491
|
getGlobal(): IGlobalConfig;
|
|
1492
1492
|
getSyntaxSetttings(): ISyntaxSettings;
|
|
1493
1493
|
getRelease(): ABAPRelease;
|
|
1494
|
-
|
|
1494
|
+
isOpenABAP(): boolean;
|
|
1495
1495
|
getVersion(): Version;
|
|
1496
1496
|
getLanguageVersion(): LanguageVersion;
|
|
1497
1497
|
private checkVersion;
|
|
@@ -3475,7 +3475,7 @@ export declare interface IConfiguration {
|
|
|
3475
3475
|
getVersion(): Version;
|
|
3476
3476
|
getRelease(): ABAPRelease;
|
|
3477
3477
|
getLanguageVersion(): LanguageVersion;
|
|
3478
|
-
|
|
3478
|
+
isOpenABAP(): boolean;
|
|
3479
3479
|
getSyntaxSetttings(): ISyntaxSettings;
|
|
3480
3480
|
readByRule(rule: string): any;
|
|
3481
3481
|
readByKey(rule: string, key: string): any;
|
|
@@ -0,0 +1,59 @@
|
|
|
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.checkOffsetLength = checkOffsetLength;
|
|
37
|
+
const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
38
|
+
const basic_1 = require("../../types/basic");
|
|
39
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
40
|
+
const _builtin_1 = require("../_builtin");
|
|
41
|
+
// Offsets or lengths cannot be specified for STRING or XSTRING fields
|
|
42
|
+
// passed as a method parameter source. Returns true if an issue was reported.
|
|
43
|
+
function checkOffsetLength(source, sourceType, method, input) {
|
|
44
|
+
const chain = source.findDirectExpression(Expressions.FieldChain);
|
|
45
|
+
const isCalculated = source.findDirectExpression(Expressions.Source) !== undefined;
|
|
46
|
+
const hasOffsetOrLength = chain !== undefined
|
|
47
|
+
&& isCalculated === false
|
|
48
|
+
&& (chain.findDirectExpression(Expressions.FieldOffset) !== undefined
|
|
49
|
+
|| chain.findDirectExpression(Expressions.FieldLength) !== undefined);
|
|
50
|
+
if (hasOffsetOrLength
|
|
51
|
+
&& !(method instanceof _builtin_1.BuiltInMethod)
|
|
52
|
+
&& (sourceType instanceof basic_1.StringType || sourceType instanceof basic_1.XStringType)) {
|
|
53
|
+
const message = `Offsets or lengths cannot be specified for fields of type "STRING" or "XSTRING" in the current statement`;
|
|
54
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, source.getFirstToken(), message));
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=_check_offset_length.js.map
|
|
@@ -43,6 +43,7 @@ const source_1 = require("./source");
|
|
|
43
43
|
const _type_utils_1 = require("../_type_utils");
|
|
44
44
|
const _syntax_input_1 = require("../_syntax_input");
|
|
45
45
|
const constant_1 = require("./constant");
|
|
46
|
+
const _check_offset_length_1 = require("./_check_offset_length");
|
|
46
47
|
class MethodCallParam {
|
|
47
48
|
static runSyntax(node, input, method) {
|
|
48
49
|
if (!(node.get() instanceof Expressions.MethodCallParam)) {
|
|
@@ -103,6 +104,9 @@ class MethodCallParam {
|
|
|
103
104
|
let sourceType = undefined;
|
|
104
105
|
if (child.get() instanceof Expressions.Source) {
|
|
105
106
|
sourceType = source_1.Source.runSyntax(child, input, targetType);
|
|
107
|
+
if ((0, _check_offset_length_1.checkOffsetLength)(child, sourceType, method, input)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
106
110
|
}
|
|
107
111
|
else if (child.get() instanceof Expressions.ConstantString) {
|
|
108
112
|
sourceType = constant_1.Constant.runSyntax(child);
|
|
@@ -45,6 +45,7 @@ const _syntax_input_1 = require("../_syntax_input");
|
|
|
45
45
|
const assert_error_1 = require("../assert_error");
|
|
46
46
|
const field_chain_1 = require("./field_chain");
|
|
47
47
|
const _reference_1 = require("../_reference");
|
|
48
|
+
const _check_offset_length_1 = require("./_check_offset_length");
|
|
48
49
|
class MethodParameters {
|
|
49
50
|
constructor() {
|
|
50
51
|
this.requiredParameters = undefined;
|
|
@@ -215,7 +216,6 @@ class MethodParameters {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
parameterListS(node, input, method) {
|
|
218
|
-
var _a;
|
|
219
219
|
if (node === undefined) {
|
|
220
220
|
return [];
|
|
221
221
|
}
|
|
@@ -223,14 +223,21 @@ class MethodParameters {
|
|
|
223
223
|
throw new assert_error_1.AssertError("parameterListS, unexpected node");
|
|
224
224
|
}
|
|
225
225
|
const ret = [];
|
|
226
|
+
const supplied = new Set();
|
|
226
227
|
for (const c of node.getChildren()) {
|
|
227
228
|
if (!(c.get() instanceof Expressions.ParameterS) || !(c instanceof nodes_1.ExpressionNode)) {
|
|
228
229
|
throw new assert_error_1.AssertError("parameterListS, unexpected node, child");
|
|
229
230
|
}
|
|
230
|
-
const
|
|
231
|
-
|
|
231
|
+
const nameNode = c.findDirectExpression(Expressions.ParameterName);
|
|
232
|
+
const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
|
|
233
|
+
if (name === undefined || nameNode === undefined) {
|
|
232
234
|
throw new assert_error_1.AssertError("parameterListS, no name determined");
|
|
233
235
|
}
|
|
236
|
+
if (supplied.has(name)) {
|
|
237
|
+
const message = `Method parameter "${name}" is supplied more than once`;
|
|
238
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), message));
|
|
239
|
+
}
|
|
240
|
+
supplied.add(name);
|
|
234
241
|
const source = c.findDirectExpression(Expressions.Source);
|
|
235
242
|
if (source === undefined) {
|
|
236
243
|
throw new assert_error_1.AssertError("parameterListS, no source found");
|
|
@@ -248,6 +255,7 @@ class MethodParameters {
|
|
|
248
255
|
targetType = method;
|
|
249
256
|
}
|
|
250
257
|
let sourceType = source_1.Source.runSyntax(source, input, targetType);
|
|
258
|
+
(0, _check_offset_length_1.checkOffsetLength)(source, sourceType, method, input);
|
|
251
259
|
if (sourceType === undefined) {
|
|
252
260
|
if (method instanceof basic_1.VoidType) {
|
|
253
261
|
sourceType = method;
|
|
@@ -263,7 +271,6 @@ class MethodParameters {
|
|
|
263
271
|
return ret;
|
|
264
272
|
}
|
|
265
273
|
parameterListT(node, input) {
|
|
266
|
-
var _a;
|
|
267
274
|
if (node === undefined) {
|
|
268
275
|
return [];
|
|
269
276
|
}
|
|
@@ -271,14 +278,21 @@ class MethodParameters {
|
|
|
271
278
|
throw new assert_error_1.AssertError("parameterListT, unexpected node");
|
|
272
279
|
}
|
|
273
280
|
const ret = [];
|
|
281
|
+
const supplied = new Set();
|
|
274
282
|
for (const c of node.getChildren()) {
|
|
275
283
|
if (!(c.get() instanceof Expressions.ParameterT) || !(c instanceof nodes_1.ExpressionNode)) {
|
|
276
284
|
throw new assert_error_1.AssertError("parameterListT, unexpected node, child");
|
|
277
285
|
}
|
|
278
|
-
const
|
|
279
|
-
|
|
286
|
+
const nameNode = c.findDirectExpression(Expressions.ParameterName);
|
|
287
|
+
const name = nameNode === null || nameNode === void 0 ? void 0 : nameNode.getFirstToken().getStr().toUpperCase();
|
|
288
|
+
if (name === undefined || nameNode === undefined) {
|
|
280
289
|
throw new assert_error_1.AssertError("parameterListT, no name determined");
|
|
281
290
|
}
|
|
291
|
+
if (supplied.has(name)) {
|
|
292
|
+
const message = `Method parameter "${name}" is supplied more than once`;
|
|
293
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameNode.getFirstToken(), message));
|
|
294
|
+
}
|
|
295
|
+
supplied.add(name);
|
|
282
296
|
const target = c.findDirectExpression(Expressions.Target);
|
|
283
297
|
if (target === undefined) {
|
|
284
298
|
throw new assert_error_1.AssertError("parameterListT, no target found");
|
|
@@ -41,6 +41,7 @@ const basic_1 = require("../../types/basic");
|
|
|
41
41
|
const target_1 = require("../expressions/target");
|
|
42
42
|
const _reference_1 = require("../_reference");
|
|
43
43
|
const _syntax_input_1 = require("../_syntax_input");
|
|
44
|
+
const _type_utils_1 = require("../_type_utils");
|
|
44
45
|
class Catch {
|
|
45
46
|
runSyntax(node, input) {
|
|
46
47
|
var _a, _b;
|
|
@@ -91,7 +92,22 @@ class Catch {
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
else if (target) {
|
|
94
|
-
target_1.Target.runSyntax(target, input);
|
|
95
|
+
const targetType = target_1.Target.runSyntax(target, input);
|
|
96
|
+
if (targetType instanceof basic_1.ObjectReferenceType) {
|
|
97
|
+
for (const c of node.findDirectExpressions(Expressions.ClassName)) {
|
|
98
|
+
const token = c.getFirstToken();
|
|
99
|
+
const className = token.getStr().toUpperCase();
|
|
100
|
+
const found = input.scope.existsObject(className);
|
|
101
|
+
if (found === null || found === void 0 ? void 0 : found.id) {
|
|
102
|
+
const catchType = new basic_1.ObjectReferenceType(found.id);
|
|
103
|
+
if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(catchType, targetType) === false) {
|
|
104
|
+
const message = "CATCH target not compatible with " + className;
|
|
105
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
95
111
|
}
|
|
96
112
|
}
|
|
97
113
|
}
|
package/build/src/config.js
CHANGED
package/build/src/lsp/help.js
CHANGED
|
@@ -51,13 +51,13 @@ class Help {
|
|
|
51
51
|
}
|
|
52
52
|
static dumpABAP(file, reg, textDocument, position) {
|
|
53
53
|
let content = "";
|
|
54
|
-
content = `
|
|
55
|
-
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
56
|
-
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
57
|
-
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
58
|
-
<a href="#_files" rel="no-refresh">Files</a> |
|
|
59
|
-
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
60
|
-
<hr>
|
|
54
|
+
content = `
|
|
55
|
+
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
56
|
+
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
57
|
+
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
58
|
+
<a href="#_files" rel="no-refresh">Files</a> |
|
|
59
|
+
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
60
|
+
<hr>
|
|
61
61
|
` +
|
|
62
62
|
"<tt>" + textDocument.uri + " (" +
|
|
63
63
|
(position.line + 1) + ", " +
|
|
@@ -212,9 +212,9 @@ class Help {
|
|
|
212
212
|
return ret + "</ul>";
|
|
213
213
|
}
|
|
214
214
|
static tokens(file) {
|
|
215
|
-
let inner = `<table><tr><td><b>String</b></td><td><b>Type</b></td>
|
|
216
|
-
<td><b>Row</b></td><td><b>Column</b></td>
|
|
217
|
-
<td><b>vRow</b></td><td><b>vColumn</b></td>
|
|
215
|
+
let inner = `<table><tr><td><b>String</b></td><td><b>Type</b></td>
|
|
216
|
+
<td><b>Row</b></td><td><b>Column</b></td>
|
|
217
|
+
<td><b>vRow</b></td><td><b>vColumn</b></td>
|
|
218
218
|
</tr>`;
|
|
219
219
|
for (const token of file.getTokens()) {
|
|
220
220
|
const tStart = token.getStart();
|
package/build/src/registry.js
CHANGED
|
@@ -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
|
badExample: `WRITE '뽑'.`,
|
|
@@ -28,10 +28,10 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
|
|
|
28
28
|
key: "abapdoc",
|
|
29
29
|
title: "Check abapdoc",
|
|
30
30
|
shortDescription: `Various checks regarding abapdoc.`,
|
|
31
|
-
extendedInformation: `Base rule checks for existence of abapdoc for public class methods and all interface methods.
|
|
32
|
-
|
|
33
|
-
Plus class and interface definitions.
|
|
34
|
-
|
|
31
|
+
extendedInformation: `Base rule checks for existence of abapdoc for public class methods and all interface methods.
|
|
32
|
+
|
|
33
|
+
Plus class and interface definitions.
|
|
34
|
+
|
|
35
35
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-only-for-public-apis`,
|
|
36
36
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
37
37
|
};
|
|
@@ -54,27 +54,27 @@ class AddTestAttributes extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
title: "Add test attributes for tests classes with test methods",
|
|
55
55
|
shortDescription: `Add test attributes DURATION and RISK LEVEL for tests classes with test methods`,
|
|
56
56
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
57
|
-
badExample: `CLASS ltcl_test1 DEFINITION FINAL FOR TESTING.
|
|
58
|
-
PUBLIC SECTION.
|
|
59
|
-
PROTECTED SECTION.
|
|
60
|
-
PRIVATE SECTION.
|
|
61
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
62
|
-
ENDCLASS.
|
|
63
|
-
|
|
64
|
-
CLASS ltcl_test1 IMPLEMENTATION.
|
|
65
|
-
METHOD test.
|
|
66
|
-
ENDMETHOD.
|
|
57
|
+
badExample: `CLASS ltcl_test1 DEFINITION FINAL FOR TESTING.
|
|
58
|
+
PUBLIC SECTION.
|
|
59
|
+
PROTECTED SECTION.
|
|
60
|
+
PRIVATE SECTION.
|
|
61
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
62
|
+
ENDCLASS.
|
|
63
|
+
|
|
64
|
+
CLASS ltcl_test1 IMPLEMENTATION.
|
|
65
|
+
METHOD test.
|
|
66
|
+
ENDMETHOD.
|
|
67
67
|
ENDCLASS.`,
|
|
68
|
-
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
69
|
-
PUBLIC SECTION.
|
|
70
|
-
PROTECTED SECTION.
|
|
71
|
-
PRIVATE SECTION.
|
|
72
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
73
|
-
ENDCLASS.
|
|
74
|
-
|
|
75
|
-
CLASS ltcl_test2 IMPLEMENTATION.
|
|
76
|
-
METHOD test.
|
|
77
|
-
ENDMETHOD.
|
|
68
|
+
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
69
|
+
PUBLIC SECTION.
|
|
70
|
+
PROTECTED SECTION.
|
|
71
|
+
PRIVATE SECTION.
|
|
72
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
73
|
+
ENDCLASS.
|
|
74
|
+
|
|
75
|
+
CLASS ltcl_test2 IMPLEMENTATION.
|
|
76
|
+
METHOD test.
|
|
77
|
+
ENDMETHOD.
|
|
78
78
|
ENDCLASS.`,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
@@ -55,49 +55,49 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
|
|
|
55
55
|
key: "align_parameters",
|
|
56
56
|
title: "Align Parameters",
|
|
57
57
|
shortDescription: `Checks for vertially aligned parameters`,
|
|
58
|
-
extendedInformation: `Checks:
|
|
59
|
-
* function module calls
|
|
60
|
-
* method calls
|
|
61
|
-
* VALUE constructors
|
|
62
|
-
* NEW constructors
|
|
63
|
-
* RAISE EXCEPTION statements
|
|
64
|
-
* CREATE OBJECT statements
|
|
65
|
-
* RAISE EVENT statements
|
|
66
|
-
|
|
67
|
-
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
68
|
-
|
|
69
|
-
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
70
|
-
|
|
71
|
-
If parameters are on the same row, no issues are reported, see
|
|
58
|
+
extendedInformation: `Checks:
|
|
59
|
+
* function module calls
|
|
60
|
+
* method calls
|
|
61
|
+
* VALUE constructors
|
|
62
|
+
* NEW constructors
|
|
63
|
+
* RAISE EXCEPTION statements
|
|
64
|
+
* CREATE OBJECT statements
|
|
65
|
+
* RAISE EVENT statements
|
|
66
|
+
|
|
67
|
+
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
68
|
+
|
|
69
|
+
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
70
|
+
|
|
71
|
+
If parameters are on the same row, no issues are reported, see
|
|
72
72
|
https://rules.abaplint.org/max_one_method_parameter_per_line/ for splitting parameters to lines`,
|
|
73
73
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
|
|
74
|
-
badExample: `CALL FUNCTION 'FOOBAR'
|
|
75
|
-
EXPORTING
|
|
76
|
-
foo = 2
|
|
77
|
-
parameter = 3.
|
|
78
|
-
|
|
79
|
-
foobar( moo = 1
|
|
80
|
-
param = 1 ).
|
|
81
|
-
|
|
82
|
-
foo = VALUE #(
|
|
83
|
-
foo = bar
|
|
74
|
+
badExample: `CALL FUNCTION 'FOOBAR'
|
|
75
|
+
EXPORTING
|
|
76
|
+
foo = 2
|
|
77
|
+
parameter = 3.
|
|
78
|
+
|
|
79
|
+
foobar( moo = 1
|
|
80
|
+
param = 1 ).
|
|
81
|
+
|
|
82
|
+
foo = VALUE #(
|
|
83
|
+
foo = bar
|
|
84
84
|
moo = 2 ).`,
|
|
85
|
-
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
86
|
-
EXPORTING
|
|
87
|
-
foo = 2
|
|
88
|
-
parameter = 3.
|
|
89
|
-
|
|
90
|
-
foobar( moo = 1
|
|
91
|
-
param = 1 ).
|
|
92
|
-
|
|
93
|
-
foo = VALUE #(
|
|
94
|
-
foo = bar
|
|
95
|
-
moo = 2 ).
|
|
96
|
-
|
|
97
|
-
DATA(sdf) = VALUE type(
|
|
98
|
-
common_val = 2
|
|
99
|
-
another_common = 5
|
|
100
|
-
( row_value = 4
|
|
85
|
+
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
86
|
+
EXPORTING
|
|
87
|
+
foo = 2
|
|
88
|
+
parameter = 3.
|
|
89
|
+
|
|
90
|
+
foobar( moo = 1
|
|
91
|
+
param = 1 ).
|
|
92
|
+
|
|
93
|
+
foo = VALUE #(
|
|
94
|
+
foo = bar
|
|
95
|
+
moo = 2 ).
|
|
96
|
+
|
|
97
|
+
DATA(sdf) = VALUE type(
|
|
98
|
+
common_val = 2
|
|
99
|
+
another_common = 5
|
|
100
|
+
( row_value = 4
|
|
101
101
|
value_foo = 5 ) ).`,
|
|
102
102
|
};
|
|
103
103
|
}
|
|
@@ -63,37 +63,37 @@ class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
|
|
|
63
63
|
key: "align_type_expressions",
|
|
64
64
|
title: "Align TYPE expressions",
|
|
65
65
|
shortDescription: `Align TYPE expressions in statements`,
|
|
66
|
-
extendedInformation: `
|
|
67
|
-
Currently works for METHODS + BEGIN OF
|
|
68
|
-
|
|
69
|
-
If BEGIN OF has an INCLUDE TYPE its ignored
|
|
70
|
-
|
|
71
|
-
Also note that clean ABAP does not recommend aligning TYPE clauses:
|
|
66
|
+
extendedInformation: `
|
|
67
|
+
Currently works for METHODS + BEGIN OF
|
|
68
|
+
|
|
69
|
+
If BEGIN OF has an INCLUDE TYPE its ignored
|
|
70
|
+
|
|
71
|
+
Also note that clean ABAP does not recommend aligning TYPE clauses:
|
|
72
72
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-align-type-clauses`,
|
|
73
73
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
|
|
74
|
-
badExample: `
|
|
75
|
-
TYPES: BEGIN OF foo,
|
|
76
|
-
bar TYPE i,
|
|
77
|
-
foobar TYPE i,
|
|
78
|
-
END OF foo.
|
|
79
|
-
|
|
80
|
-
INTERFACE lif.
|
|
81
|
-
METHODS bar
|
|
82
|
-
IMPORTING
|
|
83
|
-
foo TYPE i
|
|
84
|
-
foobar TYPE i.
|
|
74
|
+
badExample: `
|
|
75
|
+
TYPES: BEGIN OF foo,
|
|
76
|
+
bar TYPE i,
|
|
77
|
+
foobar TYPE i,
|
|
78
|
+
END OF foo.
|
|
79
|
+
|
|
80
|
+
INTERFACE lif.
|
|
81
|
+
METHODS bar
|
|
82
|
+
IMPORTING
|
|
83
|
+
foo TYPE i
|
|
84
|
+
foobar TYPE i.
|
|
85
85
|
ENDINTERFACE.`,
|
|
86
|
-
goodExample: `
|
|
87
|
-
TYPES: BEGIN OF foo,
|
|
88
|
-
bar TYPE i,
|
|
89
|
-
foobar TYPE i,
|
|
90
|
-
END OF foo.
|
|
91
|
-
|
|
92
|
-
INTERFACE lif.
|
|
93
|
-
METHODS bar
|
|
94
|
-
IMPORTING
|
|
95
|
-
foo TYPE i
|
|
96
|
-
foobar TYPE i.
|
|
86
|
+
goodExample: `
|
|
87
|
+
TYPES: BEGIN OF foo,
|
|
88
|
+
bar TYPE i,
|
|
89
|
+
foobar TYPE i,
|
|
90
|
+
END OF foo.
|
|
91
|
+
|
|
92
|
+
INTERFACE lif.
|
|
93
|
+
METHODS bar
|
|
94
|
+
IMPORTING
|
|
95
|
+
foo TYPE i
|
|
96
|
+
foobar TYPE i.
|
|
97
97
|
ENDINTERFACE.`,
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -53,16 +53,16 @@ class AmbiguousStatement extends _abap_rule_1.ABAPRule {
|
|
|
53
53
|
return {
|
|
54
54
|
key: "ambiguous_statement",
|
|
55
55
|
title: "Check for ambigious statements",
|
|
56
|
-
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
57
|
-
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
58
|
-
|
|
56
|
+
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
57
|
+
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
58
|
+
|
|
59
59
|
Only works if the target version is 740sp05 or above`,
|
|
60
60
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
61
|
-
badExample: `DELETE foo FROM bar.
|
|
61
|
+
badExample: `DELETE foo FROM bar.
|
|
62
62
|
MODIFY foo FROM bar.`,
|
|
63
|
-
goodExample: `DELETE foo FROM @bar.
|
|
64
|
-
DELETE TABLE itab FROM 2.
|
|
65
|
-
MODIFY zfoo FROM @wa.
|
|
63
|
+
goodExample: `DELETE foo FROM @bar.
|
|
64
|
+
DELETE TABLE itab FROM 2.
|
|
65
|
+
MODIFY zfoo FROM @wa.
|
|
66
66
|
MODIFY TABLE foo FROM bar.`,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
@@ -77,16 +77,16 @@ class AvoidUse extends _abap_rule_1.ABAPRule {
|
|
|
77
77
|
key: "avoid_use",
|
|
78
78
|
title: "Avoid use of certain statements",
|
|
79
79
|
shortDescription: `Detects usage of certain statements.`,
|
|
80
|
-
extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
81
|
-
|
|
82
|
-
Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
83
|
-
|
|
84
|
-
STATICS: use CLASS-DATA instead
|
|
85
|
-
|
|
86
|
-
DESCRIBE TABLE LINES: use lines() instead (quickfix exists)
|
|
87
|
-
|
|
88
|
-
TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround
|
|
89
|
-
|
|
80
|
+
extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
81
|
+
|
|
82
|
+
Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
83
|
+
|
|
84
|
+
STATICS: use CLASS-DATA instead
|
|
85
|
+
|
|
86
|
+
DESCRIBE TABLE LINES: use lines() instead (quickfix exists)
|
|
87
|
+
|
|
88
|
+
TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround
|
|
89
|
+
|
|
90
90
|
BREAK points`,
|
|
91
91
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
92
92
|
badExample: `DESCRIBE TABLE items LINES count.`,
|
|
@@ -57,11 +57,11 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
|
|
|
57
57
|
title: "Check BEGIN END names",
|
|
58
58
|
shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,
|
|
59
59
|
tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
60
|
-
badExample: `DATA: BEGIN OF stru,
|
|
61
|
-
field TYPE i,
|
|
60
|
+
badExample: `DATA: BEGIN OF stru,
|
|
61
|
+
field TYPE i,
|
|
62
62
|
END OF structure_not_the_same.`,
|
|
63
|
-
goodExample: `DATA: BEGIN OF stru,
|
|
64
|
-
field TYPE i,
|
|
63
|
+
goodExample: `DATA: BEGIN OF stru,
|
|
64
|
+
field TYPE i,
|
|
65
65
|
END OF stru.`,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
@@ -54,20 +54,20 @@ class BeginSingleInclude extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
title: "BEGIN contains single INCLUDE",
|
|
55
55
|
shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,
|
|
56
56
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
57
|
-
badExample: `TYPES: BEGIN OF dummy1.
|
|
58
|
-
INCLUDE TYPE dselc.
|
|
59
|
-
TYPES: END OF dummy1.
|
|
60
|
-
|
|
61
|
-
DATA BEGIN OF foo.
|
|
62
|
-
INCLUDE STRUCTURE syst.
|
|
63
|
-
DATA END OF foo.
|
|
64
|
-
|
|
65
|
-
STATICS BEGIN OF bar.
|
|
66
|
-
INCLUDE STRUCTURE syst.
|
|
57
|
+
badExample: `TYPES: BEGIN OF dummy1.
|
|
58
|
+
INCLUDE TYPE dselc.
|
|
59
|
+
TYPES: END OF dummy1.
|
|
60
|
+
|
|
61
|
+
DATA BEGIN OF foo.
|
|
62
|
+
INCLUDE STRUCTURE syst.
|
|
63
|
+
DATA END OF foo.
|
|
64
|
+
|
|
65
|
+
STATICS BEGIN OF bar.
|
|
66
|
+
INCLUDE STRUCTURE syst.
|
|
67
67
|
STATICS END OF bar.`,
|
|
68
|
-
goodExample: `DATA BEGIN OF foo.
|
|
69
|
-
DATA field TYPE i.
|
|
70
|
-
INCLUDE STRUCTURE dselc.
|
|
68
|
+
goodExample: `DATA BEGIN OF foo.
|
|
69
|
+
DATA field TYPE i.
|
|
70
|
+
INCLUDE STRUCTURE dselc.
|
|
71
71
|
DATA END OF foo.`,
|
|
72
72
|
};
|
|
73
73
|
}
|
|
@@ -57,9 +57,9 @@ class CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {
|
|
|
57
57
|
extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,
|
|
58
58
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
59
59
|
badExample: `CALL TRANSACTION 'FOO'.`,
|
|
60
|
-
goodExample: `TRY.
|
|
61
|
-
CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
|
|
62
|
-
CATCH cx_sy_authorization_error.
|
|
60
|
+
goodExample: `TRY.
|
|
61
|
+
CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
|
|
62
|
+
CATCH cx_sy_authorization_error.
|
|
63
63
|
ENDTRY.`,
|
|
64
64
|
};
|
|
65
65
|
}
|