@abaplint/core 2.113.110 → 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 +18 -60
- package/build/src/abap/2_statements/expressions/component_name.js +1 -1
- package/build/src/abap/2_statements/expressions/namespace_simple_name.js +1 -1
- package/build/src/abap/5_syntax/expressions/method_parameters.js +1 -1
- package/build/src/abap/5_syntax/statements/selectoption.js +2 -0
- package/build/src/index.js +17 -14
- package/build/src/objects/rename/renamer_helper.js +3 -3
- 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/exit_or_check.js +1 -1
- 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 +6 -6
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
|
}
|
|
@@ -2612,48 +2623,6 @@ declare class FloatType extends AbstractType {
|
|
|
2612
2623
|
toCDS(): string;
|
|
2613
2624
|
}
|
|
2614
2625
|
|
|
2615
|
-
export declare enum FLOW_EDGE_TYPE {
|
|
2616
|
-
true = "true",
|
|
2617
|
-
false = "false",
|
|
2618
|
-
undefined = "undefined"
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
export declare class FlowGraph {
|
|
2622
|
-
private edges;
|
|
2623
|
-
private readonly startNode;
|
|
2624
|
-
private readonly endNode;
|
|
2625
|
-
private label;
|
|
2626
|
-
constructor(counter: number);
|
|
2627
|
-
getStart(): string;
|
|
2628
|
-
getLabel(): string;
|
|
2629
|
-
getEnd(): string;
|
|
2630
|
-
addEdge(from: string, to: string, type: FLOW_EDGE_TYPE): void;
|
|
2631
|
-
removeEdge(from: string, to: string): void;
|
|
2632
|
-
listEdges(): {
|
|
2633
|
-
from: string;
|
|
2634
|
-
to: string;
|
|
2635
|
-
type: FLOW_EDGE_TYPE;
|
|
2636
|
-
}[];
|
|
2637
|
-
listNodes(): string[];
|
|
2638
|
-
private hasEdges;
|
|
2639
|
-
/** return value: end node of to graph */
|
|
2640
|
-
addGraph(from: string, to: FlowGraph, type: FLOW_EDGE_TYPE): string;
|
|
2641
|
-
toJSON(): string;
|
|
2642
|
-
toTextEdges(): string;
|
|
2643
|
-
setLabel(label: string): void;
|
|
2644
|
-
toDigraph(): string;
|
|
2645
|
-
listSources(node: string): {
|
|
2646
|
-
name: string;
|
|
2647
|
-
type: FLOW_EDGE_TYPE;
|
|
2648
|
-
}[];
|
|
2649
|
-
listTargets(node: string): {
|
|
2650
|
-
name: string;
|
|
2651
|
-
type: FLOW_EDGE_TYPE;
|
|
2652
|
-
}[];
|
|
2653
|
-
/** removes all nodes containing "#" that have one in-going and one out-going edge */
|
|
2654
|
-
reduce(): this;
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
2626
|
declare class For extends Expression {
|
|
2658
2627
|
getRunnable(): IStatementRunnable;
|
|
2659
2628
|
}
|
|
@@ -3821,14 +3790,14 @@ declare interface IRange {
|
|
|
3821
3790
|
end: Position;
|
|
3822
3791
|
}
|
|
3823
3792
|
|
|
3824
|
-
|
|
3793
|
+
declare interface IReference {
|
|
3825
3794
|
position: Identifier;
|
|
3826
3795
|
resolved: Identifier | undefined;
|
|
3827
3796
|
referenceType: ReferenceType;
|
|
3828
3797
|
extra?: IReferenceExtras;
|
|
3829
3798
|
}
|
|
3830
3799
|
|
|
3831
|
-
|
|
3800
|
+
declare interface IReferenceExtras {
|
|
3832
3801
|
ooName?: string;
|
|
3833
3802
|
ooType?: "CLAS" | "INTF" | "Void";
|
|
3834
3803
|
}
|
|
@@ -4291,7 +4260,7 @@ declare class MaintenanceAndTransportObject extends AbstractObject {
|
|
|
4291
4260
|
};
|
|
4292
4261
|
}
|
|
4293
4262
|
|
|
4294
|
-
|
|
4263
|
+
declare class MemoryFile extends AbstractFile {
|
|
4295
4264
|
private readonly raw;
|
|
4296
4265
|
constructor(filename: string, raw: string);
|
|
4297
4266
|
getRaw(): string;
|
|
@@ -6196,17 +6165,6 @@ declare class StartOfSelection implements IStatement {
|
|
|
6196
6165
|
getMatcher(): IStatementRunnable;
|
|
6197
6166
|
}
|
|
6198
6167
|
|
|
6199
|
-
export declare class StatementFlow {
|
|
6200
|
-
private counter;
|
|
6201
|
-
build(stru: StructureNode, obj: IObject): FlowGraph[];
|
|
6202
|
-
private runEvent;
|
|
6203
|
-
private run;
|
|
6204
|
-
private findBody;
|
|
6205
|
-
static buildName(statement: StatementNode): string;
|
|
6206
|
-
private traverseBody;
|
|
6207
|
-
private traverseStructure;
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
6168
|
declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
|
|
6211
6169
|
private readonly statement;
|
|
6212
6170
|
private readonly colon;
|
|
@@ -4,7 +4,7 @@ exports.ComponentName = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class ComponentName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(
|
|
7
|
+
return (0, combi_1.regex)(/^\w*(\/\w+\/)*[\w\d_%$\*\~]+$/);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.ComponentName = ComponentName;
|
|
@@ -4,7 +4,7 @@ exports.NamespaceSimpleName = void 0;
|
|
|
4
4
|
const combi_1 = require("../combi");
|
|
5
5
|
class NamespaceSimpleName extends combi_1.Expression {
|
|
6
6
|
getRunnable() {
|
|
7
|
-
return (0, combi_1.regex)(/^!?((\w*\/\w+\/)|(\w*\/\w+\/)
|
|
7
|
+
return (0, combi_1.regex)(/^!?((\w*\/\w+\/)|(\w*\/\w+\/)*[\w\*$%#]+)$/);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.NamespaceSimpleName = NamespaceSimpleName;
|
|
@@ -164,7 +164,7 @@ class MethodParameters {
|
|
|
164
164
|
if (parameter === undefined) {
|
|
165
165
|
const message = "Method importing parameter \"" + item.name + "\" does not exist";
|
|
166
166
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
167
|
-
|
|
167
|
+
continue;
|
|
168
168
|
}
|
|
169
169
|
else if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(item.sourceType, parameter.getType(), calculated) === false) {
|
|
170
170
|
const message = "Method parameter type not compatible, " + item.name;
|
|
@@ -22,6 +22,8 @@ class SelectOption {
|
|
|
22
22
|
}
|
|
23
23
|
for (const d of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
24
24
|
new dynamic_1.Dynamic().runSyntax(d, input);
|
|
25
|
+
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, new basic_1.VoidType("DYNAMIC_SELECT_OPTION")));
|
|
26
|
+
return;
|
|
25
27
|
}
|
|
26
28
|
const nameExpression = node.findFirstExpression(Expressions.FieldChain);
|
|
27
29
|
let found = new basic_types_1.BasicTypes(input).resolveLikeName(nameExpression);
|
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,16 +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
|
-
const _reference_1 = require("./abap/5_syntax/_reference");
|
|
79
|
-
Object.defineProperty(exports, "ReferenceType", { enumerable: true, get: function () { return _reference_1.ReferenceType; } });
|
|
80
75
|
const _builtin_1 = require("./abap/5_syntax/_builtin");
|
|
81
76
|
Object.defineProperty(exports, "BuiltIn", { enumerable: true, get: function () { return _builtin_1.BuiltIn; } });
|
|
82
77
|
const abap_file_1 = require("./abap/abap_file");
|
|
83
|
-
Object.defineProperty(exports, "ABAPFile", { enumerable: true, get: function () { return abap_file_1.ABAPFile; } });
|
|
84
78
|
const memory_file_1 = require("./files/memory_file");
|
|
85
|
-
Object.defineProperty(exports, "MemoryFile", { enumerable: true, get: function () { return memory_file_1.MemoryFile; } });
|
|
86
79
|
const renamer_1 = require("./objects/rename/renamer");
|
|
87
80
|
Object.defineProperty(exports, "Rename", { enumerable: true, get: function () { return renamer_1.Renamer; } });
|
|
88
81
|
const Info = require("./abap/4_file_information/_abap_file_information");
|
|
@@ -109,9 +102,19 @@ const diagnostics_1 = require("./lsp/diagnostics");
|
|
|
109
102
|
Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
|
|
110
103
|
const _edit_1 = require("./lsp/_edit");
|
|
111
104
|
Object.defineProperty(exports, "LSPEdit", { enumerable: true, get: function () { return _edit_1.LSPEdit; } });
|
|
112
|
-
const
|
|
113
|
-
Object.defineProperty(exports, "
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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;
|
|
117
120
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RenamerHelper = void 0;
|
|
4
4
|
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
5
|
-
const __1 = require("../..");
|
|
6
5
|
const syntax_1 = require("../../abap/5_syntax/syntax");
|
|
7
6
|
const _scope_type_1 = require("../../abap/5_syntax/_scope_type");
|
|
8
7
|
const virtual_position_1 = require("../../virtual_position");
|
|
9
8
|
const _abap_object_1 = require("../_abap_object");
|
|
9
|
+
const _reference_1 = require("../../abap/5_syntax/_reference");
|
|
10
10
|
class RenamerHelper {
|
|
11
11
|
constructor(reg) {
|
|
12
12
|
this.reg = reg;
|
|
@@ -147,11 +147,11 @@ class RenamerHelper {
|
|
|
147
147
|
let ret = [];
|
|
148
148
|
if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {
|
|
149
149
|
for (const r of node.getData().references) {
|
|
150
|
-
if (r.referenceType ===
|
|
150
|
+
if (r.referenceType === _reference_1.ReferenceType.ConstructorReference) {
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
153
|
if (((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.equals(identifier))
|
|
154
|
-
&& r.referenceType !==
|
|
154
|
+
&& r.referenceType !== _reference_1.ReferenceType.InferredType
|
|
155
155
|
&& !(r.position.getStart() instanceof virtual_position_1.VirtualPosition)) {
|
|
156
156
|
ret.push(r.position);
|
|
157
157
|
}
|
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
|
}
|
|
@@ -59,7 +59,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-re
|
|
|
59
59
|
else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {
|
|
60
60
|
const message = "CHECK is not allowed outside of loops";
|
|
61
61
|
let tokensString = statement.concatTokens();
|
|
62
|
-
tokensString = tokensString.
|
|
62
|
+
tokensString = tokensString.split("CHECK")[1].trim();
|
|
63
63
|
const replacement = "IF NOT " + tokensString + "\n RETURN.\nENDIF.";
|
|
64
64
|
const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);
|
|
65
65
|
const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.113.
|
|
3
|
+
"version": "2.113.112",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,20 +50,20 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.52.
|
|
53
|
+
"@microsoft/api-extractor": "^7.52.7",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^22.
|
|
56
|
+
"@types/node": "^22.15.17",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
|
-
"eslint": "^9.
|
|
59
|
-
"mocha": "^11.
|
|
58
|
+
"eslint": "^9.26.0",
|
|
59
|
+
"mocha": "^11.2.2",
|
|
60
60
|
"c8": "^10.1.3",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
62
|
"ts-json-schema-generator": "^2.4.0",
|
|
63
63
|
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.2.
|
|
66
|
+
"fast-xml-parser": "^5.2.3",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|