@abaplint/core 2.99.4 → 2.99.6
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 +2 -0
- package/build/src/abap/types/basic/character_type.js +1 -1
- package/build/src/abap/types/basic/floating_point_type.js +1 -1
- package/build/src/abap/types/basic/hex_type.js +1 -1
- package/build/src/abap/types/basic/numeric_type.js +1 -1
- package/build/src/abap/types/basic/packed_type.js +2 -2
- package/build/src/config.js +2 -1
- package/build/src/objects/rename/rename_data_element.js +1 -0
- package/build/src/objects/rename/renamer_helper.js +15 -0
- package/build/src/registry.js +1 -1
- package/build/src/rules/check_comments.js +3 -1
- package/build/src/rules/select_single_full_key.js +17 -2
- package/build/src/rules/unnecessary_pragma.js +1 -0
- package/package.json +3 -3
- package/adhoc/lexer_performance.ts +0 -16
- package/adhoc/parser_performance.ts +0 -18
package/build/abaplint.d.ts
CHANGED
|
@@ -2811,6 +2811,8 @@ export declare interface IConfig {
|
|
|
2811
2811
|
app?: IAbaplintAppSettings;
|
|
2812
2812
|
/** Settings for each rule, see https://rules.abaplint.org */
|
|
2813
2813
|
rules: any;
|
|
2814
|
+
/** see https://abaplint.app */
|
|
2815
|
+
targetRules?: any;
|
|
2814
2816
|
}
|
|
2815
2817
|
|
|
2816
2818
|
export declare interface IConfiguration {
|
|
@@ -7,7 +7,7 @@ class FloatingPointType extends _abstract_type_1.AbstractType {
|
|
|
7
7
|
constructor(length, qualifiedName) {
|
|
8
8
|
super({ qualifiedName: qualifiedName });
|
|
9
9
|
if (length <= 0) {
|
|
10
|
-
throw new Error("Bad LENGTH");
|
|
10
|
+
throw new Error("Bad LENGTH, Floating Point");
|
|
11
11
|
}
|
|
12
12
|
this.length = length;
|
|
13
13
|
}
|
|
@@ -6,7 +6,7 @@ class NumericType extends _abstract_type_1.AbstractType {
|
|
|
6
6
|
constructor(length, qualifiedName) {
|
|
7
7
|
super({ qualifiedName: qualifiedName });
|
|
8
8
|
if (length <= 0) {
|
|
9
|
-
throw new Error("Bad LENGTH");
|
|
9
|
+
throw new Error("Bad LENGTH, Numeric");
|
|
10
10
|
}
|
|
11
11
|
this.length = length;
|
|
12
12
|
}
|
|
@@ -6,10 +6,10 @@ class PackedType extends _abstract_type_1.AbstractType {
|
|
|
6
6
|
constructor(length, decimals, extra) {
|
|
7
7
|
super(extra);
|
|
8
8
|
if (length <= 0) {
|
|
9
|
-
throw new Error("Bad LENGTH");
|
|
9
|
+
throw new Error("Bad LENGTH, Packed");
|
|
10
10
|
}
|
|
11
11
|
else if (decimals < 0) {
|
|
12
|
-
throw new Error("Bad DECIMALS");
|
|
12
|
+
throw new Error("Bad DECIMALS, Packed");
|
|
13
13
|
}
|
|
14
14
|
this.length = length;
|
|
15
15
|
this.decimals = decimals;
|
package/build/src/config.js
CHANGED
|
@@ -50,9 +50,10 @@ class Config {
|
|
|
50
50
|
return new Config(JSON.stringify(config));
|
|
51
51
|
}
|
|
52
52
|
getEnabledRules() {
|
|
53
|
+
var _a;
|
|
53
54
|
const rules = [];
|
|
54
55
|
for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {
|
|
55
|
-
const ruleConfig = this.config["rules"][rule.getMetadata().key];
|
|
56
|
+
const ruleConfig = (_a = this.config["rules"]) === null || _a === void 0 ? void 0 : _a[rule.getMetadata().key];
|
|
56
57
|
const ruleExists = ruleConfig !== undefined;
|
|
57
58
|
if (ruleExists) {
|
|
58
59
|
if (ruleConfig === false) { // "rule": false
|
|
@@ -18,6 +18,7 @@ class RenameDataElement {
|
|
|
18
18
|
changes = changes.concat(helper.renameDDICCodeReferences(obj, oldName, newName));
|
|
19
19
|
changes = changes.concat(helper.renameDDICTABLReferences(obj, oldName, newName));
|
|
20
20
|
changes = changes.concat(helper.renameDDICTTYPReferences(obj, oldName, newName));
|
|
21
|
+
changes = changes.concat(helper.renameDDICAUTHReferences(obj, oldName, newName));
|
|
21
22
|
return {
|
|
22
23
|
documentChanges: changes,
|
|
23
24
|
};
|
|
@@ -87,6 +87,21 @@ class RenamerHelper {
|
|
|
87
87
|
}
|
|
88
88
|
return changes;
|
|
89
89
|
}
|
|
90
|
+
renameDDICAUTHReferences(obj, oldName, newName) {
|
|
91
|
+
const changes = [];
|
|
92
|
+
const used = this.reg.getDDICReferences().listWhereUsed(obj);
|
|
93
|
+
for (const u of used) {
|
|
94
|
+
if (u.type !== "AUTH") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const tabl = this.reg.getObject(u.type, u.name);
|
|
98
|
+
if (tabl === undefined) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
changes.push(...this.buildXMLFileEdits(tabl, "ROLLNAME", oldName, newName));
|
|
102
|
+
}
|
|
103
|
+
return changes;
|
|
104
|
+
}
|
|
90
105
|
buildXMLFileEdits(object, xmlTag, oldName, newName) {
|
|
91
106
|
const changes = [];
|
|
92
107
|
const xml = object.getXMLFile();
|
package/build/src/registry.js
CHANGED
|
@@ -30,10 +30,12 @@ class CheckComments extends _abap_rule_1.ABAPRule {
|
|
|
30
30
|
shortDescription: `
|
|
31
31
|
Various checks for comment usage.`,
|
|
32
32
|
extendedInformation: `
|
|
33
|
-
|
|
33
|
+
Detects end of line comments. Comments starting with "#EC" or "##" are ignored
|
|
34
34
|
|
|
35
35
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,
|
|
36
36
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
37
|
+
badExample: `WRITE 2. " descriptive comment`,
|
|
38
|
+
goodExample: `" descriptive comment\nWRITE 2.`,
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
getDescription(issueType) {
|
|
@@ -6,6 +6,10 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
|
6
6
|
const _irule_1 = require("./_irule");
|
|
7
7
|
const __1 = require("..");
|
|
8
8
|
class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.allowPseudo = true;
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
14
|
exports.SelectSingleFullKeyConf = SelectSingleFullKeyConf;
|
|
11
15
|
class SelectSingleFullKey {
|
|
@@ -27,6 +31,14 @@ class SelectSingleFullKey {
|
|
|
27
31
|
return this;
|
|
28
32
|
}
|
|
29
33
|
getConfig() {
|
|
34
|
+
if (this.conf === undefined) {
|
|
35
|
+
this.conf = {
|
|
36
|
+
allowPseudo: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (this.conf.allowPseudo === undefined) {
|
|
40
|
+
this.conf.allowPseudo = true;
|
|
41
|
+
}
|
|
30
42
|
return this.conf;
|
|
31
43
|
}
|
|
32
44
|
setConfig(conf) {
|
|
@@ -58,7 +70,11 @@ class SelectSingleFullKey {
|
|
|
58
70
|
continue;
|
|
59
71
|
}
|
|
60
72
|
const next = statements[i + 1];
|
|
61
|
-
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof __1.Comment
|
|
73
|
+
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof __1.Comment
|
|
74
|
+
&& next.concatTokens().includes(this.getMetadata().pseudoComment + "")) {
|
|
75
|
+
if (this.getConfig().allowPseudo !== true) {
|
|
76
|
+
issues.push(issue_1.Issue.atStatement(file, s, "Pseudo comment not allowed", this.getMetadata().key, this.getConfig().severity));
|
|
77
|
+
}
|
|
62
78
|
continue;
|
|
63
79
|
}
|
|
64
80
|
const tabl = this.findReference(databaseTable.getFirstToken().getStart(), syntax.spaghetti, file);
|
|
@@ -67,7 +83,6 @@ class SelectSingleFullKey {
|
|
|
67
83
|
continue;
|
|
68
84
|
}
|
|
69
85
|
const keys = table.listKeys(this.reg);
|
|
70
|
-
// const type = table.parseType(this.reg);
|
|
71
86
|
const cond = s.findFirstExpression(__1.Expressions.SQLCond);
|
|
72
87
|
const set = new Set();
|
|
73
88
|
for (const key of keys) {
|
|
@@ -118,6 +118,7 @@ ENDIF.`,
|
|
|
118
118
|
&& !(statement.get() instanceof Statements.DataEnd)
|
|
119
119
|
&& !(statement.get() instanceof Statements.Type)
|
|
120
120
|
&& !(statement.get() instanceof Statements.Form)
|
|
121
|
+
&& !(statement.get() instanceof Statements.Tables)
|
|
121
122
|
&& !(statement.get() instanceof Statements.TypeEnd)
|
|
122
123
|
&& !(statement.get() instanceof Statements.Constant)
|
|
123
124
|
&& !(statement.get() instanceof Statements.ConstantEnd)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.99.
|
|
3
|
+
"version": "2.99.6",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://abaplint.org",
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@microsoft/api-extractor": "^7.34.
|
|
50
|
+
"@microsoft/api-extractor": "^7.34.8",
|
|
51
51
|
"@types/chai": "^4.3.5",
|
|
52
52
|
"@types/mocha": "^10.0.1",
|
|
53
|
-
"@types/node": "^
|
|
53
|
+
"@types/node": "^20.0.0",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
55
|
"eslint": "^8.39.0",
|
|
56
56
|
"mocha": "^10.2.0",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {MemoryFile} from "../src";
|
|
2
|
-
import {Lexer} from "../src/abap/1_lexer/lexer";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
|
|
5
|
-
console.log("========================");
|
|
6
|
-
const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
|
|
7
|
-
|
|
8
|
-
let total = 0;
|
|
9
|
-
for (let i = 0; i < 10; i++) {
|
|
10
|
-
const before = Date.now();
|
|
11
|
-
const result = new Lexer().run(file);
|
|
12
|
-
const runtime = Date.now() - before;
|
|
13
|
-
console.log("Runtime: " + runtime + "ms, Tokens: " + result.tokens.length);
|
|
14
|
-
total += runtime;
|
|
15
|
-
}
|
|
16
|
-
console.log("Total: " + total + "ms");
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {MemoryFile, Version} from "../src";
|
|
2
|
-
import {Lexer} from "../src/abap/1_lexer/lexer";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import {StatementParser} from "../src/abap/2_statements/statement_parser";
|
|
5
|
-
|
|
6
|
-
console.log("========================");
|
|
7
|
-
const file = new MemoryFile("abapgit.abap", fs.readFileSync("./lexer_performance.abap", "utf-8"));
|
|
8
|
-
|
|
9
|
-
const lexerResult = new Lexer().run(file);
|
|
10
|
-
|
|
11
|
-
let total = 0;
|
|
12
|
-
for (let i = 0; i < 4; i++) {
|
|
13
|
-
const before = Date.now();
|
|
14
|
-
new StatementParser(Version.v702).run([lexerResult], []);
|
|
15
|
-
const runtime = Date.now() - before;
|
|
16
|
-
total += runtime;
|
|
17
|
-
}
|
|
18
|
-
console.log("Total: " + total + "ms");
|