@abaplint/core 2.85.43 → 2.85.44
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.
|
@@ -7,6 +7,33 @@ class TypeUtils {
|
|
|
7
7
|
constructor(scope) {
|
|
8
8
|
this.scope = scope;
|
|
9
9
|
}
|
|
10
|
+
isCharLikeStrict(type) {
|
|
11
|
+
if (type === undefined) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
else if (type instanceof basic_1.StructureType) {
|
|
15
|
+
for (const c of type.getComponents()) {
|
|
16
|
+
if (this.isCharLikeStrict(c.type) === false) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
else if (type instanceof basic_1.StringType
|
|
23
|
+
|| type instanceof basic_1.AnyType
|
|
24
|
+
|| type instanceof basic_1.CharacterType
|
|
25
|
+
|| type instanceof basic_1.CLikeType
|
|
26
|
+
|| type instanceof basic_1.DateType
|
|
27
|
+
|| type instanceof basic_1.CSequenceType
|
|
28
|
+
|| type instanceof basic_1.NumericGenericType
|
|
29
|
+
|| type instanceof basic_1.NumericType
|
|
30
|
+
|| type instanceof basic_1.TimeType
|
|
31
|
+
|| type instanceof basic_1.UnknownType
|
|
32
|
+
|| type instanceof basic_1.VoidType) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
10
37
|
isCharLike(type) {
|
|
11
38
|
if (type === undefined) {
|
|
12
39
|
return false;
|
|
@@ -6,16 +6,31 @@ const basic_1 = require("../../types/basic");
|
|
|
6
6
|
const inline_data_1 = require("../expressions/inline_data");
|
|
7
7
|
const source_1 = require("../expressions/source");
|
|
8
8
|
const target_1 = require("../expressions/target");
|
|
9
|
+
const _type_utils_1 = require("../_type_utils");
|
|
9
10
|
class Split {
|
|
10
11
|
runSyntax(node, scope, filename) {
|
|
11
|
-
const
|
|
12
|
+
const intoTable = node.findTokenSequencePosition("INTO", "TABLE") !== undefined;
|
|
13
|
+
const type = intoTable ? new basic_1.TableType(new basic_1.StringType(), { withHeader: false }) : new basic_1.StringType();
|
|
12
14
|
for (const target of node.findAllExpressions(Expressions.Target)) {
|
|
13
15
|
const inline = target.findDirectExpression(Expressions.InlineData);
|
|
14
16
|
if (inline) {
|
|
15
17
|
new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
|
|
16
18
|
}
|
|
17
19
|
else {
|
|
18
|
-
new target_1.Target().runSyntax(target, scope, filename);
|
|
20
|
+
let targetType = new target_1.Target().runSyntax(target, scope, filename);
|
|
21
|
+
if (intoTable) {
|
|
22
|
+
if (!(targetType instanceof basic_1.TableType)
|
|
23
|
+
&& !(targetType instanceof basic_1.UnknownType)
|
|
24
|
+
&& !(targetType instanceof basic_1.VoidType)) {
|
|
25
|
+
throw new Error("Into must be table typed");
|
|
26
|
+
}
|
|
27
|
+
if (targetType instanceof basic_1.TableType) {
|
|
28
|
+
targetType = targetType.getRowType();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (new _type_utils_1.TypeUtils(scope).isCharLikeStrict(targetType) === false) {
|
|
32
|
+
throw new Error("Incompatible, target not character like");
|
|
33
|
+
}
|
|
19
34
|
}
|
|
20
35
|
}
|
|
21
36
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
package/build/src/registry.js
CHANGED
|
@@ -19,8 +19,10 @@ class MethodOverwritesBuiltIn extends _abap_rule_1.ABAPRule {
|
|
|
19
19
|
key: "method_overwrites_builtin",
|
|
20
20
|
title: "Method name overwrites builtin function",
|
|
21
21
|
shortDescription: `Checks Method names that overwrite builtin SAP functions`,
|
|
22
|
-
extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenbuilt_in_functions_overview.htm
|
|
23
|
-
|
|
22
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenbuilt_in_functions_overview.htm
|
|
23
|
+
|
|
24
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscuring-built-in-functions`,
|
|
25
|
+
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
getConfig() {
|
|
@@ -19,6 +19,7 @@ class PragmaPlacement extends _abap_rule_1.ABAPRule {
|
|
|
19
19
|
title: "Pragma Placement",
|
|
20
20
|
shortDescription: `Place pragmas at end of statements`,
|
|
21
21
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
22
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abenpragma.htm`,
|
|
22
23
|
badExample: `DATA field ##NO_TEXT TYPE i.`,
|
|
23
24
|
goodExample: `DATA field TYPE i ##NO_TEXT.`,
|
|
24
25
|
};
|
|
@@ -42,7 +43,7 @@ class PragmaPlacement extends _abap_rule_1.ABAPRule {
|
|
|
42
43
|
}
|
|
43
44
|
if (children[children.length - 2].getLastToken().getStart().isAfter(p.getStart())) {
|
|
44
45
|
const message = "Place pragma at end of statement";
|
|
45
|
-
const issue = issue_1.Issue.
|
|
46
|
+
const issue = issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.conf.severity);
|
|
46
47
|
issues.push(issue);
|
|
47
48
|
continue; // max one finding per statement
|
|
48
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.85.
|
|
3
|
+
"version": "2.85.44",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://abaplint.org",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.19.
|
|
48
|
+
"@microsoft/api-extractor": "^7.19.5",
|
|
49
49
|
"@types/chai": "^4.3.0",
|
|
50
50
|
"@types/mocha": "^9.1.0",
|
|
51
51
|
"@types/node": "^17.0.21",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
|
-
"eslint": "^8.
|
|
54
|
-
"mocha": "^9.2.
|
|
53
|
+
"eslint": "^8.11.0",
|
|
54
|
+
"mocha": "^9.2.2",
|
|
55
55
|
"c8": "^7.11.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^0.98.0",
|
|
58
58
|
"typescript": "^4.6.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"fast-xml-parser": "^4.0.
|
|
61
|
+
"fast-xml-parser": "^4.0.7",
|
|
62
62
|
"json5": "^2.2.0",
|
|
63
63
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
64
64
|
"vscode-languageserver-types": "^3.16.0"
|