@abaplint/core 2.99.0 → 2.99.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/registry.js
CHANGED
|
@@ -7,6 +7,7 @@ const issue_1 = require("../issue");
|
|
|
7
7
|
const Expressions = require("../abap/2_statements/expressions");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
9
9
|
const statements_1 = require("../abap/2_statements/statements");
|
|
10
|
+
const edit_helper_1 = require("../edit_helper");
|
|
10
11
|
class OmitPrecedingZerosConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
12
|
}
|
|
12
13
|
exports.OmitPrecedingZerosConf = OmitPrecedingZerosConf;
|
|
@@ -20,7 +21,7 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
|
20
21
|
key: "omit_preceding_zeros",
|
|
21
22
|
title: "Omit preceding zeros",
|
|
22
23
|
shortDescription: `Omit preceding zeros from integer constants`,
|
|
23
|
-
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
24
25
|
badExample: `int = -001.`,
|
|
25
26
|
goodExample: `int = -1.`,
|
|
26
27
|
};
|
|
@@ -43,7 +44,9 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
|
43
44
|
if (s.get() instanceof statements_1.CallScreen || s.get() instanceof statements_1.SetScreen) {
|
|
44
45
|
continue;
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
+
const replace = str.replace(/^0+/, "");
|
|
48
|
+
const fix = edit_helper_1.EditHelper.replaceRange(file, token.getStart(), token.getEnd(), replace);
|
|
49
|
+
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity, fix);
|
|
47
50
|
issues.push(issue);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
@@ -51,7 +54,9 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
|
51
54
|
const token = (_a = i.findDirectExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
52
55
|
const str = token === null || token === void 0 ? void 0 : token.getStr();
|
|
53
56
|
if (token && str && str.length > 1 && str.startsWith("0")) {
|
|
54
|
-
const
|
|
57
|
+
const replace = str.replace(/^0+/, "");
|
|
58
|
+
const fix = edit_helper_1.EditHelper.replaceRange(file, token.getStart(), token.getEnd(), replace);
|
|
59
|
+
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity, fix);
|
|
55
60
|
issues.push(issue);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -37,7 +37,7 @@ class SMIMConsistency {
|
|
|
37
37
|
}
|
|
38
38
|
const base = this.base(obj.getURL() || "");
|
|
39
39
|
if (base !== "" && this.findFolder(base) === false) {
|
|
40
|
-
const message =
|
|
40
|
+
const message = `Parent folder "${base}" not found`;
|
|
41
41
|
const position = new position_1.Position(1, 1);
|
|
42
42
|
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, message, this.getMetadata().key, this.conf.severity);
|
|
43
43
|
issues.push(issue);
|
|
@@ -51,7 +51,8 @@ class SMIMConsistency {
|
|
|
51
51
|
}
|
|
52
52
|
findFolder(base) {
|
|
53
53
|
for (const smim of this.reg.getObjectsByType("SMIM")) {
|
|
54
|
-
|
|
54
|
+
const mime = smim;
|
|
55
|
+
if (base === mime.getURL() && mime.isFolder() === true) {
|
|
55
56
|
return true;
|
|
56
57
|
}
|
|
57
58
|
}
|