@abaplint/core 2.93.13 → 2.93.15
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/src/registry.js +1 -1
- package/build/src/rules/cyclic_oo.js +26 -7
- package/build/src/rules/downport.js +7 -3
- package/build/src/rules/line_length.js +8 -10
- package/build/src/rules/prefer_inline.js +6 -2
- package/build/src/rules/prefix_is_current_class.js +1 -1
- package/build/src/rules/remove_descriptions.js +5 -0
- package/package.json +4 -4
package/build/src/registry.js
CHANGED
|
@@ -30,7 +30,9 @@ class CyclicOO {
|
|
|
30
30
|
key: "cyclic_oo",
|
|
31
31
|
title: "Cyclic OO",
|
|
32
32
|
shortDescription: `Finds cyclic OO references`,
|
|
33
|
-
extendedInformation: `Runs for global INTF + CLAS objects
|
|
33
|
+
extendedInformation: `Runs for global INTF + CLAS objects
|
|
34
|
+
|
|
35
|
+
Objects must be without syntax errors for this rule to take effect`,
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
38
|
getConfig() {
|
|
@@ -47,6 +49,9 @@ class CyclicOO {
|
|
|
47
49
|
this.reg = reg;
|
|
48
50
|
this.edges = {};
|
|
49
51
|
for (const obj of this.reg.getObjectsByType("CLAS")) {
|
|
52
|
+
if (this.reg.isDependency(obj)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
50
55
|
const name = obj.getName().toUpperCase();
|
|
51
56
|
if (!(obj instanceof objects_1.Class)) {
|
|
52
57
|
continue;
|
|
@@ -57,9 +62,16 @@ class CyclicOO {
|
|
|
57
62
|
else if (this.conf.skipSharedMemory === true && ((_a = obj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.isSharedMemory) === true) {
|
|
58
63
|
continue;
|
|
59
64
|
}
|
|
60
|
-
|
|
65
|
+
const run = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
66
|
+
if (run.issues.length > 0) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
this.buildEdges(name, run.spaghetti.getTop());
|
|
61
70
|
}
|
|
62
71
|
for (const obj of this.reg.getObjectsByType("INTF")) {
|
|
72
|
+
if (this.reg.isDependency(obj)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
63
75
|
const name = obj.getName().toUpperCase();
|
|
64
76
|
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
65
77
|
continue;
|
|
@@ -67,7 +79,11 @@ class CyclicOO {
|
|
|
67
79
|
else if (this.conf.skip.indexOf(name) >= 0) {
|
|
68
80
|
continue;
|
|
69
81
|
}
|
|
70
|
-
|
|
82
|
+
const run = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
83
|
+
if (run.issues.length > 0) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
this.buildEdges(name, run.spaghetti.getTop());
|
|
71
87
|
}
|
|
72
88
|
return this;
|
|
73
89
|
}
|
|
@@ -79,7 +95,9 @@ class CyclicOO {
|
|
|
79
95
|
if (id === undefined) {
|
|
80
96
|
return [];
|
|
81
97
|
}
|
|
82
|
-
const
|
|
98
|
+
const previous = {};
|
|
99
|
+
previous[obj.getName()] = true;
|
|
100
|
+
const path = this.findCycle(obj.getName(), obj.getName(), previous);
|
|
83
101
|
if (path) {
|
|
84
102
|
const message = "Cyclic definition/usage: " + path;
|
|
85
103
|
return [issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.conf.severity)];
|
|
@@ -93,10 +111,11 @@ class CyclicOO {
|
|
|
93
111
|
}
|
|
94
112
|
for (const e of this.edges[current]) {
|
|
95
113
|
if (e === source) {
|
|
96
|
-
return previous.join(" -> ") + " -> " + source;
|
|
114
|
+
return Object.keys(previous).join(" -> ") + " -> " + source;
|
|
97
115
|
}
|
|
98
|
-
if (previous
|
|
99
|
-
|
|
116
|
+
if (previous[e] === undefined) { // dont revisit vertices
|
|
117
|
+
previous[e] = true;
|
|
118
|
+
const found = this.findCycle(source, e, previous);
|
|
100
119
|
if (found) {
|
|
101
120
|
return found;
|
|
102
121
|
}
|
|
@@ -1317,7 +1317,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1317
1317
|
return undefined;
|
|
1318
1318
|
}
|
|
1319
1319
|
outlineFor(forLoop, indentation, lowFile, highSyntax) {
|
|
1320
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1321
1321
|
let body = "";
|
|
1322
1322
|
let end = "";
|
|
1323
1323
|
const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
@@ -1357,8 +1357,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1357
1357
|
end += indentation + "ENDWHILE";
|
|
1358
1358
|
}
|
|
1359
1359
|
else if (loopTargetField !== undefined) {
|
|
1360
|
+
let from = (_h = forLoop.findExpressionAfterToken("FROM")) === null || _h === void 0 ? void 0 : _h.concatTokens();
|
|
1361
|
+
from = from ? " FROM " + from : "";
|
|
1362
|
+
let to = (_j = forLoop.findExpressionAfterToken("TO")) === null || _j === void 0 ? void 0 : _j.concatTokens();
|
|
1363
|
+
to = to ? " TO " + to : "";
|
|
1360
1364
|
// todo, also backup sy-index / sy-tabix here?
|
|
1361
|
-
body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${cond}.\n`;
|
|
1365
|
+
body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${from}${to}${cond}.\n`;
|
|
1362
1366
|
if (indexInto) {
|
|
1363
1367
|
body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
|
|
1364
1368
|
}
|
|
@@ -1366,7 +1370,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1366
1370
|
}
|
|
1367
1371
|
else if (loopTargetField === undefined) {
|
|
1368
1372
|
// todo, also backup sy-index / sy-tabix here?
|
|
1369
|
-
const loopTargetFieldSymbol = (
|
|
1373
|
+
const loopTargetFieldSymbol = (_k = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _k === void 0 ? void 0 : _k.concatTokens();
|
|
1370
1374
|
body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\n`;
|
|
1371
1375
|
if (indexInto) {
|
|
1372
1376
|
body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
|
|
@@ -38,20 +38,18 @@ https://docs.abapopenchecks.org/checks/04/`,
|
|
|
38
38
|
const issues = [];
|
|
39
39
|
// maximum line length in abap files
|
|
40
40
|
const maxLineLength = 255;
|
|
41
|
-
file.getRawRows()
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const array = file.getRawRows();
|
|
42
|
+
for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
|
|
43
|
+
const row = array[rowIndex].replace("\r", "");
|
|
44
44
|
if (row.length > maxLineLength) {
|
|
45
|
-
message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;
|
|
45
|
+
const message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;
|
|
46
|
+
issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
|
|
46
47
|
}
|
|
47
48
|
else if (row.length > this.conf.length) {
|
|
48
|
-
message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;
|
|
49
|
+
const message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;
|
|
50
|
+
issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
|
|
54
|
-
});
|
|
52
|
+
}
|
|
55
53
|
return issues;
|
|
56
54
|
}
|
|
57
55
|
}
|
|
@@ -29,7 +29,7 @@ Activates if language version is v740sp02 or above.
|
|
|
29
29
|
|
|
30
30
|
Variables must be local(METHOD or FORM).
|
|
31
31
|
|
|
32
|
-
No generic or void typed variables.
|
|
32
|
+
No generic or void typed variables. No syntax errors.
|
|
33
33
|
|
|
34
34
|
First position used must be a full/pure write.
|
|
35
35
|
|
|
@@ -65,7 +65,11 @@ DATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 10
|
|
|
65
65
|
else if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
66
66
|
return [];
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const run = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
69
|
+
if (run.issues.length > 0) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
const scopes = this.findScopeCandidates(run.spaghetti.getTop());
|
|
69
73
|
const ret = [];
|
|
70
74
|
for (const s of scopes) {
|
|
71
75
|
ret.push(...this.analyzeScope(s, obj));
|
|
@@ -30,7 +30,7 @@ class PrefixIsCurrentClass extends _abap_rule_1.ABAPRule {
|
|
|
30
30
|
title: "Prefix is current class",
|
|
31
31
|
shortDescription: `Reports errors if the current class or interface references itself with "current_class=>"`,
|
|
32
32
|
// eslint-disable-next-line max-len
|
|
33
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-self-reference-me-when-calling-an-instance-method`,
|
|
33
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-self-reference-me-when-calling-an-instance-attribute-or-method`,
|
|
34
34
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -103,12 +103,17 @@ Consider using ABAP Doc for documentation.`,
|
|
|
103
103
|
if (desc === undefined) {
|
|
104
104
|
return [];
|
|
105
105
|
}
|
|
106
|
+
const reported = {}; // there might be multiple translations
|
|
106
107
|
const ret = [];
|
|
107
108
|
for (const d of (0, xml_utils_1.xmlToArray)(desc.SEOCOMPOTX)) {
|
|
108
109
|
const message = "Remove description for " + d.CMPNAME;
|
|
110
|
+
if (reported[d.CMPNAME] !== undefined) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
109
113
|
const position = new position_1.Position(1, 1);
|
|
110
114
|
const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity);
|
|
111
115
|
ret.push(issue);
|
|
116
|
+
reported[d.CMPNAME] = true;
|
|
112
117
|
}
|
|
113
118
|
return ret;
|
|
114
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.93.
|
|
3
|
+
"version": "2.93.15",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://abaplint.org",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@microsoft/api-extractor": "^7.
|
|
49
|
+
"@microsoft/api-extractor": "^7.31.0",
|
|
50
50
|
"@types/chai": "^4.3.3",
|
|
51
51
|
"@types/mocha": "^9.1.1",
|
|
52
|
-
"@types/node": "^18.7.
|
|
52
|
+
"@types/node": "^18.7.18",
|
|
53
53
|
"chai": "^4.3.6",
|
|
54
54
|
"eslint": "^8.23.1",
|
|
55
55
|
"mocha": "^10.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"typescript": "^4.8.3"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"fast-xml-parser": "^4.0.
|
|
62
|
+
"fast-xml-parser": "^4.0.10",
|
|
63
63
|
"json5": "^2.2.1",
|
|
64
64
|
"vscode-languageserver-types": "^3.17.2"
|
|
65
65
|
}
|