@abaplint/core 2.113.111 → 2.113.112
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 +17 -6
- package/build/src/index.js +17 -7
- package/build/src/registry.js +1 -1
- package/build/src/rules/align_parameters.js +4 -4
- package/build/src/rules/constant_classes.js +4 -3
- package/build/src/rules/function_module_recommendations.js +2 -2
- package/build/src/rules/method_overwrites_builtin.js +2 -2
- package/build/src/rules/prefer_raise_exception_new.js +4 -3
- package/build/src/rules/select_single_full_key.js +17 -13
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as LServer from 'vscode-languageserver-types';
|
|
2
2
|
import { WorkspaceEdit } from 'vscode-languageserver-types';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
declare class ABAPFile extends AbstractFile {
|
|
5
5
|
private readonly tokens;
|
|
6
6
|
private readonly statements;
|
|
7
7
|
private readonly structure;
|
|
@@ -55,7 +55,7 @@ declare class Abstract extends Expression {
|
|
|
55
55
|
getRunnable(): IStatementRunnable;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
declare abstract class AbstractFile implements IFile {
|
|
59
59
|
private readonly filename;
|
|
60
60
|
constructor(filename: string);
|
|
61
61
|
getFilename(): string;
|
|
@@ -229,9 +229,9 @@ declare class ApplicationLogObject extends AbstractObject {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/** returns list of filenames which were changed */
|
|
232
|
-
|
|
232
|
+
declare function applyEditList(reg: IRegistry, edits: IEdit[]): string[];
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
declare function applyEditSingle(reg: IRegistry, edit: IEdit): void;
|
|
235
235
|
|
|
236
236
|
declare class ArithOperator extends Expression {
|
|
237
237
|
getRunnable(): IStatementRunnable;
|
|
@@ -1938,6 +1938,11 @@ declare class EditorCall implements IStatement {
|
|
|
1938
1938
|
getMatcher(): IStatementRunnable;
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
1941
|
+
export declare const Edits: {
|
|
1942
|
+
applyEditSingle: typeof applyEditSingle;
|
|
1943
|
+
applyEditList: typeof applyEditList;
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1941
1946
|
declare class Else implements IStructure {
|
|
1942
1947
|
getMatcher(): IStructureRunnable;
|
|
1943
1948
|
}
|
|
@@ -2572,6 +2577,12 @@ declare class FieldSymbol_2 extends Expression {
|
|
|
2572
2577
|
getRunnable(): IStatementRunnable;
|
|
2573
2578
|
}
|
|
2574
2579
|
|
|
2580
|
+
export declare const Files: {
|
|
2581
|
+
MemoryFile: typeof MemoryFile;
|
|
2582
|
+
ABAPFile: typeof ABAPFile;
|
|
2583
|
+
AbstractFile: typeof AbstractFile;
|
|
2584
|
+
};
|
|
2585
|
+
|
|
2575
2586
|
declare class FilterBody extends Expression {
|
|
2576
2587
|
getRunnable(): IStatementRunnable;
|
|
2577
2588
|
}
|
|
@@ -4249,7 +4260,7 @@ declare class MaintenanceAndTransportObject extends AbstractObject {
|
|
|
4249
4260
|
};
|
|
4250
4261
|
}
|
|
4251
4262
|
|
|
4252
|
-
|
|
4263
|
+
declare class MemoryFile extends AbstractFile {
|
|
4253
4264
|
private readonly raw;
|
|
4254
4265
|
constructor(filename: string, raw: string);
|
|
4255
4266
|
getRaw(): string;
|
|
@@ -5417,7 +5428,7 @@ declare class ReduceNext extends Expression {
|
|
|
5417
5428
|
getRunnable(): IStatementRunnable;
|
|
5418
5429
|
}
|
|
5419
5430
|
|
|
5420
|
-
declare enum ReferenceType {
|
|
5431
|
+
export declare enum ReferenceType {
|
|
5421
5432
|
/** for classes and interface references */
|
|
5422
5433
|
ObjectOrientedReference = "Object",
|
|
5423
5434
|
ObjectOrientedVoidReference = "Object (Void)",
|
package/build/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility =
|
|
3
|
+
exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.Files = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.Version = exports.Config = exports.Issue = void 0;
|
|
4
|
+
exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = void 0;
|
|
5
5
|
const issue_1 = require("./issue");
|
|
6
6
|
Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
|
|
7
7
|
const config_1 = require("./config");
|
|
@@ -62,7 +62,6 @@ Object.defineProperty(exports, "Position", { enumerable: true, get: function ()
|
|
|
62
62
|
const virtual_position_1 = require("./virtual_position");
|
|
63
63
|
Object.defineProperty(exports, "VirtualPosition", { enumerable: true, get: function () { return virtual_position_1.VirtualPosition; } });
|
|
64
64
|
const _abstract_file_1 = require("./files/_abstract_file");
|
|
65
|
-
Object.defineProperty(exports, "AbstractFile", { enumerable: true, get: function () { return _abstract_file_1.AbstractFile; } });
|
|
66
65
|
const pretty_printer_1 = require("./pretty_printer/pretty_printer");
|
|
67
66
|
Object.defineProperty(exports, "PrettyPrinter", { enumerable: true, get: function () { return pretty_printer_1.PrettyPrinter; } });
|
|
68
67
|
const _statement_1 = require("./abap/2_statements/statements/_statement");
|
|
@@ -73,14 +72,10 @@ Object.defineProperty(exports, "MacroCall", { enumerable: true, get: function ()
|
|
|
73
72
|
Object.defineProperty(exports, "MacroContent", { enumerable: true, get: function () { return _statement_1.MacroContent; } });
|
|
74
73
|
Object.defineProperty(exports, "NativeSQL", { enumerable: true, get: function () { return _statement_1.NativeSQL; } });
|
|
75
74
|
const edit_helper_1 = require("./edit_helper");
|
|
76
|
-
Object.defineProperty(exports, "applyEditSingle", { enumerable: true, get: function () { return edit_helper_1.applyEditSingle; } });
|
|
77
|
-
Object.defineProperty(exports, "applyEditList", { enumerable: true, get: function () { return edit_helper_1.applyEditList; } });
|
|
78
75
|
const _builtin_1 = require("./abap/5_syntax/_builtin");
|
|
79
76
|
Object.defineProperty(exports, "BuiltIn", { enumerable: true, get: function () { return _builtin_1.BuiltIn; } });
|
|
80
77
|
const abap_file_1 = require("./abap/abap_file");
|
|
81
|
-
Object.defineProperty(exports, "ABAPFile", { enumerable: true, get: function () { return abap_file_1.ABAPFile; } });
|
|
82
78
|
const memory_file_1 = require("./files/memory_file");
|
|
83
|
-
Object.defineProperty(exports, "MemoryFile", { enumerable: true, get: function () { return memory_file_1.MemoryFile; } });
|
|
84
79
|
const renamer_1 = require("./objects/rename/renamer");
|
|
85
80
|
Object.defineProperty(exports, "Rename", { enumerable: true, get: function () { return renamer_1.Renamer; } });
|
|
86
81
|
const Info = require("./abap/4_file_information/_abap_file_information");
|
|
@@ -107,4 +102,19 @@ const diagnostics_1 = require("./lsp/diagnostics");
|
|
|
107
102
|
Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
|
|
108
103
|
const _edit_1 = require("./lsp/_edit");
|
|
109
104
|
Object.defineProperty(exports, "LSPEdit", { enumerable: true, get: function () { return _edit_1.LSPEdit; } });
|
|
105
|
+
const _reference_1 = require("./abap/5_syntax/_reference");
|
|
106
|
+
Object.defineProperty(exports, "ReferenceType", { enumerable: true, get: function () { return _reference_1.ReferenceType; } });
|
|
107
|
+
// do not include this file from anywhere within abaplint
|
|
108
|
+
// https://github.com/abaplint/abaplint/issues/873
|
|
109
|
+
const Edits = {
|
|
110
|
+
applyEditSingle: edit_helper_1.applyEditSingle,
|
|
111
|
+
applyEditList: edit_helper_1.applyEditList,
|
|
112
|
+
};
|
|
113
|
+
exports.Edits = Edits;
|
|
114
|
+
const Files = {
|
|
115
|
+
MemoryFile: memory_file_1.MemoryFile,
|
|
116
|
+
ABAPFile: abap_file_1.ABAPFile,
|
|
117
|
+
AbstractFile: _abstract_file_1.AbstractFile,
|
|
118
|
+
};
|
|
119
|
+
exports.Files = Files;
|
|
110
120
|
//# sourceMappingURL=index.js.map
|
package/build/src/registry.js
CHANGED
|
@@ -7,7 +7,7 @@ const _abap_rule_1 = require("./_abap_rule");
|
|
|
7
7
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
9
9
|
const position_1 = require("../position");
|
|
10
|
-
const
|
|
10
|
+
const Statements = require("../abap/2_statements/statements");
|
|
11
11
|
const edit_helper_1 = require("../edit_helper");
|
|
12
12
|
class AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
13
13
|
}
|
|
@@ -215,9 +215,9 @@ DATA(sdf) = VALUE type(
|
|
|
215
215
|
}
|
|
216
216
|
raiseAndCreateCandidates(stru) {
|
|
217
217
|
const candidates = [];
|
|
218
|
-
const statements = stru.findAllStatements(
|
|
219
|
-
statements.push(...stru.findAllStatements(
|
|
220
|
-
statements.push(...stru.findAllStatements(
|
|
218
|
+
const statements = stru.findAllStatements(Statements.Raise);
|
|
219
|
+
statements.push(...stru.findAllStatements(Statements.CreateObject));
|
|
220
|
+
statements.push(...stru.findAllStatements(Statements.RaiseEvent));
|
|
221
221
|
for (const raise of statements) {
|
|
222
222
|
const parameters = [];
|
|
223
223
|
const param = raise.findDirectExpression(Expressions.ParameterListS);
|
|
@@ -4,7 +4,8 @@ exports.ConstantClasses = exports.ConstantClassesConf = void 0;
|
|
|
4
4
|
const issue_1 = require("../issue");
|
|
5
5
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
6
6
|
const _irule_1 = require("./_irule");
|
|
7
|
-
const
|
|
7
|
+
const Objects = require("../objects");
|
|
8
|
+
const visibility_1 = require("../abap/4_file_information/visibility");
|
|
8
9
|
/** Checks that constants classes are in sync with domain fixed values */
|
|
9
10
|
class ConstantClassesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
11
|
constructor() {
|
|
@@ -40,7 +41,7 @@ class ConstantClasses {
|
|
|
40
41
|
run(obj) {
|
|
41
42
|
if (this.conf
|
|
42
43
|
&& this.conf.mapping
|
|
43
|
-
&& obj instanceof
|
|
44
|
+
&& obj instanceof Objects.Domain) {
|
|
44
45
|
const configEntry = this.conf.mapping.find(x => x.domain.toUpperCase() === obj.getName().toUpperCase());
|
|
45
46
|
if (!configEntry) {
|
|
46
47
|
return [];
|
|
@@ -84,7 +85,7 @@ class ConstantClasses {
|
|
|
84
85
|
issues.push(this.issueAtConstant(constant, `Use exact type ${configEntry.domain} instead of ${constant.typeName}`));
|
|
85
86
|
// quickfix will change the type
|
|
86
87
|
}
|
|
87
|
-
if (constant.visibility !==
|
|
88
|
+
if (constant.visibility !== visibility_1.Visibility.Public) {
|
|
88
89
|
issues.push(this.issueAtConstant(constant, `Constant ${constant.name} should be public`));
|
|
89
90
|
// quickfix will move constant
|
|
90
91
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionModuleRecommendations = exports.FunctionModuleRecommendationsConf = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
4
|
const expressions_1 = require("../abap/2_statements/expressions");
|
|
5
|
+
const issue_1 = require("../issue");
|
|
6
6
|
const _abap_rule_1 = require("./_abap_rule");
|
|
7
7
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
@@ -85,7 +85,7 @@ class FunctionModuleRecommendations extends _abap_rule_1.ABAPRule {
|
|
|
85
85
|
funcName = funcName.slice(1, funcName.length - 1);
|
|
86
86
|
const index = this.conf.recommendations.findIndex(i => i.name.toUpperCase() === funcName && (i.from === undefined || configVersion >= i.from));
|
|
87
87
|
if (index >= 0) {
|
|
88
|
-
issues.push(
|
|
88
|
+
issues.push(issue_1.Issue.atToken(file, token, this.getMessage(index), this.getMetadata().key, this.conf.severity));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return issues;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MethodOverwritesBuiltIn = exports.MethodOverwritesBuiltInConf = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
4
|
const _builtin_1 = require("../abap/5_syntax/_builtin");
|
|
5
|
+
const issue_1 = require("../issue");
|
|
6
6
|
const _abap_rule_1 = require("./_abap_rule");
|
|
7
7
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
@@ -52,7 +52,7 @@ ENDCLASS.`,
|
|
|
52
52
|
for (const method of methods) {
|
|
53
53
|
if (builtIn.searchBuiltin(method.name.toUpperCase())) {
|
|
54
54
|
const message = `Method name "${method.name}" overwrites built-in SAP function name`;
|
|
55
|
-
issues.push(
|
|
55
|
+
issues.push(issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return issues;
|
|
@@ -6,7 +6,8 @@ const _abap_rule_1 = require("./_abap_rule");
|
|
|
6
6
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
7
7
|
const edit_helper_1 = require("../edit_helper");
|
|
8
8
|
const _irule_1 = require("./_irule");
|
|
9
|
-
const
|
|
9
|
+
const version_1 = require("../version");
|
|
10
|
+
const Statements = require("../abap/2_statements/statements");
|
|
10
11
|
class PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
12
|
}
|
|
12
13
|
exports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;
|
|
@@ -38,12 +39,12 @@ From 752 and up`,
|
|
|
38
39
|
this.conf = conf;
|
|
39
40
|
}
|
|
40
41
|
runParsed(file) {
|
|
41
|
-
if (this.reg.getConfig().getVersion() <
|
|
42
|
+
if (this.reg.getConfig().getVersion() < version_1.Version.v752) {
|
|
42
43
|
return [];
|
|
43
44
|
}
|
|
44
45
|
const issues = [];
|
|
45
46
|
for (const statement of file.getStatements()) {
|
|
46
|
-
if (statement.get() instanceof
|
|
47
|
+
if (statement.get() instanceof Statements.Raise) {
|
|
47
48
|
const concat = statement.concatTokens().toUpperCase();
|
|
48
49
|
if (concat.includes(" MESSAGE")) {
|
|
49
50
|
continue;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _abap_object_1 = require("../objects/_abap_object");
|
|
5
5
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
6
|
-
const _irule_1 = require("./_irule");
|
|
7
|
-
const __1 = require("..");
|
|
8
6
|
const edit_helper_1 = require("../edit_helper");
|
|
7
|
+
const _irule_1 = require("./_irule");
|
|
8
|
+
const issue_1 = require("../issue");
|
|
9
|
+
const syntax_1 = require("../abap/5_syntax/syntax");
|
|
10
|
+
const Expressions = require("../abap/2_statements/expressions");
|
|
11
|
+
const Statements = require("../abap/2_statements/statements");
|
|
12
|
+
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
9
13
|
class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
14
|
constructor() {
|
|
11
15
|
super(...arguments);
|
|
@@ -55,10 +59,10 @@ If the statement contains a JOIN it is not checked`,
|
|
|
55
59
|
}
|
|
56
60
|
run(obj) {
|
|
57
61
|
var _a, _b;
|
|
58
|
-
if (!(obj instanceof
|
|
62
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
59
63
|
return [];
|
|
60
64
|
}
|
|
61
|
-
const syntax = new
|
|
65
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
62
66
|
if (syntax.issues.length > 0) {
|
|
63
67
|
return [];
|
|
64
68
|
}
|
|
@@ -68,21 +72,21 @@ If the statement contains a JOIN it is not checked`,
|
|
|
68
72
|
const statements = file.getStatements();
|
|
69
73
|
for (let i = 0; i < statements.length; i++) {
|
|
70
74
|
const s = statements[i];
|
|
71
|
-
if (!(s.get() instanceof
|
|
75
|
+
if (!(s.get() instanceof Statements.Select)) {
|
|
72
76
|
continue;
|
|
73
77
|
}
|
|
74
|
-
else if (s.findFirstExpression(
|
|
78
|
+
else if (s.findFirstExpression(Expressions.SQLJoin)) {
|
|
75
79
|
continue;
|
|
76
80
|
}
|
|
77
81
|
else if (s.findTokenSequencePosition("SELECT", "SINGLE") === undefined) {
|
|
78
82
|
continue;
|
|
79
83
|
}
|
|
80
|
-
const databaseTable = s.findFirstExpression(
|
|
84
|
+
const databaseTable = s.findFirstExpression(Expressions.DatabaseTable);
|
|
81
85
|
if (databaseTable === undefined) {
|
|
82
86
|
continue;
|
|
83
87
|
}
|
|
84
88
|
const next = statements[i + 1];
|
|
85
|
-
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof
|
|
89
|
+
if ((next === null || next === void 0 ? void 0 : next.get()) instanceof _statement_1.Comment
|
|
86
90
|
&& next.concatTokens().includes(this.getMetadata().pseudoComment + "")) {
|
|
87
91
|
if (this.getConfig().allowPseudo !== true) {
|
|
88
92
|
issues.push(issue_1.Issue.atStatement(file, s, "Pseudo comment not allowed", this.getMetadata().key, this.getConfig().severity));
|
|
@@ -95,7 +99,7 @@ If the statement contains a JOIN it is not checked`,
|
|
|
95
99
|
continue;
|
|
96
100
|
}
|
|
97
101
|
const keys = table.listKeys(this.reg);
|
|
98
|
-
const cond = s.findFirstExpression(
|
|
102
|
+
const cond = s.findFirstExpression(Expressions.SQLCond);
|
|
99
103
|
const set = new Set();
|
|
100
104
|
for (const key of keys) {
|
|
101
105
|
if (key === "MANDT") {
|
|
@@ -104,10 +108,10 @@ If the statement contains a JOIN it is not checked`,
|
|
|
104
108
|
}
|
|
105
109
|
set.add(key);
|
|
106
110
|
}
|
|
107
|
-
for (const compare of (cond === null || cond === void 0 ? void 0 : cond.findAllExpressionsRecursive(
|
|
111
|
+
for (const compare of (cond === null || cond === void 0 ? void 0 : cond.findAllExpressionsRecursive(Expressions.SQLCompare)) || []) {
|
|
108
112
|
if (compare.getChildren().length === 3) {
|
|
109
|
-
const fname = (_a = compare.findDirectExpression(
|
|
110
|
-
const operator = (_b = compare.findDirectExpression(
|
|
113
|
+
const fname = (_a = compare.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
114
|
+
const operator = (_b = compare.findDirectExpression(Expressions.SQLCompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
111
115
|
if (fname && (operator === "=" || operator === "EQ")) {
|
|
112
116
|
set.delete(fname);
|
|
113
117
|
}
|