@abaplint/core 2.83.23 → 2.84.1
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 +16 -2
- package/build/src/abap/2_statements/expressions/compare.js +3 -2
- 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 +8 -2
- package/build/src/abap/5_syntax/expressions/database_table.js +1 -0
- package/build/src/abap/5_syntax/spaghetti_scope.js +4 -5
- package/build/src/abap/5_syntax/statements/create_object.js +1 -0
- package/build/src/objects/icf_service.js +26 -6
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +11 -3
- 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/build/src/rules/unknown_types.js +7 -5
- package/package.json +4 -4
package/build/abaplint.d.ts
CHANGED
|
@@ -1846,6 +1846,7 @@ declare namespace Expressions {
|
|
|
1846
1846
|
LoopGroupBy,
|
|
1847
1847
|
MacroName,
|
|
1848
1848
|
MessageClass_2 as MessageClass,
|
|
1849
|
+
MessageNumber,
|
|
1849
1850
|
MessageSource,
|
|
1850
1851
|
MessageTypeAndNumber,
|
|
1851
1852
|
MethodCallBody,
|
|
@@ -1853,11 +1854,11 @@ declare namespace Expressions {
|
|
|
1853
1854
|
MethodCallParam,
|
|
1854
1855
|
MethodCall,
|
|
1855
1856
|
MethodDefChanging,
|
|
1857
|
+
MethodDefExceptions,
|
|
1856
1858
|
MethodDefExporting,
|
|
1857
1859
|
MethodDefImporting,
|
|
1858
1860
|
MethodDefRaising,
|
|
1859
1861
|
MethodDefReturning,
|
|
1860
|
-
MethodDefExceptions,
|
|
1861
1862
|
MethodName,
|
|
1862
1863
|
MethodParamName,
|
|
1863
1864
|
MethodParamOptional,
|
|
@@ -2529,13 +2530,20 @@ declare interface IBuiltinMethod {
|
|
|
2529
2530
|
}
|
|
2530
2531
|
|
|
2531
2532
|
declare class ICFService extends AbstractObject {
|
|
2533
|
+
private parsedXML;
|
|
2532
2534
|
getType(): string;
|
|
2533
2535
|
getAllowedNaming(): {
|
|
2534
2536
|
maxLength: number;
|
|
2535
2537
|
allowNamespace: boolean;
|
|
2536
2538
|
};
|
|
2539
|
+
setDirty(): void;
|
|
2537
2540
|
getDescription(): string | undefined;
|
|
2541
|
+
getURL(): string | undefined;
|
|
2538
2542
|
getHandlerList(): string[] | undefined;
|
|
2543
|
+
parse(): {
|
|
2544
|
+
updated: boolean;
|
|
2545
|
+
runtime: number;
|
|
2546
|
+
};
|
|
2539
2547
|
}
|
|
2540
2548
|
|
|
2541
2549
|
export declare interface IClassDefinition extends IInterfaceDefinition {
|
|
@@ -3245,7 +3253,9 @@ declare interface IScopeData {
|
|
|
3245
3253
|
[name: string]: TypedIdentifier;
|
|
3246
3254
|
};
|
|
3247
3255
|
deferred: Token[];
|
|
3248
|
-
cdefs:
|
|
3256
|
+
cdefs: {
|
|
3257
|
+
[name: string]: IClassDefinition;
|
|
3258
|
+
};
|
|
3249
3259
|
idefs: IInterfaceDefinition[];
|
|
3250
3260
|
forms: IFormDefinition[];
|
|
3251
3261
|
references: IReference[];
|
|
@@ -3544,6 +3554,10 @@ declare class MessageClass_2 extends Expression {
|
|
|
3544
3554
|
getRunnable(): IStatementRunnable;
|
|
3545
3555
|
}
|
|
3546
3556
|
|
|
3557
|
+
declare class MessageNumber extends Expression {
|
|
3558
|
+
getRunnable(): IStatementRunnable;
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3547
3561
|
declare class MessageSource extends Expression {
|
|
3548
3562
|
getRunnable(): IStatementRunnable;
|
|
3549
3563
|
}
|
|
@@ -10,11 +10,12 @@ class Compare extends combi_1.Expression {
|
|
|
10
10
|
const val = (0, combi_1.altPrio)(_1.FieldSub, _1.Constant);
|
|
11
11
|
const list = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.plus)((0, combi_1.seq)(",", val)), (0, combi_1.tok)(tokens_1.ParenRightW));
|
|
12
12
|
const inn = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "IN", (0, combi_1.altPrio)(_1.Source, list));
|
|
13
|
-
const sopt = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("INSTANCE OF", _1.ClassName)), "REQUESTED", "
|
|
13
|
+
const sopt = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("INSTANCE OF", _1.ClassName)), "REQUESTED", "INITIAL"));
|
|
14
14
|
const between = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "BETWEEN", _1.Source, "AND", _1.Source);
|
|
15
15
|
const predicate = (0, combi_1.ver)(version_1.Version.v740sp08, _1.MethodCallChain);
|
|
16
16
|
const rett = (0, combi_1.seq)(_1.Source, (0, combi_1.altPrio)((0, combi_1.seq)(_1.CompareOperator, _1.Source), inn, between, sopt));
|
|
17
|
-
const
|
|
17
|
+
const fsassign = (0, combi_1.seq)(_1.SourceFieldSymbol, "IS", (0, combi_1.optPrio)("NOT"), "ASSIGNED");
|
|
18
|
+
const ret = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.altPrio)(rett, predicate, fsassign));
|
|
18
19
|
return ret;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -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));
|
|
@@ -74,8 +74,14 @@ class CurrentScope {
|
|
|
74
74
|
this.current.getData().extraLikeTypes[upper] = type;
|
|
75
75
|
}
|
|
76
76
|
addClassDefinition(c) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (this.current === undefined) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const name = c.getName().toUpperCase();
|
|
81
|
+
if (this.current.getData().cdefs[name] !== undefined) {
|
|
82
|
+
throw new Error(`Class "${name}" already defined`);
|
|
83
|
+
}
|
|
84
|
+
this.current.getData().cdefs[name] = c;
|
|
79
85
|
}
|
|
80
86
|
addFormDefinitions(f) {
|
|
81
87
|
if (this.current === undefined) {
|
|
@@ -19,6 +19,7 @@ class DatabaseTable {
|
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
scope.addReference(token, found.getIdentifier(), _reference_1.ReferenceType.TableReference, filename);
|
|
22
|
+
scope.getDDICReferences().addUsing(scope.getParentObj(), { object: found, token: token, filename: filename });
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -8,7 +8,7 @@ class ScopeData {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
this.data = {
|
|
10
10
|
vars: {},
|
|
11
|
-
cdefs:
|
|
11
|
+
cdefs: {},
|
|
12
12
|
idefs: [],
|
|
13
13
|
forms: [],
|
|
14
14
|
types: {},
|
|
@@ -68,10 +68,9 @@ class SpaghettiScopeNode extends ScopeData {
|
|
|
68
68
|
let search = this;
|
|
69
69
|
const upper = name.toUpperCase();
|
|
70
70
|
while (search !== undefined) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
71
|
+
const c = search.getData().cdefs[upper];
|
|
72
|
+
if (c !== undefined) {
|
|
73
|
+
return c;
|
|
75
74
|
}
|
|
76
75
|
search = search.getParent();
|
|
77
76
|
}
|
|
@@ -44,6 +44,7 @@ class CreateObject {
|
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
else if (!(found instanceof basic_1.ObjectReferenceType)
|
|
47
|
+
&& !(found instanceof basic_1.AnyType)
|
|
47
48
|
&& !(found instanceof basic_1.GenericObjectReferenceType)) {
|
|
48
49
|
throw new Error("Target must be a object reference");
|
|
49
50
|
}
|
|
@@ -13,26 +13,46 @@ class ICFService extends _abstract_object_1.AbstractObject {
|
|
|
13
13
|
allowNamespace: true,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
setDirty() {
|
|
17
|
+
this.parsedXML = undefined;
|
|
18
|
+
super.setDirty();
|
|
19
|
+
}
|
|
16
20
|
getDescription() {
|
|
17
21
|
// todo
|
|
18
22
|
return undefined;
|
|
19
23
|
}
|
|
20
|
-
|
|
24
|
+
getURL() {
|
|
25
|
+
var _a;
|
|
26
|
+
this.parse();
|
|
27
|
+
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.url;
|
|
28
|
+
}
|
|
21
29
|
getHandlerList() {
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
var _a;
|
|
31
|
+
this.parse();
|
|
32
|
+
return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.handlers;
|
|
33
|
+
}
|
|
34
|
+
parse() {
|
|
35
|
+
if (this.parsedXML) {
|
|
36
|
+
return { updated: false, runtime: 0 };
|
|
37
|
+
}
|
|
38
|
+
const start = Date.now();
|
|
39
|
+
this.parsedXML = {};
|
|
40
|
+
const parsed = super.parseRaw2();
|
|
24
41
|
if (parsed === undefined
|
|
25
42
|
|| parsed.abapGit === undefined
|
|
26
43
|
|| parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
|
|
27
|
-
return
|
|
44
|
+
return { updated: false, runtime: 0 };
|
|
28
45
|
}
|
|
29
46
|
const table = parsed.abapGit["asx:abap"]["asx:values"].ICFHANDLER_TABLE;
|
|
47
|
+
this.parsedXML.handlers = [];
|
|
30
48
|
for (const h of (0, xml_utils_1.xmlToArray)(table)) {
|
|
31
49
|
if (h.ICFHANDLER !== undefined) {
|
|
32
|
-
|
|
50
|
+
this.parsedXML.handlers.push(h.ICFHANDLER.ICFHANDLER);
|
|
33
51
|
}
|
|
34
52
|
}
|
|
35
|
-
|
|
53
|
+
this.parsedXML.url = parsed.abapGit["asx:abap"]["asx:values"].URL;
|
|
54
|
+
const end = Date.now();
|
|
55
|
+
return { updated: true, runtime: end - start };
|
|
36
56
|
}
|
|
37
57
|
}
|
|
38
58
|
exports.ICFService = ICFService;
|
package/build/src/registry.js
CHANGED
|
@@ -236,8 +236,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
236
236
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
237
237
|
return undefined;
|
|
238
238
|
}
|
|
239
|
-
// todo:
|
|
240
|
-
if (!(high.get() instanceof Statements.Select)
|
|
239
|
+
// todo: select loop
|
|
240
|
+
if (!(high.get() instanceof Statements.Select)
|
|
241
|
+
&& !(high.get() instanceof Statements.UpdateDatabase)
|
|
242
|
+
&& !(high.get() instanceof Statements.ModifyDatabase)
|
|
243
|
+
&& !(high.get() instanceof Statements.DeleteDatabase)
|
|
244
|
+
&& !(high.get() instanceof Statements.InsertDatabase)) {
|
|
241
245
|
return undefined;
|
|
242
246
|
}
|
|
243
247
|
let fix = undefined;
|
|
@@ -361,10 +365,14 @@ ${indentation}`);
|
|
|
361
365
|
}
|
|
362
366
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
363
367
|
const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "error";
|
|
364
|
-
|
|
368
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
365
369
|
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
366
370
|
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
367
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
|
+
}
|
|
368
376
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
369
377
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
370
378
|
return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
|
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
|
|
@@ -64,14 +64,15 @@ class UnknownTypes {
|
|
|
64
64
|
traverse(node) {
|
|
65
65
|
var _a;
|
|
66
66
|
const ret = [];
|
|
67
|
-
|
|
67
|
+
const nodeData = node.getData();
|
|
68
|
+
for (const r of nodeData.references) {
|
|
68
69
|
if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedUnknownReference && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName)) {
|
|
69
70
|
const message = r.extra.ooName + " unknown";
|
|
70
71
|
ret.push(issue_1.Issue.atIdentifier(r.position, message, this.getMetadata().key, this.conf.severity));
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
if (node.getIdentifier().stype !== _scope_type_1.ScopeType.ClassImplementation) {
|
|
74
|
-
const vars =
|
|
75
|
+
const vars = nodeData.vars;
|
|
75
76
|
for (const name in vars) {
|
|
76
77
|
const identifier = vars[name];
|
|
77
78
|
const found = this.containsUnknown(identifier.getType());
|
|
@@ -80,7 +81,7 @@ class UnknownTypes {
|
|
|
80
81
|
ret.push(issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity));
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
const types =
|
|
84
|
+
const types = nodeData.types;
|
|
84
85
|
for (const name in types) {
|
|
85
86
|
const identifier = types[name];
|
|
86
87
|
const found = this.containsUnknown(identifier.getType());
|
|
@@ -90,14 +91,15 @@ class UnknownTypes {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
for (const v of
|
|
94
|
+
for (const v of nodeData.idefs) {
|
|
94
95
|
const found = this.checkMethodParameters(v);
|
|
95
96
|
if (found) {
|
|
96
97
|
const message = "Contains unknown, " + found.found;
|
|
97
98
|
ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
for (const
|
|
101
|
+
for (const name in nodeData.cdefs) {
|
|
102
|
+
const v = nodeData.cdefs[name];
|
|
101
103
|
const found = this.checkMethodParameters(v);
|
|
102
104
|
if (found) {
|
|
103
105
|
const message = "Contains unknown, " + found.found;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.84.1",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,10 +48,10 @@
|
|
|
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.9",
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
|
-
"eslint": "^8.
|
|
54
|
-
"mocha": "^9.1.
|
|
53
|
+
"eslint": "^8.7.0",
|
|
54
|
+
"mocha": "^9.1.4",
|
|
55
55
|
"c8": "^7.11.0",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^0.97.0",
|