@abaplint/core 2.101.28 → 2.101.30
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/5_syntax/_type_utils.js +7 -1
- package/build/src/abap/5_syntax/expressions/source.js +2 -0
- package/build/src/abap/5_syntax/statements/assign.js +8 -8
- package/build/src/lsp/hover.js +5 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +3 -1
- package/build/src/rules/function_module_recommendations.js +3 -2
- package/build/src/rules/msag_consistency.js +12 -1
- package/build/src/rules/obsolete_statement.js +10 -0
- package/package.json +4 -4
|
@@ -245,6 +245,9 @@ class TypeUtils {
|
|
|
245
245
|
}
|
|
246
246
|
return source.getLength() === target.getLength();
|
|
247
247
|
}
|
|
248
|
+
else if (target instanceof basic_1.XStringType) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
248
251
|
else if (target instanceof basic_1.IntegerType) {
|
|
249
252
|
if (((_e = source.getAbstractTypeData()) === null || _e === void 0 ? void 0 : _e.derivedFromConstant) === true) {
|
|
250
253
|
return true;
|
|
@@ -294,7 +297,10 @@ class TypeUtils {
|
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
else if (source instanceof basic_1.XStringType) {
|
|
297
|
-
if (target instanceof basic_1.CLikeType
|
|
300
|
+
if (target instanceof basic_1.CLikeType
|
|
301
|
+
|| target instanceof basic_1.IntegerType
|
|
302
|
+
|| target instanceof basic_1.ObjectReferenceType
|
|
303
|
+
|| target instanceof basic_1.HexType) {
|
|
298
304
|
return false;
|
|
299
305
|
}
|
|
300
306
|
}
|
|
@@ -8,22 +8,22 @@ const dynamic_1 = require("../expressions/dynamic");
|
|
|
8
8
|
const basic_1 = require("../../types/basic");
|
|
9
9
|
class Assign {
|
|
10
10
|
runSyntax(node, scope, filename) {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const sources = node.
|
|
13
|
-
const
|
|
14
|
-
let sourceType = new source_1.Source().runSyntax(
|
|
15
|
-
if (sourceType === undefined || ((
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const sources = ((_a = node.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.Source)) || [];
|
|
13
|
+
const theSource = sources[sources.length - 1];
|
|
14
|
+
let sourceType = new source_1.Source().runSyntax(theSource, scope, filename);
|
|
15
|
+
if (sourceType === undefined || ((_b = node.findDirectExpression(Expressions.AssignSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic))) {
|
|
16
16
|
sourceType = new basic_1.VoidType("DynamicAssign");
|
|
17
17
|
}
|
|
18
|
-
for (const d of ((
|
|
18
|
+
for (const d of ((_c = node.findDirectExpression(Expressions.AssignSource)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.Dynamic)) || []) {
|
|
19
19
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
20
20
|
}
|
|
21
21
|
const target = node.findDirectExpression(Expressions.FSTarget);
|
|
22
22
|
if (target) {
|
|
23
23
|
new fstarget_1.FSTarget().runSyntax(target, scope, filename, sourceType);
|
|
24
24
|
}
|
|
25
|
-
for (const s of
|
|
26
|
-
if (s ===
|
|
25
|
+
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
26
|
+
if (s === theSource) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
29
|
new source_1.Source().runSyntax(s, scope, filename);
|
package/build/src/lsp/hover.js
CHANGED
|
@@ -30,7 +30,11 @@ class Hover {
|
|
|
30
30
|
return { kind: LServer.MarkupKind.Markdown, value: "String Template" };
|
|
31
31
|
}
|
|
32
32
|
else if (found.token instanceof Tokens.Comment) {
|
|
33
|
-
|
|
33
|
+
let type = "Comment";
|
|
34
|
+
if (found.token.getStr().startsWith(`"!`)) {
|
|
35
|
+
type = "ABAP Doc Comment";
|
|
36
|
+
}
|
|
37
|
+
return { kind: LServer.MarkupKind.Markdown, value: type };
|
|
34
38
|
}
|
|
35
39
|
const lookup = _lookup_1.LSPLookup.lookup(found, this.reg, obj);
|
|
36
40
|
if (lookup === null || lookup === void 0 ? void 0 : lookup.hover) {
|
package/build/src/registry.js
CHANGED
|
@@ -19,7 +19,9 @@ class SevenBitAscii {
|
|
|
19
19
|
shortDescription: `Only allow characters from the 7bit ASCII set.`,
|
|
20
20
|
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_guidl.htm
|
|
23
|
+
|
|
24
|
+
Checkes files with extensions ".abap" and ".asddls"`,
|
|
23
25
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -12,7 +12,7 @@ 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: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC" },
|
|
15
|
+
{ name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC or CL_ABAP_MESSAGE_DIGEST" },
|
|
16
16
|
{ name: "ECATT_CONV_XSTRING_TO_STRING", replace: "use CL_BINARY_CONVERT" },
|
|
17
17
|
{ name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
18
18
|
{ name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
|
|
@@ -21,10 +21,11 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
|
|
|
21
21
|
{ name: "GUID_CREATE", replace: "use CL_SYSTEM_UUID" },
|
|
22
22
|
{ name: "IGN_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
|
|
23
23
|
{ name: "IGN_TIMESTAMP_PLUSMINUS", replace: "use CL_ABAP_TSTMP" },
|
|
24
|
+
{ name: "ISM_SD_GET PRICING CONDITIONS", replace: "use CL_PRC_RESULT_FACTORY as per note 2220005" },
|
|
24
25
|
{ name: "JOB_CREATE", replace: "use CL_BP_ABAP_JOB" },
|
|
25
26
|
{ name: "JOB_SUBMIT", replace: "use CL_BP_ABAP_JOB" },
|
|
26
|
-
{ name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
|
|
27
27
|
{ name: "POPUP_TO_CONFIRM_STEP", replace: "use POPUP_TO_CONFIRM" },
|
|
28
|
+
{ name: "POPUP_TO_DECIDE", replace: "use POPUP_TO_CONFIRM" },
|
|
28
29
|
{ name: "POPUP_TO_GET_VALUE", replace: "use POPUP_GET_VALUES" },
|
|
29
30
|
{ name: "REUSE_ALV_GRID_DISPLAY", replace: "use CL_SALV_TABLE=>FACTORY or CL_GUI_ALV_GRID" },
|
|
30
31
|
{ name: "ROUND", replace: "use built in function: round()" },
|
|
@@ -17,7 +17,7 @@ class MSAGConsistency {
|
|
|
17
17
|
key: "msag_consistency",
|
|
18
18
|
title: "MSAG consistency check",
|
|
19
19
|
shortDescription: `Checks the validity of messages in message classes`,
|
|
20
|
-
extendedInformation: `Message numbers must be 3 digits,
|
|
20
|
+
extendedInformation: `Message numbers must be 3 digits, message text must not be empty, no message number duplicates`,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
getDescription(reason) {
|
|
@@ -37,6 +37,7 @@ class MSAGConsistency {
|
|
|
37
37
|
if (!(obj instanceof objects_1.MessageClass)) {
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
|
+
const numbers = new Set();
|
|
40
41
|
for (const message of obj.getMessages()) {
|
|
41
42
|
// todo, get the right positions in xml file
|
|
42
43
|
if (!message.getNumber().match(/\d\d\d/)) {
|
|
@@ -51,6 +52,16 @@ class MSAGConsistency {
|
|
|
51
52
|
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
52
53
|
issues.push(issue);
|
|
53
54
|
}
|
|
55
|
+
const num = message.getNumber();
|
|
56
|
+
if (numbers.has(num)) {
|
|
57
|
+
const text = "Duplicate message number " + num;
|
|
58
|
+
const position = new position_1.Position(1, 1);
|
|
59
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
60
|
+
issues.push(issue);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
numbers.add(num);
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
66
|
return issues;
|
|
56
67
|
}
|
|
@@ -128,6 +128,16 @@ POSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.ht
|
|
|
128
128
|
OCCURENCES: check for OCCURENCES vs OCCURRENCES
|
|
129
129
|
|
|
130
130
|
CLIENT SPECIFIED, from 754: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client_obsolete.htm`,
|
|
131
|
+
badExample: `REFRESH itab.
|
|
132
|
+
|
|
133
|
+
COMPUTE foo = 2 + 2.
|
|
134
|
+
|
|
135
|
+
MULTIPLY lv_foo BY 2.
|
|
136
|
+
|
|
137
|
+
INTERFACE intf LOAD.
|
|
138
|
+
|
|
139
|
+
IF foo IS SUPPLIED.
|
|
140
|
+
ENDIF.`,
|
|
131
141
|
};
|
|
132
142
|
}
|
|
133
143
|
getConfig() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.101.
|
|
3
|
+
"version": "2.101.30",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"@microsoft/api-extractor": "^7.36.0",
|
|
54
54
|
"@types/chai": "^4.3.5",
|
|
55
55
|
"@types/mocha": "^10.0.1",
|
|
56
|
-
"@types/node": "^20.3.
|
|
56
|
+
"@types/node": "^20.3.3",
|
|
57
57
|
"chai": "^4.3.7",
|
|
58
|
-
"eslint": "^8.
|
|
58
|
+
"eslint": "^8.44.0",
|
|
59
59
|
"mocha": "^10.2.0",
|
|
60
60
|
"c8": "^8.0.0",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
62
|
"ts-json-schema-generator": "^1.2.0",
|
|
63
|
-
"typescript": "^5.1.
|
|
63
|
+
"typescript": "^5.1.6"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"fast-xml-parser": "^4.2.5",
|