@abaplint/core 2.114.9 → 2.115.0
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 +4 -0
- package/build/src/abap/5_syntax/statements/concatenate.js +5 -0
- package/build/src/objects/table.js +4 -0
- package/build/src/objects/web_mime.js +16 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/identical_move.js +60 -0
- package/build/src/rules/index.js +2 -0
- package/build/src/rules/no_comments_between_methods.js +65 -0
- package/build/src/rules/uncaught_exception.js +8 -7
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -7642,6 +7642,10 @@ declare class WebMIME extends AbstractObject {
|
|
|
7642
7642
|
getType(): string;
|
|
7643
7643
|
getAllowedNaming(): IAllowedNaming;
|
|
7644
7644
|
getDescription(): string | undefined;
|
|
7645
|
+
getParameter(name: string): string | undefined;
|
|
7646
|
+
getParameters(): {
|
|
7647
|
+
[key: string]: string;
|
|
7648
|
+
};
|
|
7645
7649
|
setDirty(): void;
|
|
7646
7650
|
getDataFile(): IFile | undefined;
|
|
7647
7651
|
parse(): {
|
|
@@ -39,6 +39,11 @@ class Concatenate {
|
|
|
39
39
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
+
if (linesMode === true && byteMode === true && type instanceof basic_1.TableType && type.getRowType() instanceof basic_1.StructureType) {
|
|
43
|
+
const message = "Source row type must not be a structure in BYTE mode";
|
|
44
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
for (const s of node.findDirectExpressions(Expressions.SimpleSource3)) {
|
|
@@ -99,6 +99,10 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
99
99
|
&& this.parsedData.dataClass === "USER3") {
|
|
100
100
|
return new Types.UnknownType("Data class = USER3 not allowed in cloud");
|
|
101
101
|
}
|
|
102
|
+
if (this.getTableCategory() === TableCategory.Transparent
|
|
103
|
+
&& this.listKeys(reg).length === 0) {
|
|
104
|
+
return new Types.UnknownType("Table " + this.getName() + " has no key fields");
|
|
105
|
+
}
|
|
102
106
|
if (this.parsedType) {
|
|
103
107
|
return this.parsedType;
|
|
104
108
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebMIME = void 0;
|
|
4
|
+
const xml_utils_1 = require("../xml_utils");
|
|
4
5
|
const _abstract_object_1 = require("./_abstract_object");
|
|
5
6
|
class WebMIME extends _abstract_object_1.AbstractObject {
|
|
6
7
|
getType() {
|
|
@@ -18,6 +19,16 @@ class WebMIME extends _abstract_object_1.AbstractObject {
|
|
|
18
19
|
this.parse();
|
|
19
20
|
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
|
|
20
21
|
}
|
|
22
|
+
getParameter(name) {
|
|
23
|
+
var _a;
|
|
24
|
+
this.parse();
|
|
25
|
+
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.params[name.toLowerCase()];
|
|
26
|
+
}
|
|
27
|
+
getParameters() {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
this.parse();
|
|
30
|
+
return (_b = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
31
|
+
}
|
|
21
32
|
setDirty() {
|
|
22
33
|
this.parsedXML = undefined;
|
|
23
34
|
super.setDirty();
|
|
@@ -31,11 +42,12 @@ class WebMIME extends _abstract_object_1.AbstractObject {
|
|
|
31
42
|
return undefined;
|
|
32
43
|
}
|
|
33
44
|
parse() {
|
|
45
|
+
var _a;
|
|
34
46
|
if (this.parsedXML) {
|
|
35
47
|
return { updated: false, runtime: 0 };
|
|
36
48
|
}
|
|
37
49
|
const start = Date.now();
|
|
38
|
-
this.parsedXML = {};
|
|
50
|
+
this.parsedXML = { params: {} };
|
|
39
51
|
const parsed = super.parseRaw2();
|
|
40
52
|
if (parsed === undefined
|
|
41
53
|
|| parsed.abapGit === undefined
|
|
@@ -43,6 +55,9 @@ class WebMIME extends _abstract_object_1.AbstractObject {
|
|
|
43
55
|
return { updated: false, runtime: 0 };
|
|
44
56
|
}
|
|
45
57
|
this.parsedXML.description = parsed.abapGit["asx:abap"]["asx:values"].TEXT;
|
|
58
|
+
for (const param of (0, xml_utils_1.xmlToArray)((_a = parsed.abapGit["asx:abap"]["asx:values"].PARAMS) === null || _a === void 0 ? void 0 : _a.WWWPARAMS)) {
|
|
59
|
+
this.parsedXML.params[param.NAME.toLowerCase()] = param.VALUE;
|
|
60
|
+
}
|
|
46
61
|
const end = Date.now();
|
|
47
62
|
return { updated: true, runtime: end - start };
|
|
48
63
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdenticalMove = exports.IdenticalMoveConf = void 0;
|
|
4
|
+
const Statements = require("../abap/2_statements/statements");
|
|
5
|
+
const Expressions = require("../abap/2_statements/expressions");
|
|
6
|
+
const issue_1 = require("../issue");
|
|
7
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
8
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
9
|
+
const _irule_1 = require("./_irule");
|
|
10
|
+
const objects_1 = require("../objects");
|
|
11
|
+
class IdenticalMoveConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
|
+
}
|
|
13
|
+
exports.IdenticalMoveConf = IdenticalMoveConf;
|
|
14
|
+
class IdenticalMove extends _abap_rule_1.ABAPRule {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.conf = new IdenticalMoveConf();
|
|
18
|
+
}
|
|
19
|
+
getMetadata() {
|
|
20
|
+
return {
|
|
21
|
+
key: "identical_move",
|
|
22
|
+
title: "Identical move",
|
|
23
|
+
shortDescription: `Moving the same value from left to right or right to left is redundant.`,
|
|
24
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
25
|
+
badExample: `DATA lv_value TYPE i.
|
|
26
|
+
lv_value = lv_value.`,
|
|
27
|
+
goodExample: `DATA lv_value TYPE i.
|
|
28
|
+
lv_value = 5.`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
getConfig() {
|
|
32
|
+
return this.conf;
|
|
33
|
+
}
|
|
34
|
+
setConfig(conf) {
|
|
35
|
+
this.conf = conf;
|
|
36
|
+
}
|
|
37
|
+
runParsed(file, obj) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const issues = [];
|
|
40
|
+
if (!(obj instanceof objects_1.Class)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
else if (file !== obj.getMainABAPFile()) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
for (const statement of file.getStatements()) {
|
|
47
|
+
const statementType = statement.get();
|
|
48
|
+
if (statementType instanceof Statements.Move) {
|
|
49
|
+
const source = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
50
|
+
const target = (_b = statement.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
51
|
+
if (source === target && source !== undefined) {
|
|
52
|
+
issues.push(issue_1.Issue.atStatement(file, statement, "Comment between methods in global class implementation", this.getMetadata().key, this.conf.severity));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return issues;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.IdenticalMove = IdenticalMove;
|
|
60
|
+
//# sourceMappingURL=identical_move.js.map
|
package/build/src/rules/index.js
CHANGED
|
@@ -89,6 +89,7 @@ __exportStar(require("./intf_referencing_clas"), exports);
|
|
|
89
89
|
__exportStar(require("./invalid_table_index"), exports);
|
|
90
90
|
__exportStar(require("./keep_single_parameter_on_one_line"), exports);
|
|
91
91
|
__exportStar(require("./keyword_case"), exports);
|
|
92
|
+
__exportStar(require("./identical_move"), exports);
|
|
92
93
|
__exportStar(require("./line_break_multiple_parameters"), exports);
|
|
93
94
|
__exportStar(require("./line_break_style"), exports);
|
|
94
95
|
__exportStar(require("./line_length"), exports);
|
|
@@ -114,6 +115,7 @@ __exportStar(require("./nesting"), exports);
|
|
|
114
115
|
__exportStar(require("./newline_between_methods"), exports);
|
|
115
116
|
__exportStar(require("./no_aliases"), exports);
|
|
116
117
|
__exportStar(require("./no_chained_assignment"), exports);
|
|
118
|
+
__exportStar(require("./no_comments_between_methods"), exports);
|
|
117
119
|
__exportStar(require("./no_external_form_calls"), exports);
|
|
118
120
|
__exportStar(require("./no_inline_in_optional_branches"), exports);
|
|
119
121
|
__exportStar(require("./no_prefixes"), exports);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoCommentsBetweenMethods = exports.NoCommentsBetweenMethodsConf = void 0;
|
|
4
|
+
const Statements = require("../abap/2_statements/statements");
|
|
5
|
+
const issue_1 = require("../issue");
|
|
6
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
7
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
8
|
+
const _irule_1 = require("./_irule");
|
|
9
|
+
const objects_1 = require("../objects");
|
|
10
|
+
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
11
|
+
class NoCommentsBetweenMethodsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
|
+
}
|
|
13
|
+
exports.NoCommentsBetweenMethodsConf = NoCommentsBetweenMethodsConf;
|
|
14
|
+
class NoCommentsBetweenMethods extends _abap_rule_1.ABAPRule {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.conf = new NoCommentsBetweenMethodsConf();
|
|
18
|
+
}
|
|
19
|
+
getMetadata() {
|
|
20
|
+
return {
|
|
21
|
+
key: "no_comments_between_methods",
|
|
22
|
+
title: "No comments between methods in global classes",
|
|
23
|
+
shortDescription: `Its not possible to have comments between methods in global classes.`,
|
|
24
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Syntax],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
getConfig() {
|
|
28
|
+
return this.conf;
|
|
29
|
+
}
|
|
30
|
+
setConfig(conf) {
|
|
31
|
+
this.conf = conf;
|
|
32
|
+
}
|
|
33
|
+
runParsed(file, obj) {
|
|
34
|
+
const issues = [];
|
|
35
|
+
if (!(obj instanceof objects_1.Class)) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
else if (file !== obj.getMainABAPFile()) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
let inMethod = false;
|
|
42
|
+
let inClassImpl = false;
|
|
43
|
+
for (const statement of file.getStatements()) {
|
|
44
|
+
const statementType = statement.get();
|
|
45
|
+
if (statementType instanceof Statements.ClassImplementation) {
|
|
46
|
+
inClassImpl = true;
|
|
47
|
+
}
|
|
48
|
+
else if (statementType instanceof Statements.EndClass) {
|
|
49
|
+
inClassImpl = false;
|
|
50
|
+
}
|
|
51
|
+
else if (statementType instanceof Statements.MethodImplementation) {
|
|
52
|
+
inMethod = true;
|
|
53
|
+
}
|
|
54
|
+
else if (statementType instanceof Statements.EndMethod) {
|
|
55
|
+
inMethod = false;
|
|
56
|
+
}
|
|
57
|
+
else if (inClassImpl === true && inMethod === false && statementType instanceof _statement_1.Comment) {
|
|
58
|
+
issues.push(issue_1.Issue.atStatement(file, statement, "Comment between methods in global class implementation", this.getMetadata().key, this.conf.severity));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return issues;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.NoCommentsBetweenMethods = NoCommentsBetweenMethods;
|
|
65
|
+
//# sourceMappingURL=no_comments_between_methods.js.map
|
|
@@ -72,7 +72,7 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
72
72
|
return this.issues;
|
|
73
73
|
}
|
|
74
74
|
traverse(n, file) {
|
|
75
|
-
var _a, _b, _c, _d, _e
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
76
|
const get = n.get();
|
|
77
77
|
if (get instanceof Structures.ClassDefinition
|
|
78
78
|
|| get instanceof Structures.Interface) {
|
|
@@ -87,13 +87,14 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
87
87
|
this.traverse(c, file);
|
|
88
88
|
}
|
|
89
89
|
this.sinked = previous;
|
|
90
|
-
for (const
|
|
91
|
-
|
|
90
|
+
for (const catchStructure of n.findDirectStructures(Structures.Catch)) {
|
|
91
|
+
for (const c of catchStructure.getChildren()) {
|
|
92
|
+
this.traverse(c, file);
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
|
-
for (const c of ((
|
|
95
|
+
for (const c of ((_b = n.findDirectStructure(Structures.Cleanup)) === null || _b === void 0 ? void 0 : _b.getChildren()) || []) {
|
|
94
96
|
this.traverse(c, file);
|
|
95
97
|
}
|
|
96
|
-
return;
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
100
|
for (const c of n.getChildren()) {
|
|
@@ -122,10 +123,10 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
|
|
|
122
123
|
let name = undefined;
|
|
123
124
|
const concat = n.concatTokens().toUpperCase();
|
|
124
125
|
if (concat.startsWith("RAISE EXCEPTION TYPE ")) {
|
|
125
|
-
name = (
|
|
126
|
+
name = (_c = n.findFirstExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStr().toUpperCase();
|
|
126
127
|
}
|
|
127
128
|
else if (concat.startsWith("RAISE EXCEPTION NEW ")) {
|
|
128
|
-
name = (
|
|
129
|
+
name = (_e = (_d = n.findFirstExpression(Expressions.NewObject)) === null || _d === void 0 ? void 0 : _d.findFirstExpression(Expressions.TypeNameOrInfer)) === null || _e === void 0 ? void 0 : _e.getFirstToken().getStr().toUpperCase();
|
|
129
130
|
// todo: else its a normal Source, infer the type from it
|
|
130
131
|
}
|
|
131
132
|
this.check(name, n, file);
|