@abaplint/core 2.90.0 → 2.90.3
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/abap/2_statements/expressions/sql_compare.js +3 -1
- package/build/src/abap/2_statements/statements/insert_internal.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/double_space.js +15 -2
- package/build/src/rules/downport.js +45 -6
- package/build/src/rules/function_module_recommendations.js +17 -16
- package/package.json +6 -6
|
@@ -8,7 +8,9 @@ const version_1 = require("../../../version");
|
|
|
8
8
|
class SQLCompare extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const val = new _1.SQLSource();
|
|
11
|
-
const
|
|
11
|
+
const listOld = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRight), (0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
12
|
+
const listNew = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRight), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
13
|
+
const list = (0, combi_1.alt)(listOld, (0, combi_1.ver)(version_1.Version.v740sp02, listNew)); // version is a guess, https://github.com/abaplint/abaplint/issues/2530
|
|
12
14
|
const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
|
|
13
15
|
const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
|
|
14
16
|
const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
|
|
@@ -17,7 +17,7 @@ class InsertInternal {
|
|
|
17
17
|
const fromTo = (0, combi_1.seq)((0, combi_1.opt)(from), (0, combi_1.opt)(to));
|
|
18
18
|
const foo = (0, combi_1.per)(into, ref, index, assigning);
|
|
19
19
|
const lines = (0, combi_1.seq)("LINES OF", target, (0, combi_1.opt)(fromTo));
|
|
20
|
-
const src = (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.
|
|
20
|
+
const src = (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource4);
|
|
21
21
|
const tab = (0, combi_1.seq)("TABLE", expressions_1.Source);
|
|
22
22
|
const ret = (0, combi_1.seq)("INSERT", (0, combi_1.altPrio)(tab, (0, combi_1.seq)((0, combi_1.altPrio)(initial, lines, src), foo)));
|
|
23
23
|
return ret;
|
package/build/src/registry.js
CHANGED
|
@@ -114,7 +114,9 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
|
|
|
114
114
|
const issueStartPos = new position_1.Position(prev.getRow(), prev.getCol() + 2);
|
|
115
115
|
const issueEndPos = new position_1.Position(t.getRow(), t.getCol());
|
|
116
116
|
const fix = edit_helper_1.EditHelper.deleteRange(file, issueStartPos, issueEndPos);
|
|
117
|
-
|
|
117
|
+
if (this.pragmaInRange(s.getPragmas(), issueStartPos, issueEndPos) === false) {
|
|
118
|
+
issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
|
|
119
|
+
}
|
|
118
120
|
}
|
|
119
121
|
if (this.getConfig().endParen === true
|
|
120
122
|
&& prev.getRow() === t.getRow()
|
|
@@ -124,12 +126,23 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
|
|
|
124
126
|
const issueStartPos = new position_1.Position(prev.getEnd().getRow(), prev.getEnd().getCol() + 1);
|
|
125
127
|
const issueEndPos = new position_1.Position(t.getRow(), t.getCol());
|
|
126
128
|
const fix = edit_helper_1.EditHelper.deleteRange(file, issueStartPos, issueEndPos);
|
|
127
|
-
|
|
129
|
+
if (this.pragmaInRange(s.getPragmas(), issueStartPos, issueEndPos) === false) {
|
|
130
|
+
issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
|
|
131
|
+
}
|
|
128
132
|
}
|
|
129
133
|
prev = t;
|
|
130
134
|
}
|
|
131
135
|
return issues;
|
|
132
136
|
}
|
|
137
|
+
pragmaInRange(pragmas, start, end) {
|
|
138
|
+
let ret = false;
|
|
139
|
+
for (const p of pragmas) {
|
|
140
|
+
if (p.getStart().isBetween(start, end)) {
|
|
141
|
+
ret = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return ret;
|
|
145
|
+
}
|
|
133
146
|
checkKeywords(s, file) {
|
|
134
147
|
const issues = [];
|
|
135
148
|
let prev = undefined;
|
|
@@ -49,6 +49,7 @@ Current rules:
|
|
|
49
49
|
* REDUCE is outlined
|
|
50
50
|
* SWITCH is outlined
|
|
51
51
|
* APPEND expression is outlined
|
|
52
|
+
* INSERT expression is outlined
|
|
52
53
|
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
53
54
|
* CAST changed to ?=
|
|
54
55
|
* LOOP AT method_call( ) is outlined
|
|
@@ -286,6 +287,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
286
287
|
if (found) {
|
|
287
288
|
return found;
|
|
288
289
|
}
|
|
290
|
+
found = this.replaceInsertExpression(high, lowFile, highSyntax);
|
|
291
|
+
if (found) {
|
|
292
|
+
return found;
|
|
293
|
+
}
|
|
289
294
|
found = this.downportMessage(high, lowFile, highSyntax);
|
|
290
295
|
if (found) {
|
|
291
296
|
return found;
|
|
@@ -507,6 +512,28 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
507
512
|
}
|
|
508
513
|
return undefined;
|
|
509
514
|
}
|
|
515
|
+
replaceInsertExpression(high, lowFile, highSyntax) {
|
|
516
|
+
if (!(high.get() instanceof Statements.InsertInternal)) {
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
const children = high.getChildren();
|
|
520
|
+
if (children[1].get() instanceof Expressions.Source) {
|
|
521
|
+
const source = children[1];
|
|
522
|
+
const target = high.findDirectExpression(Expressions.Target);
|
|
523
|
+
if (target === undefined) {
|
|
524
|
+
return undefined;
|
|
525
|
+
}
|
|
526
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
527
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
528
|
+
const firstToken = high.getFirstToken();
|
|
529
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
530
|
+
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
531
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
532
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
533
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline INSERT source expression", this.getMetadata().key, this.conf.severity, fix);
|
|
534
|
+
}
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
510
537
|
replaceTableExpression(node, lowFile, highSyntax) {
|
|
511
538
|
for (const fieldChain of node.findAllExpressionsRecursive(Expressions.FieldChain)) {
|
|
512
539
|
const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);
|
|
@@ -1224,12 +1251,14 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1224
1251
|
body += indentation + uniqueName + " = " + base.concatTokens() + ".\n";
|
|
1225
1252
|
}
|
|
1226
1253
|
let end = "";
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1254
|
+
/*
|
|
1255
|
+
for (const forLoop of valueBody?.findDirectExpressions(Expressions.For) || []) {
|
|
1256
|
+
const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);
|
|
1257
|
+
body += outlineFor.body;
|
|
1258
|
+
end = outlineFor.end + `.\n` + end;
|
|
1259
|
+
indentation += " ";
|
|
1260
|
+
}
|
|
1261
|
+
*/
|
|
1233
1262
|
let structureName = uniqueName;
|
|
1234
1263
|
let added = false;
|
|
1235
1264
|
let skip = false;
|
|
@@ -1247,6 +1276,12 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1247
1276
|
}
|
|
1248
1277
|
body += indentation + structureName + "-" + b.concatTokens() + ".\n";
|
|
1249
1278
|
}
|
|
1279
|
+
else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.For) {
|
|
1280
|
+
const outlineFor = this.outlineFor(b, indentation, lowFile, highSyntax);
|
|
1281
|
+
body += outlineFor.body;
|
|
1282
|
+
end = outlineFor.end + `.\n` + end;
|
|
1283
|
+
indentation += " ";
|
|
1284
|
+
}
|
|
1250
1285
|
else if (b.get() instanceof Expressions.Source) {
|
|
1251
1286
|
structureName = b.concatTokens();
|
|
1252
1287
|
if (base && (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectTokenByText("(")) === undefined) {
|
|
@@ -1302,6 +1337,10 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1302
1337
|
}
|
|
1303
1338
|
const found = spag.findVariable(name);
|
|
1304
1339
|
if (found === undefined) {
|
|
1340
|
+
const source = f.findFirstExpression(Expressions.Source);
|
|
1341
|
+
if (source) {
|
|
1342
|
+
ret += indentation + "DATA(" + name + `) = ${source.concatTokens()}.\n`;
|
|
1343
|
+
}
|
|
1305
1344
|
continue;
|
|
1306
1345
|
}
|
|
1307
1346
|
const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();
|
|
@@ -12,28 +12,29 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
|
|
|
12
12
|
/** Tuple of Function Module Name to be replaced, the recommended alternative and
|
|
13
13
|
* the version from which the recommendation is valid.*/
|
|
14
14
|
this.recommendations = [
|
|
15
|
-
{ name: "
|
|
16
|
-
{ name: "ROUND", replace: "use built in function: round()" },
|
|
17
|
-
{ name: "SO_NEW_DOCUMENT_ATT_SEND_API1", replace: "use CL_BCS" },
|
|
15
|
+
{ name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
|
|
18
16
|
{ name: "ECATT_CONV_XSTRING_TO_STRING", replace: "use CL_BINARY_CONVERT" },
|
|
19
|
-
{ name: "
|
|
20
|
-
{ name: "
|
|
21
|
-
{ name: "JOB_SUBMIT", replace: "use CL_BP_ABAP_JOB" },
|
|
17
|
+
{ name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
18
|
+
{ name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
|
|
22
19
|
{ name: "GUI_DOWNLOAD", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
23
20
|
{ name: "GUI_UPLOAD", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
24
|
-
{ name: "WS_FILENAME_GET", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
25
|
-
{ name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
26
|
-
{ name: "SAPGUI_PROGRESS_INDICATOR", replace: "use CL_PROGRESS_INDICATOR" },
|
|
27
21
|
{ name: "GUID_CREATE", replace: "use CL_SYSTEM_UUID" },
|
|
28
|
-
{ name: "SSFC_BASE64_DECODE", replace: "use class CL_HTTP_UTILITY methods" },
|
|
29
|
-
{ name: "SSFC_BASE64_ENCODE", replace: "use class CL_HTTP_UTILITY methods" },
|
|
30
|
-
{ name: "SCMS_BASE64_DECODE_STR", replace: "use class CL_HTTP_UTILITY methods" },
|
|
31
|
-
{ name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
|
|
32
|
-
{ name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
|
|
33
|
-
{ name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
|
|
34
|
-
{ name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
|
|
35
22
|
{ name: "IGN_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
|
|
36
23
|
{ name: "IGN_TIMESTAMP_PLUSMINUS", replace: "use CL_ABAP_TSTMP" },
|
|
24
|
+
{ name: "JOB_CREATE", replace: "use CL_BP_ABAP_JOB" },
|
|
25
|
+
{ name: "JOB_SUBMIT", replace: "use CL_BP_ABAP_JOB" },
|
|
26
|
+
{ name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
|
|
27
|
+
{ name: "POPUP_TO_GET_VALUE", replace: "use POPUP_GET_VALUES" },
|
|
28
|
+
{ name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
|
|
29
|
+
{ name: "ROUND", replace: "use built in function: round()" },
|
|
30
|
+
{ name: "SAPGUI_PROGRESS_INDICATOR", replace: "use CL_PROGRESS_INDICATOR" },
|
|
31
|
+
{ name: "SCMS_BASE64_DECODE_STR", replace: "use class CL_HTTP_UTILITY methods" },
|
|
32
|
+
{ name: "SCMS_STRING_TO_XSTRING", replace: "use CL_BINARY_CONVERT" },
|
|
33
|
+
{ name: "SO_NEW_DOCUMENT_ATT_SEND_API1", replace: "use CL_BCS" },
|
|
34
|
+
{ name: "SSFC_BASE64_DECODE", replace: "use class CL_HTTP_UTILITY methods" },
|
|
35
|
+
{ name: "SSFC_BASE64_ENCODE", replace: "use class CL_HTTP_UTILITY methods" },
|
|
36
|
+
{ name: "SUBST_GET_FILE_LIST", replace: "see note 1686357" },
|
|
37
|
+
{ name: "WS_FILENAME_GET", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
37
38
|
];
|
|
38
39
|
}
|
|
39
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.90.
|
|
3
|
+
"version": "2.90.3",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://abaplint.org",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.23.
|
|
48
|
+
"@microsoft/api-extractor": "^7.23.2",
|
|
49
49
|
"@types/chai": "^4.3.1",
|
|
50
50
|
"@types/mocha": "^9.1.1",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.32",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
|
-
"eslint": "^8.
|
|
53
|
+
"eslint": "^8.15.0",
|
|
54
54
|
"mocha": "^10.0.0",
|
|
55
55
|
"c8": "^7.11.2",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"fast-xml-parser": "^4.0.7",
|
|
62
62
|
"json5": "^2.2.1",
|
|
63
|
-
"vscode-languageserver-protocol": "
|
|
64
|
-
"vscode-languageserver-types": "
|
|
63
|
+
"vscode-languageserver-protocol": "=3.16.0",
|
|
64
|
+
"vscode-languageserver-types": "=3.16.0"
|
|
65
65
|
}
|
|
66
66
|
}
|