@abaplint/core 2.118.11 → 2.119.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/src/abap/2_statements/expressions/class_name.js +1 -1
- package/build/src/abap/2_statements/expressions/default.js +1 -1
- package/build/src/abap/2_statements/expressions/function_parameters.js +1 -1
- package/build/src/abap/2_statements/expressions/parameter_exception.js +1 -1
- package/build/src/abap/2_statements/expressions/report_name.js +1 -1
- package/build/src/abap/2_statements/expressions/select_loop.js +1 -1
- package/build/src/abap/2_statements/statements/move_corresponding.js +2 -2
- package/build/src/abap/2_statements/statements/report.js +1 -1
- package/build/src/abap/2_statements/statements/submit.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/index.js +2 -0
- package/build/src/rules/no_exclamation_escape.js +52 -0
- package/build/src/rules/parser_bad_exceptions.js +5 -6
- package/build/src/rules/slow_parameter_passing.js +21 -2
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@ exports.ClassName = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class ClassName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
7
|
+
return (0, combi_1.regex)(/^!?\w*(\/\w{3,}\/)?\w+$/);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.ClassName = ClassName;
|
|
@@ -6,7 +6,7 @@ const _1 = require(".");
|
|
|
6
6
|
class Default extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
// todo, DEFAULT is only valid for definitions in relation to method parameters
|
|
9
|
-
const def = (0, combi_1.seq)("DEFAULT", (0, combi_1.altPrio)(_1.Constant, _1.FieldChain));
|
|
9
|
+
const def = (0, combi_1.seq)("DEFAULT", (0, combi_1.altPrio)(_1.TextElement, _1.Constant, _1.FieldChain));
|
|
10
10
|
return def;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@ class FunctionParameters extends combi_1.Expression {
|
|
|
9
9
|
const importing = (0, combi_1.seq)("IMPORTING", _1.ParameterListT);
|
|
10
10
|
const changing = (0, combi_1.seq)("CHANGING", _1.ParameterListT);
|
|
11
11
|
const tables = (0, combi_1.seq)("TABLES", _1.ParameterListT);
|
|
12
|
-
const exceptions = (0, combi_1.seq)("EXCEPTIONS",
|
|
12
|
+
const exceptions = (0, combi_1.seq)("EXCEPTIONS", _1.ParameterListExceptions);
|
|
13
13
|
const long = (0, combi_1.seq)((0, combi_1.optPrio)(exporting), (0, combi_1.optPrio)(importing), (0, combi_1.optPrio)(tables), (0, combi_1.optPrio)(changing), (0, combi_1.optPrio)(exceptions));
|
|
14
14
|
return long;
|
|
15
15
|
}
|
|
@@ -6,7 +6,7 @@ const _1 = require(".");
|
|
|
6
6
|
class ParameterException extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const name = (0, combi_1.altPrio)("OTHERS", _1.ParameterName);
|
|
9
|
-
return (0, combi_1.seq)(name, "=", (0, combi_1.altPrio)(_1.Integer, _1.SimpleFieldChain), (0, combi_1.optPrio)((0, combi_1.seq)("MESSAGE", _1.Target)));
|
|
9
|
+
return (0, combi_1.seq)(name, (0, combi_1.optPrio)((0, combi_1.seq)("=", (0, combi_1.altPrio)(_1.Integer, _1.SimpleFieldChain), (0, combi_1.optPrio)((0, combi_1.seq)("MESSAGE", _1.Target)))));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.ParameterException = ParameterException;
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
6
6
|
class ReportName extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
return (0, combi_1.seq)((0, combi_1.regex)(/^[\w
|
|
8
|
+
return (0, combi_1.seq)((0, combi_1.regex)(/^[\w/$%&=]+$/), (0, combi_1.star)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.regex)(/^\w+$/))));
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.ReportName = ReportName;
|
|
@@ -20,7 +20,7 @@ class SelectLoop extends combi_1.Expression {
|
|
|
20
20
|
const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));
|
|
21
21
|
const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
|
|
22
22
|
const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
|
|
23
|
-
const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList, packTab));
|
|
23
|
+
const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, _1.DatabaseConnection, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList, packTab));
|
|
24
24
|
const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)((0, combi_1.seq)(where, (0, combi_1.optPrio)(sql_order_by_1.SQLOrderBy), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo))));
|
|
25
25
|
const aggr = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(where), _1.SQLGroupBy);
|
|
26
26
|
const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict, aggr), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
|
|
@@ -6,8 +6,8 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
const version_1 = require("../../../version");
|
|
7
7
|
class MoveCorresponding {
|
|
8
8
|
getMatcher() {
|
|
9
|
-
const keeping = (0, combi_1.ver)(version_1.Version.v740sp05, "KEEPING TARGET LINES");
|
|
10
|
-
const expanding = (0, combi_1.ver)(version_1.Version.v740sp05, "EXPANDING NESTED TABLES");
|
|
9
|
+
const keeping = (0, combi_1.ver)(version_1.Version.v740sp05, "KEEPING TARGET LINES", version_1.Version.OpenABAP);
|
|
10
|
+
const expanding = (0, combi_1.ver)(version_1.Version.v740sp05, "EXPANDING NESTED TABLES", version_1.Version.OpenABAP);
|
|
11
11
|
const move = (0, combi_1.seq)("MOVE-CORRESPONDING", (0, combi_1.optPrio)("EXACT"), expressions_1.Source, "TO",
|
|
12
12
|
// inline defintions not possible in this position,
|
|
13
13
|
expressions_1.SimpleTarget, (0, combi_1.optPrio)(expanding), (0, combi_1.optPrio)(keeping));
|
|
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
|
|
|
7
7
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
8
8
|
class Report {
|
|
9
9
|
getMatcher() {
|
|
10
|
-
const more = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeft), expressions_1.Integer, (0, combi_1.tok)(tokens_1.ParenRightW));
|
|
10
|
+
const more = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeft), expressions_1.Integer, (0, combi_1.alt)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.ParenRight)));
|
|
11
11
|
const heading = (0, combi_1.str)("NO STANDARD PAGE HEADING");
|
|
12
12
|
const size = (0, combi_1.seq)("LINE-SIZE", expressions_1.Integer);
|
|
13
13
|
const count = (0, combi_1.seq)("LINE-COUNT", expressions_1.Integer, (0, combi_1.opt)(more));
|
|
@@ -37,7 +37,7 @@ class Submit {
|
|
|
37
37
|
const imm = (0, combi_1.seq)("IMMEDIATELY", expressions_1.Source);
|
|
38
38
|
const dest = (0, combi_1.seq)("DESTINATION", expressions_1.Source);
|
|
39
39
|
const language = (0, combi_1.seq)("LANGUAGE", expressions_1.Source);
|
|
40
|
-
const perm = (0, combi_1.per)((0, combi_1.
|
|
40
|
+
const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
|
|
41
41
|
const ret = (0, combi_1.seq)("SUBMIT", prog, (0, combi_1.opt)(perm));
|
|
42
42
|
return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
|
|
43
43
|
}
|
package/build/src/registry.js
CHANGED
package/build/src/rules/index.js
CHANGED
|
@@ -196,4 +196,6 @@ __exportStar(require("./use_new"), exports);
|
|
|
196
196
|
__exportStar(require("./when_others_last"), exports);
|
|
197
197
|
__exportStar(require("./whitespace_end"), exports);
|
|
198
198
|
__exportStar(require("./xml_consistency"), exports);
|
|
199
|
+
__exportStar(require("./no_exclamation_escape"), exports);
|
|
200
|
+
__exportStar(require("./no_exclamation_escape"), exports);
|
|
199
201
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoExclamationEscape = exports.NoExclamationEscapeConf = void 0;
|
|
4
|
+
const issue_1 = require("../issue");
|
|
5
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
6
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
7
|
+
const _irule_1 = require("./_irule");
|
|
8
|
+
const edit_helper_1 = require("../edit_helper");
|
|
9
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
10
|
+
class NoExclamationEscapeConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
|
+
}
|
|
12
|
+
exports.NoExclamationEscapeConf = NoExclamationEscapeConf;
|
|
13
|
+
class NoExclamationEscape extends _abap_rule_1.ABAPRule {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.conf = new NoExclamationEscapeConf();
|
|
17
|
+
}
|
|
18
|
+
getMetadata() {
|
|
19
|
+
return {
|
|
20
|
+
key: "no_exclamation_escape",
|
|
21
|
+
title: "No exclamation escape",
|
|
22
|
+
shortDescription: `Detects and removes exclamation marks (!) used to escape identifiers`,
|
|
23
|
+
// eslint-disable-next-line max-len
|
|
24
|
+
extendedInformation: `Exclamation marks are not needed when the identifier is not a reserved keyword, or could be avoided by renaming.`,
|
|
25
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
26
|
+
badExample: "methods CONVERT changing !CO_sdf type ref to ZCL_sdf optional.",
|
|
27
|
+
goodExample: "methods CONVERT changing CO_sdf type ref to ZCL_sdf optional.",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
getConfig() {
|
|
31
|
+
return this.conf;
|
|
32
|
+
}
|
|
33
|
+
setConfig(conf) {
|
|
34
|
+
this.conf = conf;
|
|
35
|
+
}
|
|
36
|
+
runParsed(file) {
|
|
37
|
+
const issues = [];
|
|
38
|
+
for (const token of file.getTokens()) {
|
|
39
|
+
if (token instanceof tokens_1.Identifier) {
|
|
40
|
+
const str = token.getStr();
|
|
41
|
+
if (str.startsWith("!")) {
|
|
42
|
+
const replacement = str.substring(1);
|
|
43
|
+
const fix = edit_helper_1.EditHelper.replaceToken(file, token, replacement);
|
|
44
|
+
issues.push(issue_1.Issue.atToken(file, token, "Do not use exclamation mark to escape identifiers", this.getMetadata().key, this.conf.severity, fix));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.NoExclamationEscape = NoExclamationEscape;
|
|
52
|
+
//# sourceMappingURL=no_exclamation_escape.js.map
|
|
@@ -35,18 +35,17 @@ class ParserBadExceptions extends _abap_rule_1.ABAPRule {
|
|
|
35
35
|
this.conf = conf;
|
|
36
36
|
}
|
|
37
37
|
runParsed(file) {
|
|
38
|
-
var _a;
|
|
39
38
|
const issues = [];
|
|
40
39
|
for (const statement of file.getStatements()) {
|
|
41
40
|
if (!(statement.get() instanceof Statements.CallFunction)) {
|
|
42
41
|
continue;
|
|
43
42
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
for (const e of statement.findAllExpressions(Expressions.ParameterException)) {
|
|
44
|
+
if (e.findDirectTokenByText("=") === undefined) {
|
|
45
|
+
const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
|
|
46
|
+
issues.push(issue_1.Issue.atToken(file, e.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
|
-
const message = "Bad EXCEPTIONS syntax in CALL FUNCTION";
|
|
49
|
-
issues.push(issue_1.Issue.atToken(file, found.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
50
49
|
}
|
|
51
50
|
return issues;
|
|
52
51
|
}
|
|
@@ -8,6 +8,7 @@ const _abap_object_1 = require("../objects/_abap_object");
|
|
|
8
8
|
const syntax_1 = require("../abap/5_syntax/syntax");
|
|
9
9
|
const _scope_type_1 = require("../abap/5_syntax/_scope_type");
|
|
10
10
|
const _reference_1 = require("../abap/5_syntax/_reference");
|
|
11
|
+
const edit_helper_1 = require("../edit_helper");
|
|
11
12
|
class SlowParameterPassingConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
13
|
}
|
|
13
14
|
exports.SlowParameterPassingConf = SlowParameterPassingConf;
|
|
@@ -21,7 +22,7 @@ class SlowParameterPassing {
|
|
|
21
22
|
title: "Slow Parameter Passing",
|
|
22
23
|
shortDescription: `Detects slow pass by value passing for methods where parameter is not changed`,
|
|
23
24
|
extendedInformation: `Method parameters defined in interfaces is not checked`,
|
|
24
|
-
tags: [_irule_1.RuleTag.Performance],
|
|
25
|
+
tags: [_irule_1.RuleTag.Performance, _irule_1.RuleTag.Quickfix],
|
|
25
26
|
badExample: `CLASS lcl DEFINITION.
|
|
26
27
|
PUBLIC SECTION.
|
|
27
28
|
METHODS bar IMPORTING VALUE(sdf) TYPE string.
|
|
@@ -77,7 +78,25 @@ ENDCLASS.`,
|
|
|
77
78
|
const writes = this.listWritePositions(m, id);
|
|
78
79
|
if (writes.length === 0) {
|
|
79
80
|
const message = "Parameter " + id.getName() + " passed by VALUE but not changed";
|
|
80
|
-
|
|
81
|
+
let fix = undefined;
|
|
82
|
+
const file = obj.getABAPFiles().find(f => f.getFilename() === id.getFilename());
|
|
83
|
+
if (file) {
|
|
84
|
+
const tokens = file.getTokens();
|
|
85
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
86
|
+
if (tokens[i].getStart().equals(id.getToken().getStart())) {
|
|
87
|
+
const prev1 = tokens[i - 1];
|
|
88
|
+
const prev2 = tokens[i - 2];
|
|
89
|
+
const next1 = tokens[i + 1];
|
|
90
|
+
if ((prev1 === null || prev1 === void 0 ? void 0 : prev1.getStr()) === "("
|
|
91
|
+
&& (prev2 === null || prev2 === void 0 ? void 0 : prev2.getStr().toUpperCase()) === "VALUE"
|
|
92
|
+
&& (next1 === null || next1 === void 0 ? void 0 : next1.getStr()) === ")") {
|
|
93
|
+
fix = edit_helper_1.EditHelper.replaceRange(file, prev2.getStart(), next1.getEnd(), id.getToken().getStr());
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity, fix));
|
|
81
100
|
}
|
|
82
101
|
}
|
|
83
102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.119.0",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.
|
|
53
|
+
"@microsoft/api-extractor": "^7.58.5",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^24.12.
|
|
56
|
+
"@types/node": "^24.12.2",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
59
|
"mocha": "^11.7.5",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.
|
|
66
|
+
"fast-xml-parser": "^5.7.1",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|