@abaplint/core 2.91.8 → 2.91.11
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/type_table.js +3 -1
- package/build/src/abap/2_statements/statements/get_locale.js +1 -1
- package/build/src/abap/2_statements/statements/method_def.js +4 -3
- package/build/src/abap/5_syntax/expressions/value_body.js +5 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/cds_legacy_view.js +3 -1
- package/build/src/rules/max_one_statement.js +2 -0
- package/build/src/rules/unknown_types.js +11 -3
- package/build/src/rules/xml_consistency.js +1 -2
- package/package.json +6 -6
|
@@ -5,6 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const field_chain_1 = require("./field_chain");
|
|
7
7
|
const type_table_key_1 = require("./type_table_key");
|
|
8
|
+
const version_1 = require("../../../version");
|
|
8
9
|
class TypeTable extends combi_1.Expression {
|
|
9
10
|
getRunnable() {
|
|
10
11
|
const header = "WITH HEADER LINE";
|
|
@@ -15,9 +16,10 @@ class TypeTable extends combi_1.Expression {
|
|
|
15
16
|
const rangeLike = (0, combi_1.seq)("RANGE OF", _1.SimpleFieldChain, (0, combi_1.opt)(header), (0, combi_1.opt)(initial));
|
|
16
17
|
const typetable = (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))));
|
|
17
18
|
const occurs = (0, combi_1.seq)("OCCURS", _1.Integer);
|
|
19
|
+
const derived = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)("TABLE FOR", (0, combi_1.altPrio)("CREATE", "FAILED", "LOCK", "ACTION IMPORT", "UPDATE", "READ RESULT", "ACTION RESULT"), _1.TypeName));
|
|
18
20
|
const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
19
21
|
const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
20
|
-
const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)("LIKE", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)("TYPE", (0, combi_1.alt)(oldType, typetable, rangeType)));
|
|
22
|
+
const ret = (0, combi_1.altPrio)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), (0, combi_1.seq)("LIKE", (0, combi_1.alt)(oldLike, likeType, rangeLike)), (0, combi_1.seq)("TYPE", (0, combi_1.alt)(oldType, typetable, rangeType, derived)));
|
|
21
23
|
return ret;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -8,7 +8,7 @@ class GetLocale {
|
|
|
8
8
|
getMatcher() {
|
|
9
9
|
const country = (0, combi_1.seq)("COUNTRY", expressions_1.Target);
|
|
10
10
|
const modifier = (0, combi_1.seq)("MODIFIER", expressions_1.Target);
|
|
11
|
-
const ret = (0, combi_1.seq)("GET LOCALE LANGUAGE", expressions_1.Target, country,
|
|
11
|
+
const ret = (0, combi_1.seq)("GET LOCALE LANGUAGE", expressions_1.Target, country, modifier);
|
|
12
12
|
return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -10,12 +10,13 @@ class MethodDef {
|
|
|
10
10
|
const parameters = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("FINAL", def, expressions_1.Abstract)), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefChanging), (0, combi_1.optPrio)(expressions_1.MethodDefReturning), (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising, expressions_1.MethodDefExceptions)));
|
|
11
11
|
const testing = (0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), "FOR TESTING", (0, combi_1.optPrio)((0, combi_1.altPrio)(expressions_1.MethodDefRaising, expressions_1.MethodDefExceptions)));
|
|
12
12
|
// todo, this is only from version something
|
|
13
|
-
const tableFunction = (0, combi_1.seq)("
|
|
13
|
+
const tableFunction = (0, combi_1.seq)("TABLE FUNCTION", (0, combi_1.regex)(/^\w+?$/));
|
|
14
14
|
// todo, this is only from version something
|
|
15
|
-
const ddl = "
|
|
15
|
+
const ddl = "DDL OBJECT OPTIONS CDS SESSION CLIENT REQUIRED";
|
|
16
|
+
const behavior = (0, combi_1.altPrio)((0, combi_1.seq)("VALIDATE ON SAVE IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("MODIFY IMPORTING", expressions_1.MethodParamName, "FOR ACTION", expressions_1.TypeName, "RESULT", expressions_1.MethodParamName), (0, combi_1.seq)("FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.NamespaceSimpleName, "FOR", expressions_1.NamespaceSimpleName, "RESULT", expressions_1.MethodParamName), (0, combi_1.seq)("DETERMINE ON MODIFY IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName));
|
|
16
17
|
// todo, this is only from version something
|
|
17
18
|
const amdp = "AMDP OPTIONS CDS SESSION CLIENT current";
|
|
18
|
-
const ret = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), expressions_1.EventHandler), parameters, testing, tableFunction, ddl, amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
|
|
19
|
+
const ret = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), expressions_1.EventHandler), parameters, testing, (0, combi_1.seq)("FOR", (0, combi_1.alt)(tableFunction, ddl, behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
|
|
19
20
|
return ret;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -27,6 +27,11 @@ class ValueBody {
|
|
|
27
27
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
28
28
|
type = new source_1.Source().runSyntax(s, scope, filename);
|
|
29
29
|
}
|
|
30
|
+
for (const l of node.findDirectExpressions(Expressions.ValueBodyLines)) {
|
|
31
|
+
for (const s of l.findDirectExpressions(Expressions.Source)) {
|
|
32
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
30
35
|
if (scoped === true) {
|
|
31
36
|
scope.pop(node.getLastToken().getEnd());
|
|
32
37
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -19,7 +19,9 @@ class CDSLegacyView {
|
|
|
19
19
|
title: "CDS Legacy View",
|
|
20
20
|
shortDescription: `Identify CDS Legacy Views`,
|
|
21
21
|
// eslint-disable-next-line max-len
|
|
22
|
-
extendedInformation: `
|
|
22
|
+
extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW
|
|
23
|
+
|
|
24
|
+
https://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/
|
|
23
25
|
|
|
24
26
|
v755 and up`,
|
|
25
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
@@ -23,6 +23,8 @@ class MaxOneStatement extends _abap_rule_1.ABAPRule {
|
|
|
23
23
|
shortDescription: `Checks that each line contains only a single statement.`,
|
|
24
24
|
extendedInformation: `Does not report empty statements, use rule empty_statement for detecting empty statements.
|
|
25
25
|
|
|
26
|
+
Does not report anything for chained statements.
|
|
27
|
+
|
|
26
28
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-more-than-one-statement-per-line
|
|
27
29
|
https://docs.abapopenchecks.org/checks/11/`,
|
|
28
30
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
@@ -99,7 +99,7 @@ class UnknownTypes {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
for (const v of nodeData.idefs) {
|
|
102
|
-
const found = this.
|
|
102
|
+
const found = this.checkParameters(v);
|
|
103
103
|
if (found) {
|
|
104
104
|
const message = "Contains unknown, " + found.found;
|
|
105
105
|
ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
|
|
@@ -107,7 +107,7 @@ class UnknownTypes {
|
|
|
107
107
|
}
|
|
108
108
|
for (const name in nodeData.cdefs) {
|
|
109
109
|
const v = nodeData.cdefs[name];
|
|
110
|
-
const found = this.
|
|
110
|
+
const found = this.checkParameters(v);
|
|
111
111
|
if (found) {
|
|
112
112
|
const message = "Contains unknown, " + found.found;
|
|
113
113
|
ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
|
|
@@ -118,7 +118,7 @@ class UnknownTypes {
|
|
|
118
118
|
}
|
|
119
119
|
return ret;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
checkParameters(idef) {
|
|
122
122
|
var _a;
|
|
123
123
|
for (const m of ((_a = idef.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
|
|
124
124
|
for (const p of m.getParameters().getAll()) {
|
|
@@ -128,6 +128,14 @@ class UnknownTypes {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
for (const e of idef.getEvents() || []) {
|
|
132
|
+
for (const p of e.getParameters()) {
|
|
133
|
+
const found = this.containsUnknown(p.getType());
|
|
134
|
+
if (found) {
|
|
135
|
+
return { id: p, found };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
131
139
|
return undefined;
|
|
132
140
|
}
|
|
133
141
|
containsUnknown(type) {
|
|
@@ -65,8 +65,7 @@ class XMLConsistency {
|
|
|
65
65
|
else if (name !== obj.getName().toUpperCase()) {
|
|
66
66
|
issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
|
|
67
67
|
}
|
|
68
|
-
else if (obj.getDefinition() ===
|
|
69
|
-
|| ((_b = obj.getDefinition()) === null || _b === void 0 ? void 0 : _b.getName().toUpperCase()) !== name.toUpperCase()) {
|
|
68
|
+
else if (obj.getDefinition() !== undefined && ((_b = obj.getDefinition()) === null || _b === void 0 ? void 0 : _b.getName().toUpperCase()) !== name.toUpperCase()) {
|
|
70
69
|
issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
|
|
71
70
|
}
|
|
72
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.91.
|
|
3
|
+
"version": "2.91.11",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.28.4",
|
|
49
49
|
"@types/chai": "^4.3.1",
|
|
50
50
|
"@types/mocha": "^9.1.1",
|
|
51
|
-
"@types/node": "^18.0.
|
|
51
|
+
"@types/node": "^18.0.6",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
|
-
"eslint": "^8.
|
|
53
|
+
"eslint": "^8.20.0",
|
|
54
54
|
"mocha": "^10.0.0",
|
|
55
|
-
"c8": "^7.
|
|
55
|
+
"c8": "^7.12.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^1.0.0",
|
|
58
58
|
"typescript": "^4.7.4"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"fast-xml-parser": "^4.0.
|
|
61
|
+
"fast-xml-parser": "^4.0.9",
|
|
62
62
|
"json5": "^2.2.1",
|
|
63
|
-
"vscode-languageserver-types": "^3.17.
|
|
63
|
+
"vscode-languageserver-types": "^3.17.2"
|
|
64
64
|
}
|
|
65
65
|
}
|