@abaplint/core 2.108.8 → 2.108.10
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.
|
@@ -22,7 +22,7 @@ class Sequence {
|
|
|
22
22
|
}
|
|
23
23
|
run(statements, parent) {
|
|
24
24
|
let inn = statements;
|
|
25
|
-
|
|
25
|
+
let out = [];
|
|
26
26
|
for (const i of this.list) {
|
|
27
27
|
const match = i.run(inn, parent);
|
|
28
28
|
if (match.error) {
|
|
@@ -34,7 +34,14 @@ class Sequence {
|
|
|
34
34
|
errorMatched: out.length,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
if (match.matched.length < 100) {
|
|
38
|
+
out.push(...match.matched);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
|
|
42
|
+
// when the number of matched elements is very large
|
|
43
|
+
out = out.concat(match.matched);
|
|
44
|
+
}
|
|
38
45
|
inn = match.unmatched;
|
|
39
46
|
}
|
|
40
47
|
return {
|
|
@@ -166,7 +173,7 @@ class Star {
|
|
|
166
173
|
}
|
|
167
174
|
run(statements, parent) {
|
|
168
175
|
let inn = statements;
|
|
169
|
-
|
|
176
|
+
let out = [];
|
|
170
177
|
while (true) {
|
|
171
178
|
if (inn.length === 0) {
|
|
172
179
|
return {
|
|
@@ -198,7 +205,14 @@ class Star {
|
|
|
198
205
|
};
|
|
199
206
|
}
|
|
200
207
|
}
|
|
201
|
-
|
|
208
|
+
if (match.matched.length < 100) {
|
|
209
|
+
out.push(...match.matched);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
// avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
|
|
213
|
+
// when the number of matched elements is very large
|
|
214
|
+
out = out.concat(match.matched);
|
|
215
|
+
}
|
|
202
216
|
inn = match.unmatched;
|
|
203
217
|
}
|
|
204
218
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -44,7 +44,7 @@ If sy-dbcnt is checked after database statements, it is considered okay.
|
|
|
44
44
|
If IS ASSIGNED is checked after assigning, it is considered okay.
|
|
45
45
|
|
|
46
46
|
FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
47
|
-
tags: [_irule_1.RuleTag.SingleFile],
|
|
47
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
48
48
|
pseudoComment: "EC CI_SUBRC",
|
|
49
49
|
pragma: "##SUBRC_OK",
|
|
50
50
|
};
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
|
|
4
4
|
const issue_1 = require("../issue");
|
|
5
5
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
6
|
+
const _irule_1 = require("./_irule");
|
|
6
7
|
const __1 = require("..");
|
|
8
|
+
const edit_helper_1 = require("../edit_helper");
|
|
7
9
|
class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
8
10
|
constructor() {
|
|
9
11
|
super(...arguments);
|
|
@@ -24,7 +26,7 @@ class SelectSingleFullKey {
|
|
|
24
26
|
|
|
25
27
|
If the statement contains a JOIN it is not checked`,
|
|
26
28
|
pseudoComment: "EC CI_NOORDER",
|
|
27
|
-
tags: [],
|
|
29
|
+
tags: [_irule_1.RuleTag.Quickfix],
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
initialize(reg) {
|
|
@@ -45,6 +47,12 @@ If the statement contains a JOIN it is not checked`,
|
|
|
45
47
|
setConfig(conf) {
|
|
46
48
|
this.conf = conf;
|
|
47
49
|
}
|
|
50
|
+
buildFix(file, statement) {
|
|
51
|
+
return {
|
|
52
|
+
description: `Add "#EC CI_NOORDER`,
|
|
53
|
+
edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getStart(), ` "#EC CI_NOORDER`),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
48
56
|
run(obj) {
|
|
49
57
|
var _a, _b;
|
|
50
58
|
if (!(obj instanceof __1.ABAPObject)) {
|
|
@@ -106,7 +114,8 @@ If the statement contains a JOIN it is not checked`,
|
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
if (set.size > 0) {
|
|
109
|
-
|
|
117
|
+
const fix = this.buildFix(file, s);
|
|
118
|
+
issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity, undefined, [fix]));
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
}
|
|
@@ -7,7 +7,13 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
|
7
7
|
const _irule_1 = require("./_irule");
|
|
8
8
|
const Statements = require("../abap/2_statements/statements");
|
|
9
9
|
const edit_helper_1 = require("../edit_helper");
|
|
10
|
+
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
10
11
|
class UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
/** Allow empty METHODs + FORMs + FUNCTION-MODULEs */
|
|
15
|
+
this.allowEmpty = false;
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
exports.UnnecessaryReturnConf = UnnecessaryReturnConf;
|
|
13
19
|
class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
|
|
@@ -51,15 +57,29 @@ ENDFORM.`,
|
|
|
51
57
|
}
|
|
52
58
|
const message = "Unnecessary RETURN";
|
|
53
59
|
const statements = file.getStatements();
|
|
60
|
+
let statementCounter = 0;
|
|
54
61
|
for (let i = 0; i < statements.length; i++) {
|
|
55
62
|
const node = statements[i];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
||
|
|
63
|
+
const nodeType = node.get();
|
|
64
|
+
if ((nodeType instanceof Statements.MethodImplementation
|
|
65
|
+
|| nodeType instanceof Statements.Form
|
|
66
|
+
|| nodeType instanceof Statements.FunctionModule)) {
|
|
67
|
+
statementCounter = 0;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!(nodeType instanceof _statement_1.Comment)) {
|
|
71
|
+
statementCounter++;
|
|
72
|
+
}
|
|
73
|
+
if (!(nodeType instanceof Statements.EndMethod
|
|
74
|
+
|| nodeType instanceof Statements.EndForm
|
|
75
|
+
|| nodeType instanceof Statements.EndFunction)) {
|
|
59
76
|
continue;
|
|
60
77
|
}
|
|
61
78
|
const prev = statements[i - 1];
|
|
62
79
|
if (prev && prev.get() instanceof Statements.Return) {
|
|
80
|
+
if (this.conf.allowEmpty === true && statementCounter === 2) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
63
83
|
const fix = edit_helper_1.EditHelper.deleteStatement(file, prev);
|
|
64
84
|
issues.push(issue_1.Issue.atStatement(file, prev, message, this.getMetadata().key, this.getConfig().severity, fix));
|
|
65
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.108.
|
|
3
|
+
"version": "2.108.10",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"lint:fix": "eslint src/**/*.ts test/**/*.ts --format unix --fix",
|
|
11
11
|
"compile": "tsc && sh scripts/version.sh",
|
|
12
12
|
"test": "npm run compile && mocha --timeout 1000 && npm run lint && npm run schema && api-extractor run",
|
|
13
|
-
"test:only": "npm run compile && mocha",
|
|
13
|
+
"test:only": "npm run compile && mocha --timeout 1000000",
|
|
14
14
|
"test:parallel": "npm run compile && mocha --timeout 1000 --parallel --reporter dot",
|
|
15
15
|
"coverage": "npm run compile && c8 mocha && c8 report --reporter=html",
|
|
16
16
|
"lexer_performance": "tsc && curl -o lexer_performance.abap https://raw.githubusercontent.com/abapGit/build/main/zabapgit_standalone.prog.abap && node build/adhoc/lexer_performance.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.43.
|
|
53
|
+
"@microsoft/api-extractor": "^7.43.8",
|
|
54
54
|
"@types/chai": "^4.3.16",
|
|
55
55
|
"@types/mocha": "^10.0.6",
|
|
56
56
|
"@types/node": "^20.12.12",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.4.5"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^4.
|
|
66
|
+
"fast-xml-parser": "^4.4.0",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|