@abaplint/core 2.99.5 → 2.99.7
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/5_syntax/basic_types.js +17 -1
- 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/strict_sql.js +1 -1
- 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 {
|
|
@@ -842,7 +842,23 @@ class BasicTypes {
|
|
|
842
842
|
}
|
|
843
843
|
const constant = val.findFirstExpression(Expressions.Constant);
|
|
844
844
|
if (constant) {
|
|
845
|
-
|
|
845
|
+
const conc = val.findFirstExpression(Expressions.ConcatenatedConstant);
|
|
846
|
+
if (conc) {
|
|
847
|
+
const first = conc.getFirstToken().getStr().substring(0, 1);
|
|
848
|
+
let result = "";
|
|
849
|
+
for (const token of conc.getAllTokens()) {
|
|
850
|
+
if (token.getStr() === "&") {
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
result += token.getStr().substring(1, token.getStr().length - 1);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return first + result + first;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
return constant.concatTokens();
|
|
861
|
+
}
|
|
846
862
|
}
|
|
847
863
|
const chain = val.findFirstExpression(Expressions.SimpleFieldChain);
|
|
848
864
|
if (chain) {
|
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) {
|
|
@@ -29,7 +29,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mo
|
|
|
29
29
|
Also see separate rule sql_escape_host_variables
|
|
30
30
|
|
|
31
31
|
Activates from v750 and up`,
|
|
32
|
-
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.
|
|
32
|
+
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
getConfig() {
|
|
@@ -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.7",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
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.1.0",
|
|
54
54
|
"chai": "^4.3.7",
|
|
55
|
-
"eslint": "^8.
|
|
55
|
+
"eslint": "^8.40.0",
|
|
56
56
|
"mocha": "^10.2.0",
|
|
57
57
|
"c8": "^7.13.0",
|
|
58
58
|
"source-map-support": "^0.5.21",
|
|
@@ -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");
|