@abaplint/core 2.120.106 → 2.120.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abaplint.d.ts +1 -0
- package/build/src/abap/5_syntax/_key_compare.js +66 -0
- package/build/src/abap/5_syntax/expressions/value_body.js +2 -2
- package/build/src/abap/5_syntax/statements/append.js +5 -0
- package/build/src/abap/5_syntax/statements/insert_internal.js +8 -0
- package/build/src/abap/5_syntax/statements/loop.js +2 -27
- package/build/src/abap/5_syntax/statements/raise.js +11 -6
- package/build/src/abap/types/class_definition.js +52 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/_procedure_analysis.js +1 -0
- package/build/src/rules/constant_condition.js +201 -3
- package/build/src/rules/identical_conditions.js +76 -2
- package/build/src/rules/index.js +2 -0
- package/build/src/rules/inline_generic_source.js +170 -0
- package/build/src/rules/redundant_conversion.js +99 -2
- package/build/src/rules/sequential_read_sorted.js +318 -0
- package/build/src/rules/xml_consistency.js +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,318 @@
|
|
|
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.SequentialReadSorted = exports.SequentialReadSortedConf = void 0;
|
|
37
|
+
const Expressions = __importStar(require("../abap/2_statements/expressions"));
|
|
38
|
+
const Statements = __importStar(require("../abap/2_statements/statements"));
|
|
39
|
+
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
40
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
41
|
+
const issue_1 = require("../issue");
|
|
42
|
+
const _irule_1 = require("./_irule");
|
|
43
|
+
const syntax_1 = require("../abap/5_syntax/syntax");
|
|
44
|
+
const _key_compare_1 = require("../abap/5_syntax/_key_compare");
|
|
45
|
+
const _abap_object_1 = require("../objects/_abap_object");
|
|
46
|
+
const basic_1 = require("../abap/types/basic");
|
|
47
|
+
const nodes_1 = require("../abap/nodes");
|
|
48
|
+
const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
49
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
50
|
+
const severity_1 = require("../severity");
|
|
51
|
+
class SequentialReadSortedConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
52
|
+
constructor() {
|
|
53
|
+
super(...arguments);
|
|
54
|
+
this.severity = severity_1.Severity.Warning;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.SequentialReadSortedConf = SequentialReadSortedConf;
|
|
58
|
+
class SequentialReadSorted {
|
|
59
|
+
constructor() {
|
|
60
|
+
this.conf = new SequentialReadSortedConf();
|
|
61
|
+
}
|
|
62
|
+
getMetadata() {
|
|
63
|
+
return {
|
|
64
|
+
key: "sequential_read_sorted",
|
|
65
|
+
title: "Sequential read on a sorted table",
|
|
66
|
+
shortDescription: `A WHERE condition or a free key on a sorted table that does not use the primary key`,
|
|
67
|
+
extendedInformation: `A sorted table is read with a binary search only when the condition fixes an initial part of
|
|
68
|
+
its key. When the first key component is not compared with = or EQ (or IS INITIAL) in a part of the condition joined
|
|
69
|
+
by AND, every line is read, like on a standard table. The SAP check "Low Performance Operations on Internal Tables"
|
|
70
|
+
reports this as "Possible sequential read on a sorted table".
|
|
71
|
+
|
|
72
|
+
Checked: LOOP AT ... WHERE, DELETE ... WHERE, MODIFY ... WHERE, READ TABLE ... WITH KEY and table expressions
|
|
73
|
+
itab[ comp = ... ], on a table whose type is statically known as SORTED with explicit key components, using the
|
|
74
|
+
primary key.
|
|
75
|
+
|
|
76
|
+
Not checked: standard, hashed, generic and unknown table types, tables with a default key, a dynamic WHERE or
|
|
77
|
+
dynamic components, WITH TABLE KEY, a named key (USING KEY, KEY ... COMPONENTS) other than primary_key,
|
|
78
|
+
READ TABLE ... BINARY SEARCH and access by index, including LOOP AT and DELETE with FROM or TO.
|
|
79
|
+
|
|
80
|
+
Fix: compare the first key component with =, change the key or the table type, or add a secondary key.
|
|
81
|
+
If the sequential read is intended, add the pseudo comment "#EC CI_SORTSEQ to the statement.`,
|
|
82
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],
|
|
83
|
+
pseudoComment: "EC CI_SORTSEQ",
|
|
84
|
+
badExample: `DATA lt_nodes TYPE SORTED TABLE OF ty_node WITH UNIQUE KEY path name.
|
|
85
|
+
LOOP AT lt_nodes INTO ls_node WHERE name = lv_name.
|
|
86
|
+
ENDLOOP.
|
|
87
|
+
DELETE lt_nodes WHERE path CP lv_pattern.`,
|
|
88
|
+
goodExample: `DATA lt_nodes TYPE SORTED TABLE OF ty_node WITH UNIQUE KEY path name.
|
|
89
|
+
LOOP AT lt_nodes INTO ls_node WHERE path = lv_path AND name = lv_name.
|
|
90
|
+
ENDLOOP.
|
|
91
|
+
DELETE lt_nodes WHERE path CP lv_pattern. "#EC CI_SORTSEQ`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
getConfig() {
|
|
95
|
+
return this.conf;
|
|
96
|
+
}
|
|
97
|
+
initialize(reg) {
|
|
98
|
+
this.reg = reg;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
setConfig(conf) {
|
|
102
|
+
this.conf = conf;
|
|
103
|
+
}
|
|
104
|
+
run(obj) {
|
|
105
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const issues = [];
|
|
109
|
+
let spaghetti = undefined;
|
|
110
|
+
for (const file of obj.getABAPFiles()) {
|
|
111
|
+
const statements = file.getStatements();
|
|
112
|
+
const pseudoRows = this.findPseudoCommentRows(statements);
|
|
113
|
+
for (const statement of statements) {
|
|
114
|
+
const get = statement.get();
|
|
115
|
+
if (get instanceof _statement_1.Comment) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const isWhere = get instanceof Statements.Loop
|
|
119
|
+
|| get instanceof Statements.DeleteInternal
|
|
120
|
+
|| get instanceof Statements.ModifyInternal;
|
|
121
|
+
const isRead = get instanceof Statements.ReadTable;
|
|
122
|
+
if (isWhere === false
|
|
123
|
+
&& isRead === false
|
|
124
|
+
&& statement.findFirstExpression(Expressions.TableExpression) === undefined) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (this.hasPseudoComment(statement, pseudoRows)) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (spaghetti === undefined) {
|
|
131
|
+
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
132
|
+
}
|
|
133
|
+
if (isWhere === true) {
|
|
134
|
+
this.checkWhere(statement, spaghetti, file, issues);
|
|
135
|
+
}
|
|
136
|
+
else if (isRead === true) {
|
|
137
|
+
this.checkReadTable(statement, spaghetti, file, issues);
|
|
138
|
+
}
|
|
139
|
+
this.checkTableExpressions(statement, statement, spaghetti, file, issues);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return issues;
|
|
143
|
+
}
|
|
144
|
+
////////////////
|
|
145
|
+
findPseudoCommentRows(statements) {
|
|
146
|
+
const rows = new Set();
|
|
147
|
+
for (const s of statements) {
|
|
148
|
+
if (s.get() instanceof _statement_1.Comment && s.concatTokens().toUpperCase().includes(this.getMetadata().pseudoComment + "")) {
|
|
149
|
+
rows.add(s.getStart().getRow());
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return rows;
|
|
153
|
+
}
|
|
154
|
+
/** the pseudo comment is accepted on any row of the statement */
|
|
155
|
+
hasPseudoComment(statement, pseudoRows) {
|
|
156
|
+
for (let row = statement.getStart().getRow(); row <= statement.getEnd().getRow(); row++) {
|
|
157
|
+
if (pseudoRows.has(row)) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
/** LOOP AT, DELETE and MODIFY with a static WHERE condition */
|
|
164
|
+
checkWhere(statement, spaghetti, file, issues) {
|
|
165
|
+
var _a;
|
|
166
|
+
const cond = statement.findDirectExpression(Expressions.ComponentCond);
|
|
167
|
+
if (cond === undefined || this.usesPrimaryKey(statement) === false) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
let table;
|
|
171
|
+
if (statement.get() instanceof Statements.Loop) {
|
|
172
|
+
table = (_a = statement.findDirectExpression(Expressions.LoopSource)) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
table = statement.findDirectExpression(Expressions.Target);
|
|
176
|
+
}
|
|
177
|
+
if (table === undefined) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (!(statement.get() instanceof Statements.ModifyInternal)
|
|
181
|
+
&& (statement.findDirectTokenByText("FROM") !== undefined || statement.findDirectTokenByText("TO") !== undefined)) {
|
|
182
|
+
// an index range
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const first = this.firstKeyComponent(this.findType(table, spaghetti, file));
|
|
186
|
+
if (first !== undefined && (0, _key_compare_1.hasKeyCompare)(cond, first) === false) {
|
|
187
|
+
this.report(statement, table.concatTokens(), first, file, issues);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
checkReadTable(statement, spaghetti, file, issues) {
|
|
191
|
+
var _a;
|
|
192
|
+
if (statement.findTokenSequencePosition("WITH", "KEY") === undefined
|
|
193
|
+
|| statement.findDirectTokenByText("COMPONENTS") !== undefined
|
|
194
|
+
|| statement.findDirectTokenByText("BINARY") !== undefined) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const compare = statement.findDirectExpression(Expressions.ComponentCompareSimple);
|
|
198
|
+
const table = (_a = statement.findDirectExpression(Expressions.SimpleSource2)) !== null && _a !== void 0 ? _a : statement.findDirectExpression(Expressions.Source);
|
|
199
|
+
if (compare === undefined || table === undefined) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const first = this.firstKeyComponent(this.findType(table, spaghetti, file));
|
|
203
|
+
if (first !== undefined && this.hasFreeKeyComponent(compare, first) === false) {
|
|
204
|
+
this.report(statement, table.concatTokens(), first, file, issues);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** table expressions with a free key, itab[ comp = ... ], anywhere in the statement */
|
|
208
|
+
checkTableExpressions(node, statement, spaghetti, file, issues) {
|
|
209
|
+
var _a;
|
|
210
|
+
const children = node.getChildren();
|
|
211
|
+
for (let i = 0; i < children.length; i++) {
|
|
212
|
+
const child = children[i];
|
|
213
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (child.get() instanceof Expressions.TableExpression
|
|
217
|
+
&& child instanceof nodes_1.ExpressionNode
|
|
218
|
+
&& (node.get() instanceof Expressions.FieldChain || node.get() instanceof Expressions.Target)
|
|
219
|
+
&& ((_a = child.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.ComponentChainSimple) {
|
|
220
|
+
// a free key, not an index and not a named key: KEY name [COMPONENTS]
|
|
221
|
+
const first = this.firstKeyComponent(this.findChainType(children.slice(0, i), spaghetti, file));
|
|
222
|
+
if (first !== undefined && this.hasFreeKeyComponent(child, first) === false) {
|
|
223
|
+
const name = children.slice(0, i).map(c => c.concatTokens()).join("");
|
|
224
|
+
this.report(statement, name, first, file, issues);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.checkTableExpressions(child, statement, spaghetti, file, issues);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
report(statement, name, first, file, issues) {
|
|
231
|
+
const message = `Sequential read on sorted table ${name}, the first key component ${first} is not compared with =, ` +
|
|
232
|
+
`add it to the condition or "#EC CI_SORTSEQ`;
|
|
233
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
234
|
+
}
|
|
235
|
+
/** false if USING KEY names a key other than the primary key, or a dynamic one */
|
|
236
|
+
usesPrimaryKey(statement) {
|
|
237
|
+
if (statement.findDirectTokenByText("USING") === undefined) {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
const keyName = statement.findExpressionAfterToken("KEY");
|
|
241
|
+
return (keyName === null || keyName === void 0 ? void 0 : keyName.get()) instanceof Expressions.SimpleName && keyName.concatTokens().toUpperCase() === "PRIMARY_KEY";
|
|
242
|
+
}
|
|
243
|
+
/** true if a free key, ComponentCompareSimple or the fields of a TableExpression, specifies the component;
|
|
244
|
+
* also true when a component is dynamic, as it cannot be decided */
|
|
245
|
+
hasFreeKeyComponent(node, component) {
|
|
246
|
+
if (node.findDirectExpression(Expressions.Dynamic) !== undefined) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
return node.findDirectExpressions(Expressions.ComponentChainSimple)
|
|
250
|
+
.some(c => c.concatTokens().toUpperCase().replace(/\s+/g, "") === component);
|
|
251
|
+
}
|
|
252
|
+
/** The first component of the primary key of a sorted table with explicit key components, else undefined */
|
|
253
|
+
firstKeyComponent(type) {
|
|
254
|
+
var _a, _b;
|
|
255
|
+
if (!(type instanceof basic_1.TableType)
|
|
256
|
+
|| type.getAccessType() !== basic_1.TableAccessType.sorted
|
|
257
|
+
|| type.getOptions().keyType !== basic_1.TableKeyType.user
|
|
258
|
+
|| type.isGeneric()) {
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
return (_b = (_a = type.getOptions().primaryKey) === null || _a === void 0 ? void 0 : _a.keyFields[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase();
|
|
262
|
+
}
|
|
263
|
+
findType(node, spaghetti, file) {
|
|
264
|
+
if (!(node.get() instanceof Expressions.Target)) {
|
|
265
|
+
const chain = node.getChildren().length === 1 ? node.findDirectExpression(Expressions.FieldChain) : undefined;
|
|
266
|
+
if (chain === undefined) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
node = chain;
|
|
270
|
+
}
|
|
271
|
+
return this.findChainType(node.getChildren(), spaghetti, file);
|
|
272
|
+
}
|
|
273
|
+
/** The type of a chain of names, components, attributes, dereferences and table expressions, else undefined */
|
|
274
|
+
findChainType(children, spaghetti, file) {
|
|
275
|
+
var _a;
|
|
276
|
+
let type = undefined;
|
|
277
|
+
for (const child of children) {
|
|
278
|
+
const get = child.get();
|
|
279
|
+
if (get instanceof Expressions.SourceField
|
|
280
|
+
|| get instanceof Expressions.SourceFieldSymbol
|
|
281
|
+
|| get instanceof Expressions.TargetField
|
|
282
|
+
|| get instanceof Expressions.TargetFieldSymbol
|
|
283
|
+
|| get instanceof Expressions.AttributeName) {
|
|
284
|
+
type = (_a = this.findReference(child.getFirstToken().getStart(), spaghetti, file)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
285
|
+
}
|
|
286
|
+
else if (get instanceof Expressions.ComponentName) {
|
|
287
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
288
|
+
}
|
|
289
|
+
else if (get instanceof Expressions.Dereference) {
|
|
290
|
+
type = type instanceof basic_1.DataReference ? type.getType() : undefined;
|
|
291
|
+
}
|
|
292
|
+
else if (get instanceof Expressions.TableExpression) {
|
|
293
|
+
type = type instanceof basic_1.TableType ? type.getRowType() : undefined;
|
|
294
|
+
}
|
|
295
|
+
else if (get instanceof Expressions.ClassName || get instanceof tokens_1.StaticArrow) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
else if (!(get instanceof tokens_1.Dash) && !(get instanceof tokens_1.InstanceArrow)) {
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
if (type === undefined) {
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return type;
|
|
306
|
+
}
|
|
307
|
+
findReference(start, spaghetti, file) {
|
|
308
|
+
const scope = spaghetti.lookupPosition(start, file.getFilename());
|
|
309
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
310
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
311
|
+
return r.resolved;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return undefined;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
exports.SequentialReadSorted = SequentialReadSorted;
|
|
318
|
+
//# sourceMappingURL=sequential_read_sorted.js.map
|
|
@@ -41,6 +41,7 @@ const _abap_object_1 = require("../objects/_abap_object");
|
|
|
41
41
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
42
42
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
43
43
|
const severity_1 = require("../severity");
|
|
44
|
+
const xml_utils_1 = require("../xml_utils");
|
|
44
45
|
const ABAPGIT_ATTRIBUTES = [
|
|
45
46
|
["version", /<abapGit\b[^>]*\bversion="([^"]+)"/],
|
|
46
47
|
["serializer_version", /<abapGit\b[^>]*\bserializer_version="([^"]+)"/],
|
|
@@ -73,6 +74,7 @@ class XMLConsistency {
|
|
|
73
74
|
* QUAN fields in TABL objects have reference table and field values
|
|
74
75
|
* Transparent TABL objects have delivery class and size category set
|
|
75
76
|
* TABL fields with a built-in type carry the INTTYPE abapGit serializes for it, for the confirmed pairs
|
|
77
|
+
* Documentation lines(TDLINE) in CLAS and INTF objects are max 72 characters, longer lines are cut by the system
|
|
76
78
|
* Lock parameter names in ENQU objects are max 16 characters
|
|
77
79
|
* DEVC objects are serialized as package.devc.xml
|
|
78
80
|
* Texts and translations do not exceed maximum allowed length.`,
|
|
@@ -160,6 +162,27 @@ class XMLConsistency {
|
|
|
160
162
|
issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
|
|
161
163
|
}
|
|
162
164
|
issues.push(...this.checkClearedFields(obj, file, "VSEOCLASS", XMLConsistency.clearedClassFields));
|
|
165
|
+
issues.push(...this.checkDocumentationLines(obj, file));
|
|
166
|
+
return issues;
|
|
167
|
+
}
|
|
168
|
+
// the documentation editor stores lines of max 72 characters, longer TDLINEs are cut when deserialized
|
|
169
|
+
checkDocumentationLines(obj, file) {
|
|
170
|
+
const maxLength = 72;
|
|
171
|
+
const issues = [];
|
|
172
|
+
const xml = obj.getXML();
|
|
173
|
+
if (xml === undefined) {
|
|
174
|
+
return issues;
|
|
175
|
+
}
|
|
176
|
+
const regex = /<TDLINE>([^<]*)<\/TDLINE>/g;
|
|
177
|
+
let match;
|
|
178
|
+
while ((match = regex.exec(xml)) !== null) {
|
|
179
|
+
const text = (0, xml_utils_1.unescape)(match[1]);
|
|
180
|
+
if (text.length > maxLength) {
|
|
181
|
+
const row = xml.substring(0, match.index).split("\n").length;
|
|
182
|
+
const message = `Documentation line exceeds maximum length of ${maxLength} characters (actual: ${text.length}), "${text}"`;
|
|
183
|
+
issues.push(issue_1.Issue.atRow(file, row, message, this.getMetadata().key, this.conf.textAndTranslationLengthSeverity));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
163
186
|
return issues;
|
|
164
187
|
}
|
|
165
188
|
checkClearedFields(obj, file, structure, fields) {
|
|
@@ -221,6 +244,7 @@ class XMLConsistency {
|
|
|
221
244
|
issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
|
|
222
245
|
}
|
|
223
246
|
issues.push(...this.checkClearedFields(obj, file, "VSEOINTERF", XMLConsistency.clearedInterfaceFields));
|
|
247
|
+
issues.push(...this.checkDocumentationLines(obj, file));
|
|
224
248
|
return issues;
|
|
225
249
|
}
|
|
226
250
|
checkTextLength(file, fieldName, text, maxLength, lang) {
|