@abaplint/core 2.79.7 → 2.79.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/abaplint.d.ts +11 -3
- package/build/src/abap/5_syntax/_builtin.js +1 -0
- package/build/src/abap/5_syntax/basic_types.js +2 -2
- package/build/src/abap/5_syntax/statements/delete_cluster.js +1 -1
- package/build/src/abap/5_syntax/statements/export.js +1 -1
- package/build/src/abap/5_syntax/statements/import.js +1 -1
- package/build/src/abap/5_syntax/statements/tables.js +1 -1
- package/build/src/ddic_references.js +2 -2
- package/build/src/objects/data_element.js +1 -1
- package/build/src/objects/rename/rename_data_element.js +26 -0
- package/build/src/objects/rename/rename_domain.js +25 -0
- package/build/src/objects/rename/renamer.js +6 -0
- package/build/src/objects/rename/renamer_helper.js +46 -3
- package/build/src/objects/table.js +5 -5
- package/build/src/objects/table_type.js +4 -4
- package/build/src/objects/view.js +5 -5
- package/build/src/registry.js +1 -1
- package/build/src/rules/avoid_use.js +3 -2
- package/build/src/rules/constant_classes.js +5 -0
- package/build/src/rules/exit_or_check.js +13 -14
- package/build/src/rules/unused_variables.js +2 -4
- package/package.json +5 -5
package/build/abaplint.d.ts
CHANGED
|
@@ -2398,13 +2398,15 @@ declare interface IConfiguration {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
2400
2400
|
declare interface IDDICReferences {
|
|
2401
|
-
setUsing(obj: IObject, using: readonly
|
|
2402
|
-
addUsing(obj: IObject, using:
|
|
2401
|
+
setUsing(obj: IObject, using: readonly IObjectAndToken[]): void;
|
|
2402
|
+
addUsing(obj: IObject, using: IObjectAndToken | undefined): void;
|
|
2403
2403
|
clear(obj: IObject): void;
|
|
2404
|
-
listUsing(obj: IObject): readonly
|
|
2404
|
+
listUsing(obj: IObject): readonly IObjectAndToken[];
|
|
2405
2405
|
listWhereUsed(obj: IObject): {
|
|
2406
2406
|
type: string;
|
|
2407
2407
|
name: string;
|
|
2408
|
+
token?: Token;
|
|
2409
|
+
filename?: string;
|
|
2408
2410
|
}[];
|
|
2409
2411
|
}
|
|
2410
2412
|
|
|
@@ -2908,6 +2910,12 @@ export declare interface IObject extends IArtifact {
|
|
|
2908
2910
|
getXML(): string | undefined;
|
|
2909
2911
|
}
|
|
2910
2912
|
|
|
2913
|
+
declare interface IObjectAndToken {
|
|
2914
|
+
object?: IObject;
|
|
2915
|
+
token?: Token;
|
|
2916
|
+
filename?: string;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2911
2919
|
declare interface IParseResult {
|
|
2912
2920
|
updated: boolean;
|
|
2913
2921
|
runtime: number;
|
|
@@ -249,6 +249,7 @@ class BuiltIn {
|
|
|
249
249
|
components.push({ name: "index", type: new basic_1.IntegerType() });
|
|
250
250
|
components.push({ name: "langu", type: new basic_1.CharacterType(1) });
|
|
251
251
|
components.push({ name: "ldbpg", type: new basic_1.CharacterType(40) });
|
|
252
|
+
components.push({ name: "pdest", type: new basic_1.CharacterType(4) });
|
|
252
253
|
components.push({ name: "lilli", type: new basic_1.IntegerType() });
|
|
253
254
|
components.push({ name: "linct", type: new basic_1.IntegerType() });
|
|
254
255
|
components.push({ name: "linno", type: new basic_1.IntegerType() });
|
|
@@ -163,7 +163,7 @@ class BasicTypes {
|
|
|
163
163
|
}
|
|
164
164
|
const ddic = this.scope.getDDIC().lookup(chainText);
|
|
165
165
|
if (ddic) {
|
|
166
|
-
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), ddic.object);
|
|
166
|
+
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: ddic.object, token: typeName.getFirstToken(), filename: this.filename });
|
|
167
167
|
if (ddic.type instanceof _typed_identifier_1.TypedIdentifier) {
|
|
168
168
|
this.scope.addReference(typeName.getFirstToken(), ddic.type, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
169
169
|
}
|
|
@@ -469,7 +469,7 @@ class BasicTypes {
|
|
|
469
469
|
foundType = found === null || found === void 0 ? void 0 : found.getType();
|
|
470
470
|
if (foundType === undefined) {
|
|
471
471
|
const f = this.scope.getDDIC().lookupTableOrView(subs[0]);
|
|
472
|
-
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), f.object);
|
|
472
|
+
this.scope.getDDICReferences().addUsing(this.scope.getParentObj(), { object: f.object });
|
|
473
473
|
if (f.type instanceof _typed_identifier_1.TypedIdentifier) {
|
|
474
474
|
foundType = f.type.getType();
|
|
475
475
|
}
|
|
@@ -13,7 +13,7 @@ class DeleteCluster {
|
|
|
13
13
|
if (databaseName) {
|
|
14
14
|
const found = (_a = scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(databaseName.concatTokens());
|
|
15
15
|
if (found) {
|
|
16
|
-
scope.getDDICReferences().addUsing(scope.getParentObj(), found.object);
|
|
16
|
+
scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object });
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -17,7 +17,7 @@ class Export {
|
|
|
17
17
|
if (databaseName) {
|
|
18
18
|
const found = (_a = scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(databaseName.concatTokens());
|
|
19
19
|
if (found) {
|
|
20
|
-
scope.getDDICReferences().addUsing(scope.getParentObj(), found.object);
|
|
20
|
+
scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -17,7 +17,7 @@ class Import {
|
|
|
17
17
|
if (databaseName) {
|
|
18
18
|
const found = (_a = scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(databaseName.concatTokens());
|
|
19
19
|
if (found) {
|
|
20
|
-
scope.getDDICReferences().addUsing(scope.getParentObj(), found.object);
|
|
20
|
+
scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -17,7 +17,7 @@ class Tables {
|
|
|
17
17
|
}
|
|
18
18
|
const found = (_b = scope.getDDIC()) === null || _b === void 0 ? void 0 : _b.lookupTableOrView(name);
|
|
19
19
|
if (found) {
|
|
20
|
-
scope.getDDICReferences().addUsing(scope.getParentObj(), found.object);
|
|
20
|
+
scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found.object });
|
|
21
21
|
scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, found.type));
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -50,8 +50,8 @@ class DDICReferences {
|
|
|
50
50
|
for (const name in this.index) {
|
|
51
51
|
for (const type in this.index[name]) {
|
|
52
52
|
for (const f of this.index[name][type]) {
|
|
53
|
-
if (f.getType() === searchType && f.getName() === searchName) {
|
|
54
|
-
ret.push({ type, name });
|
|
53
|
+
if (f.object && f.object.getType() === searchType && f.object.getName() === searchName) {
|
|
54
|
+
ret.push({ type, name, token: f.token, filename: f.filename });
|
|
55
55
|
break; // current outermost loop
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -60,7 +60,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
if (lookup.object) {
|
|
63
|
-
references.push(lookup.object);
|
|
63
|
+
references.push({ object: lookup.object });
|
|
64
64
|
}
|
|
65
65
|
reg.getDDICReferences().setUsing(this, references);
|
|
66
66
|
return lookup.type;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenameDataElement = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const renamer_helper_1 = require("./renamer_helper");
|
|
6
|
+
class RenameDataElement {
|
|
7
|
+
constructor(reg) {
|
|
8
|
+
this.reg = reg;
|
|
9
|
+
}
|
|
10
|
+
buildEdits(obj, oldName, newName) {
|
|
11
|
+
if (!(obj instanceof __1.DataElement)) {
|
|
12
|
+
throw new Error("RenameDataElement, not a data element");
|
|
13
|
+
}
|
|
14
|
+
let changes = [];
|
|
15
|
+
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
16
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ROLLNAME", oldName, newName));
|
|
17
|
+
changes = changes.concat(helper.renameFiles(obj, oldName, newName));
|
|
18
|
+
changes = changes.concat(helper.renameDDICCodeReferences(obj, oldName, newName));
|
|
19
|
+
changes = changes.concat(helper.renameDDICTABLReferences(obj, oldName, newName));
|
|
20
|
+
return {
|
|
21
|
+
documentChanges: changes,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RenameDataElement = RenameDataElement;
|
|
26
|
+
//# sourceMappingURL=rename_data_element.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenameDomain = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const renamer_helper_1 = require("./renamer_helper");
|
|
6
|
+
class RenameDomain {
|
|
7
|
+
constructor(reg) {
|
|
8
|
+
this.reg = reg;
|
|
9
|
+
}
|
|
10
|
+
buildEdits(obj, oldName, newName) {
|
|
11
|
+
if (!(obj instanceof __1.Domain)) {
|
|
12
|
+
throw new Error("RenameDomain, not a domain");
|
|
13
|
+
}
|
|
14
|
+
let changes = [];
|
|
15
|
+
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
16
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "DOMNAME", oldName, newName));
|
|
17
|
+
changes = changes.concat(helper.renameFiles(obj, oldName, newName));
|
|
18
|
+
changes = changes.concat(helper.renameDDICDTELReferences(obj, oldName, newName));
|
|
19
|
+
return {
|
|
20
|
+
documentChanges: changes,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.RenameDomain = RenameDomain;
|
|
25
|
+
//# sourceMappingURL=rename_domain.js.map
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Renamer = void 0;
|
|
4
4
|
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
5
5
|
const memory_file_1 = require("../../files/memory_file");
|
|
6
|
+
const rename_data_element_1 = require("./rename_data_element");
|
|
7
|
+
const rename_domain_1 = require("./rename_domain");
|
|
6
8
|
const rename_global_class_1 = require("./rename_global_class");
|
|
7
9
|
const rename_global_interface_1 = require("./rename_global_interface");
|
|
8
10
|
class Renamer {
|
|
@@ -40,6 +42,10 @@ class Renamer {
|
|
|
40
42
|
switch (type) {
|
|
41
43
|
case "CLAS":
|
|
42
44
|
return new rename_global_class_1.RenameGlobalClass(this.reg);
|
|
45
|
+
case "DTEL":
|
|
46
|
+
return new rename_data_element_1.RenameDataElement(this.reg);
|
|
47
|
+
case "DOMA":
|
|
48
|
+
return new rename_domain_1.RenameDomain(this.reg);
|
|
43
49
|
case "INTF":
|
|
44
50
|
return new rename_global_interface_1.RenameGlobalInterface(this.reg);
|
|
45
51
|
default:
|
|
@@ -27,19 +27,62 @@ class RenamerHelper {
|
|
|
27
27
|
// start with the last reference in the file first, if there are multiple refs per line
|
|
28
28
|
return this.replaceRefs(refs, oldName, newName).reverse();
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
renameDDICCodeReferences(obj, oldName, newName) {
|
|
31
31
|
const changes = [];
|
|
32
|
-
const
|
|
32
|
+
const used = this.reg.getDDICReferences().listWhereUsed(obj);
|
|
33
|
+
for (const u of used) {
|
|
34
|
+
if (u.token === undefined || u.filename === undefined) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const range = vscode_languageserver_types_1.Range.create(u.token.getStart().getRow() - 1, u.token.getStart().getCol() - 1, u.token.getStart().getRow() - 1, u.token.getStart().getCol() - 1 + oldName.length);
|
|
38
|
+
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: u.filename, version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toLowerCase())]));
|
|
39
|
+
}
|
|
40
|
+
return changes;
|
|
41
|
+
}
|
|
42
|
+
renameDDICTABLReferences(obj, oldName, newName) {
|
|
43
|
+
const changes = [];
|
|
44
|
+
const used = this.reg.getDDICReferences().listWhereUsed(obj);
|
|
45
|
+
for (const u of used) {
|
|
46
|
+
if (u.type !== "TABL") {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const tabl = this.reg.getObject(u.type, u.name);
|
|
50
|
+
if (tabl === undefined) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
changes.push(...this.buildXMLFileEdits(tabl, "ROLLNAME", oldName, newName));
|
|
54
|
+
}
|
|
55
|
+
return changes;
|
|
56
|
+
}
|
|
57
|
+
renameDDICDTELReferences(obj, oldName, newName) {
|
|
58
|
+
const changes = [];
|
|
59
|
+
const used = this.reg.getDDICReferences().listWhereUsed(obj);
|
|
60
|
+
for (const u of used) {
|
|
61
|
+
if (u.type !== "DTEL") {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const tabl = this.reg.getObject(u.type, u.name);
|
|
65
|
+
if (tabl === undefined) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
changes.push(...this.buildXMLFileEdits(tabl, "DOMNAME", oldName, newName));
|
|
69
|
+
}
|
|
70
|
+
return changes;
|
|
71
|
+
}
|
|
72
|
+
buildXMLFileEdits(object, xmlTag, oldName, newName) {
|
|
73
|
+
const changes = [];
|
|
74
|
+
const xml = object.getXMLFile();
|
|
33
75
|
if (xml === undefined) {
|
|
34
76
|
return [];
|
|
35
77
|
}
|
|
36
78
|
const tag = xmlTag.toUpperCase();
|
|
37
79
|
const search = "<" + tag + ">" + oldName.toUpperCase() + "</" + tag + ">";
|
|
80
|
+
const length = tag.length + 2;
|
|
38
81
|
const rows = xml.getRawRows();
|
|
39
82
|
for (let i = 0; i < rows.length; i++) {
|
|
40
83
|
const index = rows[i].indexOf(search);
|
|
41
84
|
if (index >= 0) {
|
|
42
|
-
const range = vscode_languageserver_types_1.Range.create(i, index +
|
|
85
|
+
const range = vscode_languageserver_types_1.Range.create(i, index + length, i, index + oldName.length + length);
|
|
43
86
|
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toUpperCase())]));
|
|
44
87
|
}
|
|
45
88
|
}
|
|
@@ -74,7 +74,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
74
74
|
const lookup = ddic.lookupDataElement(field.ROLLNAME);
|
|
75
75
|
components.push({ name: field.FIELDNAME, type: lookup.type });
|
|
76
76
|
if (lookup.object) {
|
|
77
|
-
references.push(lookup.object);
|
|
77
|
+
references.push({ object: lookup.object });
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
else if (field.FIELDNAME === ".INCLUDE" || field.FIELDNAME === ".INCLU--AP") { // incude or append structure
|
|
@@ -84,7 +84,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
84
84
|
const lookup = ddic.lookupTableOrView(field.PRECFIELD);
|
|
85
85
|
let found = lookup.type;
|
|
86
86
|
if (lookup.object) {
|
|
87
|
-
references.push(lookup.object);
|
|
87
|
+
references.push({ object: lookup.object });
|
|
88
88
|
}
|
|
89
89
|
if (found instanceof _typed_identifier_1.TypedIdentifier) {
|
|
90
90
|
found = found.getType();
|
|
@@ -119,7 +119,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
119
119
|
const lookup = ddic.lookupTableOrView(field.ROLLNAME);
|
|
120
120
|
components.push({ name: field.FIELDNAME, type: lookup.type });
|
|
121
121
|
if (lookup.object) {
|
|
122
|
-
references.push(lookup.object);
|
|
122
|
+
references.push({ object: lookup.object });
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
else if (comptype === "R") {
|
|
@@ -136,7 +136,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
136
136
|
const lookup = ddic.lookupObject(field.ROLLNAME);
|
|
137
137
|
components.push({ name: field.FIELDNAME, type: lookup.type });
|
|
138
138
|
if (lookup.object) {
|
|
139
|
-
references.push(lookup.object);
|
|
139
|
+
references.push({ object: lookup.object });
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -144,7 +144,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
144
144
|
const lookup = ddic.lookupTableType(field.ROLLNAME);
|
|
145
145
|
components.push({ name: field.FIELDNAME, type: lookup.type });
|
|
146
146
|
if (lookup.object) {
|
|
147
|
-
references.push(lookup.object);
|
|
147
|
+
references.push({ object: lookup.object });
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
else if (comptype === "") { // built in
|
|
@@ -38,28 +38,28 @@ class TableType extends _abstract_object_1.AbstractObject {
|
|
|
38
38
|
const lookup = ddic.lookupTableOrView(this.parsedXML.rowtype);
|
|
39
39
|
type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
|
|
40
40
|
if (lookup.object) {
|
|
41
|
-
references.push(lookup.object);
|
|
41
|
+
references.push({ object: lookup.object });
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else if (this.parsedXML.rowkind === "E") {
|
|
45
45
|
const lookup = ddic.lookupDataElement(this.parsedXML.rowtype);
|
|
46
46
|
type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
|
|
47
47
|
if (lookup.object) {
|
|
48
|
-
references.push(lookup.object);
|
|
48
|
+
references.push({ object: lookup.object });
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
else if (this.parsedXML.rowkind === "L") {
|
|
52
52
|
const lookup = ddic.lookupTableType(this.parsedXML.rowtype);
|
|
53
53
|
type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
|
|
54
54
|
if (lookup.object) {
|
|
55
|
-
references.push(lookup.object);
|
|
55
|
+
references.push({ object: lookup.object });
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
else if (this.parsedXML.rowkind === "R" && this.parsedXML.rowtype !== undefined) {
|
|
59
59
|
const lookup = ddic.lookupObject(this.parsedXML.rowtype);
|
|
60
60
|
type = new Types.TableType(lookup.type, { withHeader: false }, this.getName());
|
|
61
61
|
if (lookup.object) {
|
|
62
|
-
references.push(lookup.object);
|
|
62
|
+
references.push({ object: lookup.object });
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
else if (this.parsedXML.rowkind === "") {
|
|
@@ -5,7 +5,6 @@ const Types = require("../abap/types/basic");
|
|
|
5
5
|
const _abstract_object_1 = require("./_abstract_object");
|
|
6
6
|
const xml_utils_1 = require("../xml_utils");
|
|
7
7
|
const ddic_1 = require("../ddic");
|
|
8
|
-
const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
9
8
|
class View extends _abstract_object_1.AbstractObject {
|
|
10
9
|
getType() {
|
|
11
10
|
return "VIEW";
|
|
@@ -36,12 +35,13 @@ class View extends _abstract_object_1.AbstractObject {
|
|
|
36
35
|
continue;
|
|
37
36
|
}
|
|
38
37
|
const lookup = ddic.lookupTableOrView(field.TABNAME);
|
|
38
|
+
let found = lookup.type;
|
|
39
39
|
if (lookup.object) {
|
|
40
|
-
references.push(lookup.object);
|
|
40
|
+
references.push({ object: lookup.object });
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (field.VIEWFIELD === ".APPEND") {
|
|
43
|
+
// it is already expanded in the abapGit xml
|
|
44
|
+
continue;
|
|
45
45
|
}
|
|
46
46
|
if (found instanceof Types.StructureType) {
|
|
47
47
|
const s = found.getComponentByName(field.FIELDNAME);
|
package/build/src/registry.js
CHANGED
|
@@ -35,11 +35,12 @@ class AvoidUse extends _abap_rule_1.ABAPRule {
|
|
|
35
35
|
key: "avoid_use",
|
|
36
36
|
title: "Avoid use of certain statements",
|
|
37
37
|
shortDescription: `Detects usage of certain statements.`,
|
|
38
|
-
extendedInformation: `
|
|
39
|
-
DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
38
|
+
extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
40
39
|
|
|
41
40
|
Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
42
41
|
|
|
42
|
+
STATICS: use CLASS-DATA instead
|
|
43
|
+
|
|
43
44
|
DESCRIBE TABLE LINES: use lines() instead (quickfix exists)`,
|
|
44
45
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
45
46
|
};
|
|
@@ -7,6 +7,11 @@ const _irule_1 = require("./_irule");
|
|
|
7
7
|
const __1 = require("..");
|
|
8
8
|
/** Checks that constants classes are in sync with domain fixed values */
|
|
9
9
|
class ConstantClassesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/** Specify a list of domain-class pairs which will be validated */
|
|
13
|
+
this.mapping = [];
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
exports.ConstantClassesConf = ConstantClassesConf;
|
|
12
17
|
class ConstantClasses {
|
|
@@ -26,11 +26,9 @@ class ExitOrCheck extends _abap_rule_1.ABAPRule {
|
|
|
26
26
|
title: "Find EXIT or CHECK outside loops",
|
|
27
27
|
shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
|
|
28
28
|
Use RETURN to leave procesing blocks instead.`,
|
|
29
|
-
extendedInformation: `
|
|
30
|
-
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
29
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
31
30
|
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
32
|
-
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return
|
|
33
|
-
`,
|
|
31
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,
|
|
34
32
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
35
33
|
};
|
|
36
34
|
}
|
|
@@ -44,19 +42,20 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
|
|
|
44
42
|
const issues = [];
|
|
45
43
|
const stack = [];
|
|
46
44
|
for (const statement of file.getStatements()) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
||
|
|
50
|
-
||
|
|
45
|
+
const get = statement.get();
|
|
46
|
+
if (get instanceof Statements.Loop
|
|
47
|
+
|| get instanceof Statements.While
|
|
48
|
+
|| get instanceof Statements.SelectLoop
|
|
49
|
+
|| get instanceof Statements.Do) {
|
|
51
50
|
stack.push(statement);
|
|
52
51
|
}
|
|
53
|
-
else if (
|
|
54
|
-
||
|
|
55
|
-
||
|
|
56
|
-
||
|
|
52
|
+
else if (get instanceof Statements.EndLoop
|
|
53
|
+
|| get instanceof Statements.EndWhile
|
|
54
|
+
|| get instanceof Statements.EndSelect
|
|
55
|
+
|| get instanceof Statements.EndDo) {
|
|
57
56
|
stack.pop();
|
|
58
57
|
}
|
|
59
|
-
else if (this.conf.allowCheck === false &&
|
|
58
|
+
else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {
|
|
60
59
|
const message = "CHECK is not allowed outside of loops";
|
|
61
60
|
let tokensString = statement.concatTokens();
|
|
62
61
|
tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());
|
|
@@ -65,7 +64,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
|
|
|
65
64
|
const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);
|
|
66
65
|
issues.push(issue);
|
|
67
66
|
}
|
|
68
|
-
else if (this.conf.allowExit === false &&
|
|
67
|
+
else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {
|
|
69
68
|
const message = "EXIT is not allowed outside of loops";
|
|
70
69
|
const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), "RETURN");
|
|
71
70
|
const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -186,12 +186,10 @@ class UnusedVariables {
|
|
|
186
186
|
if (statement === undefined) {
|
|
187
187
|
return undefined;
|
|
188
188
|
}
|
|
189
|
-
else if (statement.get() instanceof Statements.
|
|
190
|
-
return undefined; // function module parameters are not part of the code
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
189
|
+
else if (statement.get() instanceof Statements.Data) {
|
|
193
190
|
return edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
194
191
|
}
|
|
192
|
+
return undefined;
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
exports.UnusedVariables = UnusedVariables;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.79.
|
|
3
|
+
"version": "2.79.11",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -54,21 +54,21 @@
|
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://abaplint.org",
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@microsoft/api-extractor": "^7.18.
|
|
57
|
+
"@microsoft/api-extractor": "^7.18.11",
|
|
58
58
|
"@types/chai": "^4.2.22",
|
|
59
59
|
"@types/mocha": "^9.0.0",
|
|
60
|
-
"@types/node": "^16.
|
|
60
|
+
"@types/node": "^16.10.2",
|
|
61
61
|
"chai": "^4.3.4",
|
|
62
62
|
"eslint": "^7.32.0",
|
|
63
63
|
"madge": "^5.0.1",
|
|
64
|
-
"mocha": "^9.1.
|
|
64
|
+
"mocha": "^9.1.2",
|
|
65
65
|
"c8": "^7.9.0",
|
|
66
66
|
"source-map-support": "^0.5.20",
|
|
67
67
|
"ts-json-schema-generator": "^0.95.0",
|
|
68
68
|
"typescript": "^4.4.3"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"fast-xml-parser": "^3.20.
|
|
71
|
+
"fast-xml-parser": "^3.20.3",
|
|
72
72
|
"json5": "^2.2.0",
|
|
73
73
|
"vscode-languageserver-protocol": "^3.16.0",
|
|
74
74
|
"vscode-languageserver-types": "^3.16.0"
|