@abaplint/core 2.98.3 → 2.99.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
CHANGED
|
@@ -4041,6 +4041,7 @@ declare class MIMEObject extends AbstractObject {
|
|
|
4041
4041
|
getType(): string;
|
|
4042
4042
|
getURL(): string | undefined;
|
|
4043
4043
|
getClass(): string | undefined;
|
|
4044
|
+
isFolder(): boolean;
|
|
4044
4045
|
getAllowedNaming(): {
|
|
4045
4046
|
maxLength: number;
|
|
4046
4047
|
allowNamespace: boolean;
|
|
@@ -16,6 +16,10 @@ class MIMEObject extends _abstract_object_1.AbstractObject {
|
|
|
16
16
|
this.parse();
|
|
17
17
|
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.CLASS;
|
|
18
18
|
}
|
|
19
|
+
isFolder() {
|
|
20
|
+
var _a;
|
|
21
|
+
return ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.FOLDER) === "X";
|
|
22
|
+
}
|
|
19
23
|
getAllowedNaming() {
|
|
20
24
|
return {
|
|
21
25
|
maxLength: 32,
|
|
@@ -53,6 +57,7 @@ class MIMEObject extends _abstract_object_1.AbstractObject {
|
|
|
53
57
|
}
|
|
54
58
|
this.parsedXML.URL = parsed.abapGit["asx:abap"]["asx:values"].URL;
|
|
55
59
|
this.parsedXML.CLASS = parsed.abapGit["asx:abap"]["asx:values"].CLASS;
|
|
60
|
+
this.parsedXML.FOLDER = parsed.abapGit["asx:abap"]["asx:values"].FOLDER;
|
|
56
61
|
const end = Date.now();
|
|
57
62
|
return { updated: true, runtime: end - start };
|
|
58
63
|
}
|
package/build/src/registry.js
CHANGED
package/build/src/rules/index.js
CHANGED
|
@@ -138,6 +138,7 @@ __exportStar(require("./sequential_blank"), exports);
|
|
|
138
138
|
__exportStar(require("./short_case"), exports);
|
|
139
139
|
__exportStar(require("./sicf_consistency"), exports);
|
|
140
140
|
__exportStar(require("./slow_parameter_passing"), exports);
|
|
141
|
+
__exportStar(require("./smim_consistency"), exports);
|
|
141
142
|
__exportStar(require("./space_before_colon"), exports);
|
|
142
143
|
__exportStar(require("./space_before_dot"), exports);
|
|
143
144
|
__exportStar(require("./sql_escape_host_variables"), exports);
|
|
@@ -32,7 +32,9 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
|
32
32
|
this.conf = conf;
|
|
33
33
|
}
|
|
34
34
|
runParsed(file) {
|
|
35
|
+
var _a;
|
|
35
36
|
const issues = [];
|
|
37
|
+
const message = "Omit preceding zeros";
|
|
36
38
|
for (const s of file.getStatements()) {
|
|
37
39
|
for (const i of s.findAllExpressions(Expressions.Integer)) {
|
|
38
40
|
const token = i.getLastToken();
|
|
@@ -41,7 +43,14 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
|
41
43
|
if (s.get() instanceof statements_1.CallScreen || s.get() instanceof statements_1.SetScreen) {
|
|
42
44
|
continue;
|
|
43
45
|
}
|
|
44
|
-
const
|
|
46
|
+
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity);
|
|
47
|
+
issues.push(issue);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const i of s.findAllExpressions(Expressions.ParameterException)) {
|
|
51
|
+
const token = (_a = i.findDirectExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
52
|
+
const str = token === null || token === void 0 ? void 0 : token.getStr();
|
|
53
|
+
if (token && str && str.length > 1 && str.startsWith("0")) {
|
|
45
54
|
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity);
|
|
46
55
|
issues.push(issue);
|
|
47
56
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SMIMConsistency = exports.SMIMConsistencyConf = void 0;
|
|
4
|
+
const issue_1 = require("../issue");
|
|
5
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
6
|
+
const objects_1 = require("../objects");
|
|
7
|
+
const position_1 = require("../position");
|
|
8
|
+
class SMIMConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
9
|
+
}
|
|
10
|
+
exports.SMIMConsistencyConf = SMIMConsistencyConf;
|
|
11
|
+
class SMIMConsistency {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.conf = new SMIMConsistencyConf();
|
|
14
|
+
}
|
|
15
|
+
getMetadata() {
|
|
16
|
+
return {
|
|
17
|
+
key: "smim_consistency",
|
|
18
|
+
title: "SMIM consistency check",
|
|
19
|
+
shortDescription: `SMIM consistency check`,
|
|
20
|
+
extendedInformation: "Check folders exists",
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
getConfig() {
|
|
24
|
+
return this.conf;
|
|
25
|
+
}
|
|
26
|
+
setConfig(conf) {
|
|
27
|
+
this.conf = conf;
|
|
28
|
+
}
|
|
29
|
+
initialize(reg) {
|
|
30
|
+
this.reg = reg;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
run(obj) {
|
|
34
|
+
const issues = [];
|
|
35
|
+
if (!(obj instanceof objects_1.MIMEObject)) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const base = this.base(obj.getURL() || "");
|
|
39
|
+
if (base !== "" && this.findFolder(base) === false) {
|
|
40
|
+
const message = "Parent folder not found";
|
|
41
|
+
const position = new position_1.Position(1, 1);
|
|
42
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, message, this.getMetadata().key, this.conf.severity);
|
|
43
|
+
issues.push(issue);
|
|
44
|
+
}
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
base(full) {
|
|
48
|
+
const components = full.split("/");
|
|
49
|
+
components.pop();
|
|
50
|
+
return components.join("/");
|
|
51
|
+
}
|
|
52
|
+
findFolder(base) {
|
|
53
|
+
for (const smim of this.reg.getObjectsByType("SMIM")) {
|
|
54
|
+
if (base === smim.getURL()) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.SMIMConsistency = SMIMConsistency;
|
|
62
|
+
//# sourceMappingURL=smim_consistency.js.map
|