@abaplint/core 2.114.10 → 2.115.1
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/statements/concatenate.js +5 -0
- package/build/src/objects/table.js +4 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/identical_move.js +53 -0
- package/build/src/rules/index.js +2 -0
- package/build/src/rules/no_comments_between_methods.js +65 -0
- package/package.json +1 -1
|
@@ -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
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
class IdenticalMoveConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
|
+
}
|
|
12
|
+
exports.IdenticalMoveConf = IdenticalMoveConf;
|
|
13
|
+
class IdenticalMove extends _abap_rule_1.ABAPRule {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.conf = new IdenticalMoveConf();
|
|
17
|
+
}
|
|
18
|
+
getMetadata() {
|
|
19
|
+
return {
|
|
20
|
+
key: "identical_move",
|
|
21
|
+
title: "Identical move",
|
|
22
|
+
shortDescription: `Moving the same value from left to right or right to left is redundant.`,
|
|
23
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
|
+
badExample: `DATA lv_value TYPE i.
|
|
25
|
+
lv_value = lv_value.`,
|
|
26
|
+
goodExample: `DATA lv_value TYPE i.
|
|
27
|
+
lv_value = 5.`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
getConfig() {
|
|
31
|
+
return this.conf;
|
|
32
|
+
}
|
|
33
|
+
setConfig(conf) {
|
|
34
|
+
this.conf = conf;
|
|
35
|
+
}
|
|
36
|
+
runParsed(file, _obj) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const issues = [];
|
|
39
|
+
for (const statement of file.getStatements()) {
|
|
40
|
+
const statementType = statement.get();
|
|
41
|
+
if (statementType instanceof Statements.Move) {
|
|
42
|
+
const source = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
43
|
+
const target = (_b = statement.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
44
|
+
if (source === target && source !== undefined) {
|
|
45
|
+
issues.push(issue_1.Issue.atStatement(file, statement, "Comment between methods in global class implementation", this.getMetadata().key, this.conf.severity));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return issues;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.IdenticalMove = IdenticalMove;
|
|
53
|
+
//# 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
|