@abaplint/core 2.83.25 → 2.84.3
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 +10 -3
- package/build/src/abap/2_statements/expressions/index.js +2 -1
- package/build/src/abap/2_statements/expressions/message_number.js +11 -0
- package/build/src/abap/2_statements/expressions/message_source.js +1 -1
- package/build/src/abap/2_statements/statements/raise.js +1 -1
- package/build/src/abap/5_syntax/_current_scope.js +9 -4
- package/build/src/abap/5_syntax/_scope_type.js +1 -0
- package/build/src/abap/5_syntax/basic_types.js +5 -5
- package/build/src/abap/5_syntax/syntax.js +6 -0
- package/build/src/abap/types/basic/data_reference_type.js +2 -2
- package/build/src/ddic.js +22 -22
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +13 -2
- package/build/src/rules/index.js +1 -0
- package/build/src/rules/method_length.js +9 -8
- package/build/src/rules/omit_preceding_zeros.js +49 -0
- package/package.json +2 -2
package/build/abaplint.d.ts
CHANGED
|
@@ -1155,6 +1155,7 @@ export declare class CurrentScope {
|
|
|
1155
1155
|
getType(): ScopeType;
|
|
1156
1156
|
push(stype: ScopeType, sname: string, start: Position, filename: string): void;
|
|
1157
1157
|
isOO(): boolean;
|
|
1158
|
+
isTypePool(): boolean;
|
|
1158
1159
|
setAllowHeaderUse(name: string): void;
|
|
1159
1160
|
isAllowHeaderUse(name: string): boolean;
|
|
1160
1161
|
pop(end: Position): SpaghettiScope;
|
|
@@ -1286,7 +1287,7 @@ declare class DataEnd implements IStatement {
|
|
|
1286
1287
|
|
|
1287
1288
|
declare class DataReference extends AbstractType {
|
|
1288
1289
|
private readonly type;
|
|
1289
|
-
constructor(type: AbstractType,
|
|
1290
|
+
constructor(type: AbstractType, qualifiedName?: string);
|
|
1290
1291
|
toText(level: number): string;
|
|
1291
1292
|
getType(): AbstractType;
|
|
1292
1293
|
toABAP(): string;
|
|
@@ -1307,7 +1308,7 @@ declare class DDIC {
|
|
|
1307
1308
|
private readonly reg;
|
|
1308
1309
|
constructor(reg: IRegistry);
|
|
1309
1310
|
isException(def: InfoClassDefinition | undefined, _obj: ABAPObject): boolean;
|
|
1310
|
-
lookupBuiltinType(name: string, length?: number, decimals?: number): AbstractType | undefined;
|
|
1311
|
+
lookupBuiltinType(name: string, length?: number, decimals?: number, qualifiedName?: string): AbstractType | undefined;
|
|
1311
1312
|
inErrorNamespace(name: string | undefined): boolean;
|
|
1312
1313
|
lookupObject(name: string): ILookupResult;
|
|
1313
1314
|
lookupNoVoid(name: string): ILookupResult | undefined;
|
|
@@ -1846,6 +1847,7 @@ declare namespace Expressions {
|
|
|
1846
1847
|
LoopGroupBy,
|
|
1847
1848
|
MacroName,
|
|
1848
1849
|
MessageClass_2 as MessageClass,
|
|
1850
|
+
MessageNumber,
|
|
1849
1851
|
MessageSource,
|
|
1850
1852
|
MessageTypeAndNumber,
|
|
1851
1853
|
MethodCallBody,
|
|
@@ -1853,11 +1855,11 @@ declare namespace Expressions {
|
|
|
1853
1855
|
MethodCallParam,
|
|
1854
1856
|
MethodCall,
|
|
1855
1857
|
MethodDefChanging,
|
|
1858
|
+
MethodDefExceptions,
|
|
1856
1859
|
MethodDefExporting,
|
|
1857
1860
|
MethodDefImporting,
|
|
1858
1861
|
MethodDefRaising,
|
|
1859
1862
|
MethodDefReturning,
|
|
1860
|
-
MethodDefExceptions,
|
|
1861
1863
|
MethodName,
|
|
1862
1864
|
MethodParamName,
|
|
1863
1865
|
MethodParamOptional,
|
|
@@ -3553,6 +3555,10 @@ declare class MessageClass_2 extends Expression {
|
|
|
3553
3555
|
getRunnable(): IStatementRunnable;
|
|
3554
3556
|
}
|
|
3555
3557
|
|
|
3558
|
+
declare class MessageNumber extends Expression {
|
|
3559
|
+
getRunnable(): IStatementRunnable;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3556
3562
|
declare class MessageSource extends Expression {
|
|
3557
3563
|
getRunnable(): IStatementRunnable;
|
|
3558
3564
|
}
|
|
@@ -4526,6 +4532,7 @@ export declare enum ScopeType {
|
|
|
4526
4532
|
Dummy = "_dummy",
|
|
4527
4533
|
Global = "_global",
|
|
4528
4534
|
Program = "_program",
|
|
4535
|
+
TypePool = "_type_pool",
|
|
4529
4536
|
FunctionGroup = "_function_group",
|
|
4530
4537
|
ClassDefinition = "class_definition",
|
|
4531
4538
|
Interface = "interface",
|
|
@@ -94,6 +94,7 @@ __exportStar(require("./let"), exports);
|
|
|
94
94
|
__exportStar(require("./loop_group_by"), exports);
|
|
95
95
|
__exportStar(require("./macro_name"), exports);
|
|
96
96
|
__exportStar(require("./message_class"), exports);
|
|
97
|
+
__exportStar(require("./message_number"), exports);
|
|
97
98
|
__exportStar(require("./message_source"), exports);
|
|
98
99
|
__exportStar(require("./message_type_and_number"), exports);
|
|
99
100
|
__exportStar(require("./method_call_body"), exports);
|
|
@@ -101,11 +102,11 @@ __exportStar(require("./method_call_chain"), exports);
|
|
|
101
102
|
__exportStar(require("./method_call_param"), exports);
|
|
102
103
|
__exportStar(require("./method_call"), exports);
|
|
103
104
|
__exportStar(require("./method_def_changing"), exports);
|
|
105
|
+
__exportStar(require("./method_def_exceptions"), exports);
|
|
104
106
|
__exportStar(require("./method_def_exporting"), exports);
|
|
105
107
|
__exportStar(require("./method_def_importing"), exports);
|
|
106
108
|
__exportStar(require("./method_def_raising"), exports);
|
|
107
109
|
__exportStar(require("./method_def_returning"), exports);
|
|
108
|
-
__exportStar(require("./method_def_exceptions"), exports);
|
|
109
110
|
__exportStar(require("./method_name"), exports);
|
|
110
111
|
__exportStar(require("./method_param_name"), exports);
|
|
111
112
|
__exportStar(require("./method_param_optional"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageNumber = void 0;
|
|
4
|
+
const combi_1 = require("../combi");
|
|
5
|
+
class MessageNumber extends combi_1.Expression {
|
|
6
|
+
getRunnable() {
|
|
7
|
+
return (0, combi_1.regex)(/^\d\d\d$/i);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.MessageNumber = MessageNumber;
|
|
11
|
+
//# sourceMappingURL=message_number.js.map
|
|
@@ -8,7 +8,7 @@ class MessageSource extends combi_1.Expression {
|
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const msgid = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeft), _1.MessageClass, (0, combi_1.tok)(tokens_1.ParenRightW));
|
|
10
10
|
const simple = (0, combi_1.seq)(_1.MessageTypeAndNumber, (0, combi_1.opt)(msgid));
|
|
11
|
-
const mess1 = (0, combi_1.seq)("ID", _1.Source, "TYPE", _1.Source, "NUMBER", _1.Source);
|
|
11
|
+
const mess1 = (0, combi_1.seq)("ID", _1.Source, "TYPE", _1.Source, "NUMBER", (0, combi_1.altPrio)(_1.MessageNumber, _1.Source));
|
|
12
12
|
return (0, combi_1.altPrio)(simple, mess1);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -7,7 +7,7 @@ const expressions_1 = require("../expressions");
|
|
|
7
7
|
class Raise {
|
|
8
8
|
getMatcher() {
|
|
9
9
|
const mess = (0, combi_1.seq)("MESSAGE", expressions_1.MessageSource, (0, combi_1.opt)(expressions_1.RaiseWith));
|
|
10
|
-
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", expressions_1.Source, (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
10
|
+
const messid = (0, combi_1.seq)("MESSAGE ID", expressions_1.Source, "NUMBER", (0, combi_1.altPrio)(expressions_1.MessageNumber, expressions_1.Source), (0, combi_1.optPrio)(expressions_1.RaiseWith));
|
|
11
11
|
const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
|
|
12
12
|
const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
|
|
13
13
|
const clas = (0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION", (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
|
|
@@ -206,6 +206,7 @@ class CurrentScope {
|
|
|
206
206
|
return undefined;
|
|
207
207
|
}
|
|
208
208
|
findTypePoolConstant(name) {
|
|
209
|
+
var _a;
|
|
209
210
|
if (name === undefined || name.includes("_") === undefined) {
|
|
210
211
|
return undefined;
|
|
211
212
|
}
|
|
@@ -214,12 +215,12 @@ class CurrentScope {
|
|
|
214
215
|
if (typePool === undefined) {
|
|
215
216
|
return undefined;
|
|
216
217
|
}
|
|
217
|
-
const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
|
|
218
|
+
const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
218
219
|
const found = spag === null || spag === void 0 ? void 0 : spag.findVariable(name);
|
|
219
220
|
return found;
|
|
220
221
|
}
|
|
221
222
|
findTypePoolType(name) {
|
|
222
|
-
var _a;
|
|
223
|
+
var _a, _b;
|
|
223
224
|
if (name.includes("_") === undefined) {
|
|
224
225
|
return undefined;
|
|
225
226
|
}
|
|
@@ -228,8 +229,8 @@ class CurrentScope {
|
|
|
228
229
|
if (typePool === undefined) {
|
|
229
230
|
return undefined;
|
|
230
231
|
}
|
|
231
|
-
const spag = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild();
|
|
232
|
-
const found = (
|
|
232
|
+
const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
233
|
+
const found = (_b = spag === null || spag === void 0 ? void 0 : spag.findType(name)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
233
234
|
return found;
|
|
234
235
|
}
|
|
235
236
|
/** Lookup interface in local and global scope */
|
|
@@ -321,6 +322,10 @@ class CurrentScope {
|
|
|
321
322
|
}
|
|
322
323
|
return false;
|
|
323
324
|
}
|
|
325
|
+
isTypePool() {
|
|
326
|
+
var _a;
|
|
327
|
+
return ((_a = this.current) === null || _a === void 0 ? void 0 : _a.getIdentifier().filename.endsWith(".type.abap")) === true || false;
|
|
328
|
+
}
|
|
324
329
|
setAllowHeaderUse(name) {
|
|
325
330
|
// workaround for SELECT FOR ALL ENTRIES
|
|
326
331
|
this.allowHeaderUse = name;
|
|
@@ -7,6 +7,7 @@ var ScopeType;
|
|
|
7
7
|
ScopeType["Dummy"] = "_dummy";
|
|
8
8
|
ScopeType["Global"] = "_global";
|
|
9
9
|
ScopeType["Program"] = "_program";
|
|
10
|
+
ScopeType["TypePool"] = "_type_pool";
|
|
10
11
|
ScopeType["FunctionGroup"] = "_function_group";
|
|
11
12
|
ScopeType["ClassDefinition"] = "class_definition";
|
|
12
13
|
ScopeType["Interface"] = "interface";
|
|
@@ -140,7 +140,7 @@ class BasicTypes {
|
|
|
140
140
|
}
|
|
141
141
|
return type;
|
|
142
142
|
}
|
|
143
|
-
resolveTypeName(typeName, length, decimals) {
|
|
143
|
+
resolveTypeName(typeName, length, decimals, name) {
|
|
144
144
|
if (typeName === undefined) {
|
|
145
145
|
return undefined;
|
|
146
146
|
}
|
|
@@ -149,7 +149,7 @@ class BasicTypes {
|
|
|
149
149
|
return chain;
|
|
150
150
|
}
|
|
151
151
|
const chainText = typeName.concatTokens().toUpperCase();
|
|
152
|
-
const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals);
|
|
152
|
+
const f = this.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, name);
|
|
153
153
|
if (f !== undefined) {
|
|
154
154
|
return f;
|
|
155
155
|
}
|
|
@@ -196,7 +196,7 @@ class BasicTypes {
|
|
|
196
196
|
if (nameExpr.countTokens() > 1) { // workaround for names with dashes
|
|
197
197
|
name = new identifier_1.Identifier(name.getStart(), nameExpr.concatTokens());
|
|
198
198
|
}
|
|
199
|
-
const found = this.parseType(node);
|
|
199
|
+
const found = this.parseType(node, this.scope.isTypePool() ? name.getStr() : undefined);
|
|
200
200
|
if (found) {
|
|
201
201
|
return new _typed_identifier_1.TypedIdentifier(name, this.filename, found);
|
|
202
202
|
}
|
|
@@ -344,7 +344,7 @@ class BasicTypes {
|
|
|
344
344
|
if (type === undefined) {
|
|
345
345
|
return new Types.UnknownType("Type error, could not resolve \"" + name + "\", parseType");
|
|
346
346
|
}
|
|
347
|
-
return new Types.DataReference(type);
|
|
347
|
+
return new Types.DataReference(type, name);
|
|
348
348
|
}
|
|
349
349
|
else if (text === "TYPE STANDARD TABLE"
|
|
350
350
|
|| text === "TYPE SORTED TABLE"
|
|
@@ -392,7 +392,7 @@ class BasicTypes {
|
|
|
392
392
|
found = this.resolveTypeRef(typename);
|
|
393
393
|
}
|
|
394
394
|
else if (text.startsWith("TYPE")) {
|
|
395
|
-
found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node));
|
|
395
|
+
found = this.resolveTypeName(typename, this.findLength(node), this.findDecimals(node), name);
|
|
396
396
|
const concat = node.concatTokens().toUpperCase();
|
|
397
397
|
if (found && concat.includes(" OCCURS ")) {
|
|
398
398
|
found = new Types.TableType(found, { withHeader: concat.includes("WITH HEADER LINE") }, name);
|
|
@@ -297,6 +297,12 @@ class SyntaxLogic {
|
|
|
297
297
|
this.scope.push(stype, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
+
else if (this.object instanceof objects_1.TypePool) {
|
|
301
|
+
const main = this.object.getMainABAPFile();
|
|
302
|
+
if (main !== undefined) {
|
|
303
|
+
this.scope.push(_scope_type_1.ScopeType.TypePool, this.object.getName(), new position_1.Position(1, 1), main.getFilename());
|
|
304
|
+
}
|
|
305
|
+
}
|
|
300
306
|
for (const file of traversal) {
|
|
301
307
|
this.currentFile = file;
|
|
302
308
|
const structure = this.currentFile.getStructure();
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DataReference = void 0;
|
|
4
4
|
const _abstract_type_1 = require("./_abstract_type");
|
|
5
5
|
class DataReference extends _abstract_type_1.AbstractType {
|
|
6
|
-
constructor(type,
|
|
7
|
-
super(
|
|
6
|
+
constructor(type, qualifiedName) {
|
|
7
|
+
super(qualifiedName);
|
|
8
8
|
this.type = type;
|
|
9
9
|
}
|
|
10
10
|
toText(level) {
|
package/build/src/ddic.js
CHANGED
|
@@ -43,7 +43,7 @@ class DDIC {
|
|
|
43
43
|
const isException = ((superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^.?cx_.*$/i)) || (superClassName === null || superClassName === void 0 ? void 0 : superClassName.match(/^\/.+\/cx_.*$/i))) ? true : false;
|
|
44
44
|
return isException;
|
|
45
45
|
}
|
|
46
|
-
lookupBuiltinType(name, length, decimals) {
|
|
46
|
+
lookupBuiltinType(name, length, decimals, qualifiedName) {
|
|
47
47
|
switch (name) {
|
|
48
48
|
case "STRING":
|
|
49
49
|
return new Types.StringType(name);
|
|
@@ -54,31 +54,31 @@ class DDIC {
|
|
|
54
54
|
case "T":
|
|
55
55
|
return new Types.TimeType(name);
|
|
56
56
|
case "XSEQUENCE":
|
|
57
|
-
return new Types.XSequenceType();
|
|
57
|
+
return new Types.XSequenceType(qualifiedName);
|
|
58
58
|
case "CLIKE":
|
|
59
|
-
return new Types.CLikeType();
|
|
59
|
+
return new Types.CLikeType(qualifiedName);
|
|
60
60
|
case "DECFLOAT":
|
|
61
|
-
return new Types.DecFloatType();
|
|
61
|
+
return new Types.DecFloatType(qualifiedName);
|
|
62
62
|
case "ANY":
|
|
63
|
-
return new Types.AnyType();
|
|
63
|
+
return new Types.AnyType(qualifiedName);
|
|
64
64
|
case "SIMPLE":
|
|
65
|
-
return new Types.SimpleType();
|
|
65
|
+
return new Types.SimpleType(qualifiedName);
|
|
66
66
|
case "%_C_POINTER":
|
|
67
|
-
return new Types.HexType(8);
|
|
67
|
+
return new Types.HexType(8, qualifiedName);
|
|
68
68
|
case "TABLE":
|
|
69
69
|
return new Types.TableType(new Types.AnyType(), { withHeader: false });
|
|
70
70
|
case "DATA":
|
|
71
|
-
return new Types.AnyType();
|
|
71
|
+
return new Types.AnyType(qualifiedName);
|
|
72
72
|
case "NUMERIC":
|
|
73
|
-
return new Types.NumericGenericType();
|
|
73
|
+
return new Types.NumericGenericType(qualifiedName);
|
|
74
74
|
case "UTCLONG": // todo, take version into account
|
|
75
|
-
return new Types.UTCLongType();
|
|
75
|
+
return new Types.UTCLongType(qualifiedName);
|
|
76
76
|
case "DECFLOAT16":
|
|
77
|
-
return new Types.DecFloat16Type();
|
|
77
|
+
return new Types.DecFloat16Type(qualifiedName);
|
|
78
78
|
case "DECFLOAT34":
|
|
79
|
-
return new Types.DecFloat34Type();
|
|
79
|
+
return new Types.DecFloat34Type(qualifiedName);
|
|
80
80
|
case "CSEQUENCE":
|
|
81
|
-
return new Types.CSequenceType();
|
|
81
|
+
return new Types.CSequenceType(qualifiedName);
|
|
82
82
|
case "I":
|
|
83
83
|
case "INT8": // todo, take version into account
|
|
84
84
|
return new Types.IntegerType(name);
|
|
@@ -86,34 +86,34 @@ class DDIC {
|
|
|
86
86
|
return new Types.FloatType(name);
|
|
87
87
|
case "P":
|
|
88
88
|
if (length && decimals) {
|
|
89
|
-
return new Types.PackedType(length, decimals);
|
|
89
|
+
return new Types.PackedType(length, decimals, qualifiedName);
|
|
90
90
|
}
|
|
91
91
|
else if (length) {
|
|
92
|
-
return new Types.PackedType(length, 0);
|
|
92
|
+
return new Types.PackedType(length, 0, qualifiedName);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
return new Types.PackedType(1, 0);
|
|
95
|
+
return new Types.PackedType(1, 0, qualifiedName);
|
|
96
96
|
}
|
|
97
97
|
case "C":
|
|
98
98
|
if (length) {
|
|
99
|
-
return new Types.CharacterType(length);
|
|
99
|
+
return new Types.CharacterType(length, qualifiedName);
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
|
-
return new Types.CharacterType(1);
|
|
102
|
+
return new Types.CharacterType(1, qualifiedName);
|
|
103
103
|
}
|
|
104
104
|
case "X":
|
|
105
105
|
if (length) {
|
|
106
|
-
return new Types.HexType(length);
|
|
106
|
+
return new Types.HexType(length, qualifiedName);
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
return new Types.HexType(1);
|
|
109
|
+
return new Types.HexType(1, qualifiedName);
|
|
110
110
|
}
|
|
111
111
|
case "N":
|
|
112
112
|
if (length) {
|
|
113
|
-
return new Types.NumericType(length);
|
|
113
|
+
return new Types.NumericType(length, qualifiedName);
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
return new Types.NumericType(1);
|
|
116
|
+
return new Types.NumericType(1, qualifiedName);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return undefined;
|
package/build/src/registry.js
CHANGED
|
@@ -365,10 +365,14 @@ ${indentation}`);
|
|
|
365
365
|
}
|
|
366
366
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
367
367
|
const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "error";
|
|
368
|
-
|
|
368
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
369
369
|
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
370
370
|
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
371
371
|
${indentation}`);
|
|
372
|
+
if (fieldDefinitions === "") {
|
|
373
|
+
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
374
|
+
${indentation}`);
|
|
375
|
+
}
|
|
372
376
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
373
377
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
374
378
|
return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -513,7 +517,14 @@ ${indentation}`);
|
|
|
513
517
|
}
|
|
514
518
|
const sources = node.findDirectExpressions(Expressions.Source);
|
|
515
519
|
const id = sources[0].concatTokens();
|
|
516
|
-
const
|
|
520
|
+
const numberExpression = node.findExpressionAfterToken("NUMBER");
|
|
521
|
+
if (numberExpression === undefined) {
|
|
522
|
+
throw "downport raiseException, could not find number";
|
|
523
|
+
}
|
|
524
|
+
let number = numberExpression.concatTokens();
|
|
525
|
+
if (numberExpression.get() instanceof Expressions.MessageNumber) {
|
|
526
|
+
number = "'" + number + "'";
|
|
527
|
+
}
|
|
517
528
|
const className = ((_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "ERROR";
|
|
518
529
|
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
519
530
|
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
package/build/src/rules/index.js
CHANGED
|
@@ -100,6 +100,7 @@ __exportStar(require("./no_yoda_conditions"), exports);
|
|
|
100
100
|
__exportStar(require("./object_naming"), exports);
|
|
101
101
|
__exportStar(require("./obsolete_statement"), exports);
|
|
102
102
|
__exportStar(require("./omit_parameter_name"), exports);
|
|
103
|
+
__exportStar(require("./omit_preceding_zeros"), exports);
|
|
103
104
|
__exportStar(require("./omit_receiving"), exports);
|
|
104
105
|
__exportStar(require("./parser_702_chaining"), exports);
|
|
105
106
|
__exportStar(require("./parser_error"), exports);
|
|
@@ -38,13 +38,13 @@ class MethodLength {
|
|
|
38
38
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
getDescription(issueType, actual) {
|
|
41
|
+
getDescription(issueType, actual, type) {
|
|
42
42
|
switch (issueType) {
|
|
43
43
|
case IssueType.EmptyMethod: {
|
|
44
|
-
return "Empty
|
|
44
|
+
return "Empty " + type;
|
|
45
45
|
}
|
|
46
46
|
case IssueType.MaxStatements: {
|
|
47
|
-
return "Reduce
|
|
47
|
+
return "Reduce " + type + " length to max " + this.conf.statements + " statements, currently " + actual;
|
|
48
48
|
}
|
|
49
49
|
default: {
|
|
50
50
|
return "";
|
|
@@ -62,15 +62,16 @@ class MethodLength {
|
|
|
62
62
|
}
|
|
63
63
|
run(obj) {
|
|
64
64
|
const methodStats = method_length_stats_1.MethodLengthStats.run(obj);
|
|
65
|
-
const methodIssues = this.check(methodStats);
|
|
65
|
+
const methodIssues = this.check(methodStats, "METHOD");
|
|
66
66
|
let formIssues = [];
|
|
67
67
|
if (this.conf.checkForms) {
|
|
68
68
|
const formStats = form_length_stats_1.FormLengthStats.run(obj);
|
|
69
|
-
formIssues = this.check(formStats);
|
|
69
|
+
formIssues = this.check(formStats, "FORM");
|
|
70
70
|
}
|
|
71
71
|
return methodIssues.concat(formIssues);
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
// ***********************
|
|
74
|
+
check(stats, type) {
|
|
74
75
|
const issues = [];
|
|
75
76
|
for (const s of stats) {
|
|
76
77
|
if ((this.conf.ignoreTestClasses === true)
|
|
@@ -78,12 +79,12 @@ class MethodLength {
|
|
|
78
79
|
continue;
|
|
79
80
|
}
|
|
80
81
|
if (s.count === 0 && this.conf.errorWhenEmpty === true) {
|
|
81
|
-
const issue = issue_1.Issue.atPosition(s.file, s.pos, this.getDescription(IssueType.EmptyMethod, "0"), this.getMetadata().key, this.conf.severity);
|
|
82
|
+
const issue = issue_1.Issue.atPosition(s.file, s.pos, this.getDescription(IssueType.EmptyMethod, "0", type), this.getMetadata().key, this.conf.severity);
|
|
82
83
|
issues.push(issue);
|
|
83
84
|
continue;
|
|
84
85
|
}
|
|
85
86
|
if (s.count > this.conf.statements) {
|
|
86
|
-
const message = this.getDescription(IssueType.MaxStatements, s.count.toString());
|
|
87
|
+
const message = this.getDescription(IssueType.MaxStatements, s.count.toString(), type);
|
|
87
88
|
const issue = issue_1.Issue.atPosition(s.file, s.pos, message, this.getMetadata().key, this.conf.severity);
|
|
88
89
|
issues.push(issue);
|
|
89
90
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OmitPrecedingZeros = exports.OmitPrecedingZerosConf = void 0;
|
|
4
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
5
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
6
|
+
const issue_1 = require("../issue");
|
|
7
|
+
const Expressions = require("../abap/2_statements/expressions");
|
|
8
|
+
const _irule_1 = require("./_irule");
|
|
9
|
+
class OmitPrecedingZerosConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
10
|
+
}
|
|
11
|
+
exports.OmitPrecedingZerosConf = OmitPrecedingZerosConf;
|
|
12
|
+
class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.conf = new OmitPrecedingZerosConf();
|
|
16
|
+
}
|
|
17
|
+
getMetadata() {
|
|
18
|
+
return {
|
|
19
|
+
key: "omit_preceding_zeros",
|
|
20
|
+
title: "Omit preceding zeros",
|
|
21
|
+
shortDescription: `Omit preceding zeros from integer constants`,
|
|
22
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
23
|
+
badExample: `int = -001.`,
|
|
24
|
+
goodExample: `int = -1.`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
getConfig() {
|
|
28
|
+
return this.conf;
|
|
29
|
+
}
|
|
30
|
+
setConfig(conf) {
|
|
31
|
+
this.conf = conf;
|
|
32
|
+
}
|
|
33
|
+
runParsed(file) {
|
|
34
|
+
var _a;
|
|
35
|
+
const issues = [];
|
|
36
|
+
for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Integer)) || []) {
|
|
37
|
+
const token = i.getLastToken();
|
|
38
|
+
const str = token.getStr();
|
|
39
|
+
if (str.length > 1 && str.startsWith("0")) {
|
|
40
|
+
const message = "Omit preceding zeros";
|
|
41
|
+
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity);
|
|
42
|
+
issues.push(issue);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.OmitPrecedingZeros = OmitPrecedingZeros;
|
|
49
|
+
//# sourceMappingURL=omit_preceding_zeros.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.84.3",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.19.4",
|
|
49
49
|
"@types/chai": "^4.3.0",
|
|
50
50
|
"@types/mocha": "^9.0.0",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.10",
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
53
|
"eslint": "^8.7.0",
|
|
54
54
|
"mocha": "^9.1.4",
|