@abaplint/cli 2.120.78 → 2.120.79
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/cli.js +218 -28
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -3083,7 +3083,7 @@ class ExpandMacros {
|
|
|
3083
3083
|
listMacroNames() {
|
|
3084
3084
|
return this.macros.listMacroNames();
|
|
3085
3085
|
}
|
|
3086
|
-
find(statements, file, clear = true) {
|
|
3086
|
+
find(statements, file, clear = true, includePath = new Set()) {
|
|
3087
3087
|
var _a, _b, _c;
|
|
3088
3088
|
let nameToken = undefined;
|
|
3089
3089
|
let start = undefined;
|
|
@@ -3104,14 +3104,16 @@ class ExpandMacros {
|
|
|
3104
3104
|
else if (type instanceof Statements.Include) {
|
|
3105
3105
|
const includeName = (_b = statement.findDirectExpression(Expressions.IncludeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
3106
3106
|
// todo, this does not take function module includes into account
|
|
3107
|
-
// todo, workaround for cyclic includes?
|
|
3108
3107
|
const prog = (_c = this.reg) === null || _c === void 0 ? void 0 : _c.getObject("PROG", includeName);
|
|
3109
3108
|
if (prog) {
|
|
3110
3109
|
prog.parse(this.release, this.globalMacros, this.reg, this.languageVersion);
|
|
3111
3110
|
const includeMainFile = prog.getMainABAPFile();
|
|
3112
|
-
|
|
3111
|
+
// an include that is already on the current include path is not walked again
|
|
3112
|
+
if (includeMainFile && includePath.has(includeMainFile.getFilename()) === false) {
|
|
3113
|
+
includePath.add(includeMainFile.getFilename());
|
|
3113
3114
|
// slow, this copies everything,
|
|
3114
|
-
this.find([...includeMainFile.getStatements()], includeMainFile, false);
|
|
3115
|
+
this.find([...includeMainFile.getStatements()], includeMainFile, false, includePath);
|
|
3116
|
+
includePath.delete(includeMainFile.getFilename());
|
|
3115
3117
|
}
|
|
3116
3118
|
}
|
|
3117
3119
|
}
|
|
@@ -13366,11 +13368,11 @@ class Convert {
|
|
|
13366
13368
|
const dat = (0, combi_1.seq)("DATE", expressions_1.Source);
|
|
13367
13369
|
const tim = (0, combi_1.seq)("TIME", expressions_1.Source);
|
|
13368
13370
|
const stamp = (0, combi_1.seq)("INTO TIME STAMP", expressions_1.Target);
|
|
13369
|
-
const intoutc = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("INTO UTCLONG", expressions_1.Target));
|
|
13371
|
+
const intoutc = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("INTO UTCLONG", expressions_1.Target), { also: combi_1.AlsoIn.OpenABAP });
|
|
13370
13372
|
const invert = (0, combi_1.seq)("INTO INVERTED-DATE", expressions_1.Target);
|
|
13371
13373
|
const date = (0, combi_1.seq)((0, combi_1.per)(dat, tim), (0, combi_1.per)(daylightSource, stamp, zone, invert, intoutc));
|
|
13372
13374
|
const inv = (0, combi_1.seq)("INVERTED-DATE", expressions_1.Source, "INTO DATE", expressions_1.Target);
|
|
13373
|
-
const utclong = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("UTCLONG", expressions_1.Source, (0, combi_1.per)(zone, into,
|
|
13375
|
+
const utclong = (0, combi_1.ver)(version_1.Release.v754, (0, combi_1.seq)("UTCLONG", expressions_1.Source, (0, combi_1.per)(zone, into, daylightTarget)), { also: combi_1.AlsoIn.OpenABAP });
|
|
13374
13376
|
return (0, combi_1.seq)("CONVERT", (0, combi_1.alt)(time, date, inv, utclong));
|
|
13375
13377
|
}
|
|
13376
13378
|
}
|
|
@@ -26065,9 +26067,9 @@ BuiltIn.methods = {
|
|
|
26065
26067
|
},
|
|
26066
26068
|
optional: {
|
|
26067
26069
|
"days": basic_1.IntegerType.get(),
|
|
26068
|
-
"
|
|
26069
|
-
"minutes": basic_1.
|
|
26070
|
-
"seconds": new basic_1.
|
|
26070
|
+
"hours": basic_1.IntegerType.get(),
|
|
26071
|
+
"minutes": new basic_1.Integer8Type(),
|
|
26072
|
+
"seconds": new basic_1.DecFloat34Type(),
|
|
26071
26073
|
},
|
|
26072
26074
|
return: new basic_1.UTCLongType(),
|
|
26073
26075
|
release: version_1.Release.v754,
|
|
@@ -26083,7 +26085,7 @@ BuiltIn.methods = {
|
|
|
26083
26085
|
"high": new basic_1.UTCLongType(),
|
|
26084
26086
|
"low": new basic_1.UTCLongType(),
|
|
26085
26087
|
},
|
|
26086
|
-
return: new basic_1.
|
|
26088
|
+
return: new basic_1.DecFloat34Type(),
|
|
26087
26089
|
release: version_1.Release.v754,
|
|
26088
26090
|
},
|
|
26089
26091
|
"XSDBOOL": {
|
|
@@ -27435,7 +27437,12 @@ class Procedural {
|
|
|
27435
27437
|
this.scope = scope;
|
|
27436
27438
|
this.reg = reg;
|
|
27437
27439
|
}
|
|
27438
|
-
addAllFormDefinitions(file, obj) {
|
|
27440
|
+
addAllFormDefinitions(file, obj, visited = new Set()) {
|
|
27441
|
+
// an include reached again through a cycle of INCLUDEs is not walked twice
|
|
27442
|
+
if (visited.has(file.getFilename())) {
|
|
27443
|
+
return;
|
|
27444
|
+
}
|
|
27445
|
+
visited.add(file.getFilename());
|
|
27439
27446
|
const structure = file.getStructure();
|
|
27440
27447
|
if (structure) {
|
|
27441
27448
|
const input = {
|
|
@@ -27456,12 +27463,12 @@ class Procedural {
|
|
|
27456
27463
|
for (const node of includes) {
|
|
27457
27464
|
const found = this.findInclude(node, obj);
|
|
27458
27465
|
if (found) {
|
|
27459
|
-
this.addAllFormDefinitions(found, obj);
|
|
27466
|
+
this.addAllFormDefinitions(found, obj, visited);
|
|
27460
27467
|
}
|
|
27461
27468
|
}
|
|
27462
27469
|
}
|
|
27463
27470
|
findInclude(node, obj) {
|
|
27464
|
-
//
|
|
27471
|
+
// cyclic includes are cut by the callers, includes not found are reported by rule "check_include"
|
|
27465
27472
|
// todo: how to make sure code is not duplicated here and in rule "check_include" / include graph?
|
|
27466
27473
|
const expr = node.findFirstExpression(Expressions.IncludeName);
|
|
27467
27474
|
if (expr === undefined) {
|
|
@@ -30131,7 +30138,11 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
|
|
|
30131
30138
|
// On a character or byte field of fixed length the substring must lie inside the field, else it is
|
|
30132
30139
|
// a syntax error. Other types, a dynamic offset or length and "*" (undefined) are left alone, as is
|
|
30133
30140
|
// length 0. The offset is applied first, so the length is compared to what remains after the offset.
|
|
30141
|
+
// A substring of a date, time or numeric text field has type n; its bounds are not checked.
|
|
30134
30142
|
function substringType(context, offset, length, node, input) {
|
|
30143
|
+
if (context instanceof basic_1.DateType || context instanceof basic_1.TimeType || context instanceof basic_1.NumericType) {
|
|
30144
|
+
return numericSubstringType(context, offset, length);
|
|
30145
|
+
}
|
|
30135
30146
|
if (!(context instanceof basic_1.CharacterType) && !(context instanceof basic_1.HexType)) {
|
|
30136
30147
|
return context;
|
|
30137
30148
|
}
|
|
@@ -30154,6 +30165,24 @@ function substringType(context, offset, length, node, input) {
|
|
|
30154
30165
|
}
|
|
30155
30166
|
return context;
|
|
30156
30167
|
}
|
|
30168
|
+
function numericSubstringType(context, offset, length) {
|
|
30169
|
+
const hasOffset = offset !== undefined && offset > 0;
|
|
30170
|
+
const hasLength = length !== undefined && length > 0;
|
|
30171
|
+
if (hasOffset === false && hasLength === false) {
|
|
30172
|
+
return context;
|
|
30173
|
+
}
|
|
30174
|
+
let remaining = context instanceof basic_1.DateType ? 8 : context instanceof basic_1.TimeType ? 6 : context.getLength();
|
|
30175
|
+
if (hasOffset) {
|
|
30176
|
+
remaining = remaining - offset;
|
|
30177
|
+
}
|
|
30178
|
+
if (hasLength) {
|
|
30179
|
+
remaining = Math.min(remaining, length);
|
|
30180
|
+
}
|
|
30181
|
+
if (remaining <= 0) {
|
|
30182
|
+
return context;
|
|
30183
|
+
}
|
|
30184
|
+
return new basic_1.NumericType(remaining);
|
|
30185
|
+
}
|
|
30157
30186
|
// A field symbol typed "c" or "x" is generic, but its type is represented with length 1, so the
|
|
30158
30187
|
// offset or length at "index" is not checked when it directly follows the field symbol
|
|
30159
30188
|
function isFieldSymbolItself(children, index) {
|
|
@@ -40286,6 +40315,16 @@ class Convert {
|
|
|
40286
40315
|
target_1.Target.runSyntax(stampTarget, input);
|
|
40287
40316
|
}
|
|
40288
40317
|
}
|
|
40318
|
+
const utclongTarget = node.findExpressionAfterToken("UTCLONG");
|
|
40319
|
+
if ((utclongTarget === null || utclongTarget === void 0 ? void 0 : utclongTarget.get()) instanceof Expressions.Target) {
|
|
40320
|
+
const inline = utclongTarget === null || utclongTarget === void 0 ? void 0 : utclongTarget.findDirectExpression(Expressions.InlineData);
|
|
40321
|
+
if (inline) {
|
|
40322
|
+
inline_data_1.InlineData.runSyntax(inline, input, new basic_1.UTCLongType());
|
|
40323
|
+
}
|
|
40324
|
+
else {
|
|
40325
|
+
target_1.Target.runSyntax(utclongTarget, input);
|
|
40326
|
+
}
|
|
40327
|
+
}
|
|
40289
40328
|
}
|
|
40290
40329
|
}
|
|
40291
40330
|
exports.Convert = Convert;
|
|
@@ -49806,6 +49845,8 @@ if (Object.keys(map).length === 0) {
|
|
|
49806
49845
|
// -----------------------------------
|
|
49807
49846
|
class SyntaxLogic {
|
|
49808
49847
|
constructor(reg, object) {
|
|
49848
|
+
// files the traversal walked into through INCLUDEs, outermost first
|
|
49849
|
+
this.includeStack = [];
|
|
49809
49850
|
this.reg = reg;
|
|
49810
49851
|
this.issues = [];
|
|
49811
49852
|
this.deferred = [];
|
|
@@ -49913,11 +49954,20 @@ class SyntaxLogic {
|
|
|
49913
49954
|
// walk into INCLUDEs
|
|
49914
49955
|
if (isStatement && child.get() instanceof Statements.Include) {
|
|
49915
49956
|
const file = this.helpers.proc.findInclude(child, this.object);
|
|
49916
|
-
|
|
49957
|
+
// an INCLUDE that leads back to a file already being walked is not followed again
|
|
49958
|
+
const cyclic = file !== undefined && (file.getFilename() === this.currentFile.getFilename()
|
|
49959
|
+
|| this.includeStack.includes(file.getFilename()));
|
|
49960
|
+
if (file !== undefined && file.getStructure() !== undefined && cyclic === false) {
|
|
49917
49961
|
const old = this.currentFile;
|
|
49962
|
+
this.includeStack.push(old.getFilename());
|
|
49918
49963
|
this.currentFile = file;
|
|
49919
|
-
|
|
49920
|
-
|
|
49964
|
+
try {
|
|
49965
|
+
this.traverse(file.getStructure());
|
|
49966
|
+
}
|
|
49967
|
+
finally {
|
|
49968
|
+
this.currentFile = old;
|
|
49969
|
+
this.includeStack.pop();
|
|
49970
|
+
}
|
|
49921
49971
|
}
|
|
49922
49972
|
}
|
|
49923
49973
|
if (isStructure || isStatement) {
|
|
@@ -50327,11 +50377,46 @@ exports.ArtifactsABAP = ArtifactsABAP;
|
|
|
50327
50377
|
|
|
50328
50378
|
"use strict";
|
|
50329
50379
|
|
|
50380
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
50381
|
+
if (k2 === undefined) k2 = k;
|
|
50382
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
50383
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
50384
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
50385
|
+
}
|
|
50386
|
+
Object.defineProperty(o, k2, desc);
|
|
50387
|
+
}) : (function(o, m, k, k2) {
|
|
50388
|
+
if (k2 === undefined) k2 = k;
|
|
50389
|
+
o[k2] = m[k];
|
|
50390
|
+
}));
|
|
50391
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
50392
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
50393
|
+
}) : function(o, v) {
|
|
50394
|
+
o["default"] = v;
|
|
50395
|
+
});
|
|
50396
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
50397
|
+
var ownKeys = function(o) {
|
|
50398
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
50399
|
+
var ar = [];
|
|
50400
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
50401
|
+
return ar;
|
|
50402
|
+
};
|
|
50403
|
+
return ownKeys(o);
|
|
50404
|
+
};
|
|
50405
|
+
return function (mod) {
|
|
50406
|
+
if (mod && mod.__esModule) return mod;
|
|
50407
|
+
var result = {};
|
|
50408
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
50409
|
+
__setModuleDefault(result, mod);
|
|
50410
|
+
return result;
|
|
50411
|
+
};
|
|
50412
|
+
})();
|
|
50330
50413
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
50331
50414
|
exports.CrossIncludeMacros = void 0;
|
|
50332
50415
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
50333
50416
|
const program_1 = __webpack_require__(/*! ../objects/program */ "../core/build/src/objects/program.js");
|
|
50334
50417
|
const _statement_1 = __webpack_require__(/*! ./2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
50418
|
+
const statements_1 = __webpack_require__(/*! ./2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js");
|
|
50419
|
+
const Expressions = __importStar(__webpack_require__(/*! ./2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
50335
50420
|
const expand_macros_1 = __webpack_require__(/*! ./2_statements/expand_macros */ "../core/build/src/abap/2_statements/expand_macros.js");
|
|
50336
50421
|
const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "../core/build/src/utils/include_graph.js");
|
|
50337
50422
|
// Macros can be defined in one include and used in a sibling include, connected
|
|
@@ -50344,6 +50429,7 @@ class CrossIncludeMacros {
|
|
|
50344
50429
|
this.reg = reg;
|
|
50345
50430
|
}
|
|
50346
50431
|
run() {
|
|
50432
|
+
this.reparseCyclicPrograms();
|
|
50347
50433
|
const candidates = this.findCandidates();
|
|
50348
50434
|
if (candidates.length === 0) {
|
|
50349
50435
|
return;
|
|
@@ -50371,6 +50457,45 @@ class CrossIncludeMacros {
|
|
|
50371
50457
|
}
|
|
50372
50458
|
}
|
|
50373
50459
|
//////////////////////////////
|
|
50460
|
+
// A program or include in an INCLUDE cycle can be parsed while the include defining its macros is still
|
|
50461
|
+
// being parsed, depending on the order the files were added. Everything is parsed now, so parse it again.
|
|
50462
|
+
reparseCyclicPrograms() {
|
|
50463
|
+
const config = this.reg.getConfig();
|
|
50464
|
+
for (const obj of this.reg.getObjects()) {
|
|
50465
|
+
if (obj instanceof program_1.Program && this.hasUnknown(obj) && this.isInIncludeCycle(obj)) {
|
|
50466
|
+
obj.setDirty();
|
|
50467
|
+
obj.parse(config.getRelease(), config.getSyntaxSetttings().globalMacros, this.reg, config.getLanguageVersion());
|
|
50468
|
+
}
|
|
50469
|
+
}
|
|
50470
|
+
}
|
|
50471
|
+
hasUnknown(prog) {
|
|
50472
|
+
return prog.getABAPFiles().some(f => f.getStatements().some(s => s.get() instanceof _statement_1.Unknown));
|
|
50473
|
+
}
|
|
50474
|
+
// the include graph does not link INCLUDEs of main programs, so follow the INCLUDEs from the program
|
|
50475
|
+
isInIncludeCycle(prog) {
|
|
50476
|
+
var _a;
|
|
50477
|
+
const seen = new Set();
|
|
50478
|
+
const stack = [prog];
|
|
50479
|
+
while (stack.length > 0) {
|
|
50480
|
+
for (const file of stack.pop().getABAPFiles()) {
|
|
50481
|
+
for (const statement of file.getStatements()) {
|
|
50482
|
+
if (!(statement.get() instanceof statements_1.Include)) {
|
|
50483
|
+
continue;
|
|
50484
|
+
}
|
|
50485
|
+
const name = (_a = statement.findDirectExpression(Expressions.IncludeName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
50486
|
+
const included = this.reg.getObject("PROG", name);
|
|
50487
|
+
if (included === prog) {
|
|
50488
|
+
return true;
|
|
50489
|
+
}
|
|
50490
|
+
else if (included instanceof program_1.Program && seen.has(included) === false) {
|
|
50491
|
+
seen.add(included);
|
|
50492
|
+
stack.push(included);
|
|
50493
|
+
}
|
|
50494
|
+
}
|
|
50495
|
+
}
|
|
50496
|
+
}
|
|
50497
|
+
return false;
|
|
50498
|
+
}
|
|
50374
50499
|
findCandidates() {
|
|
50375
50500
|
const ret = [];
|
|
50376
50501
|
for (const obj of this.reg.getObjects()) {
|
|
@@ -62144,6 +62269,7 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
|
|
|
62144
62269
|
}
|
|
62145
62270
|
constructor(name) {
|
|
62146
62271
|
super(name);
|
|
62272
|
+
this.parsing = false;
|
|
62147
62273
|
this.parsed = [];
|
|
62148
62274
|
this.texts = undefined;
|
|
62149
62275
|
this.rawXMLCache = undefined;
|
|
@@ -62152,11 +62278,19 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
|
|
|
62152
62278
|
return !!x && x instanceof ABAPObject;
|
|
62153
62279
|
}
|
|
62154
62280
|
parse(release, globalMacros, reg, languageVersion = version_1.LanguageVersion.Normal) {
|
|
62155
|
-
|
|
62281
|
+
// an INCLUDE that leads back to this object while it is being parsed is not followed again
|
|
62282
|
+
if (this.isDirty() === false || this.parsing === true) {
|
|
62156
62283
|
return { updated: false, runtime: 0 };
|
|
62157
62284
|
}
|
|
62158
62285
|
const abapFiles = this.getFiles().filter(f => f.getFilename().endsWith(".abap"));
|
|
62159
|
-
|
|
62286
|
+
let result;
|
|
62287
|
+
this.parsing = true;
|
|
62288
|
+
try {
|
|
62289
|
+
result = new abap_parser_1.ABAPParser({ release, globalMacros, reg, languageVersion }).parse(abapFiles);
|
|
62290
|
+
}
|
|
62291
|
+
finally {
|
|
62292
|
+
this.parsing = false;
|
|
62293
|
+
}
|
|
62160
62294
|
this.parsed = result.output;
|
|
62161
62295
|
this.old = result.issues;
|
|
62162
62296
|
this.dirty = false;
|
|
@@ -71373,7 +71507,7 @@ class Registry {
|
|
|
71373
71507
|
}
|
|
71374
71508
|
static abaplintVersion() {
|
|
71375
71509
|
// magic, see build script "version.js"
|
|
71376
|
-
return "2.120.
|
|
71510
|
+
return "2.120.79";
|
|
71377
71511
|
}
|
|
71378
71512
|
getDDICReferences() {
|
|
71379
71513
|
return this.ddicReferences;
|
|
@@ -89957,6 +90091,7 @@ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js"
|
|
|
89957
90091
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
89958
90092
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
89959
90093
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
90094
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
89960
90095
|
class MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
89961
90096
|
}
|
|
89962
90097
|
exports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;
|
|
@@ -89970,7 +90105,7 @@ class MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {
|
|
|
89970
90105
|
key: "max_one_method_parameter_per_line",
|
|
89971
90106
|
title: "Max one method parameter definition per line",
|
|
89972
90107
|
shortDescription: `Keep max one method parameter description per line`,
|
|
89973
|
-
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],
|
|
90108
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
|
|
89974
90109
|
badExample: `
|
|
89975
90110
|
METHODS apps_scope_token
|
|
89976
90111
|
IMPORTING
|
|
@@ -89999,7 +90134,8 @@ METHODS apps_scope_token
|
|
|
89999
90134
|
continue;
|
|
90000
90135
|
}
|
|
90001
90136
|
if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {
|
|
90002
|
-
const
|
|
90137
|
+
const fix = this.buildFix(file, statement, p);
|
|
90138
|
+
const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity, fix);
|
|
90003
90139
|
issues.push(issue);
|
|
90004
90140
|
}
|
|
90005
90141
|
prev = p;
|
|
@@ -90007,8 +90143,32 @@ METHODS apps_scope_token
|
|
|
90007
90143
|
}
|
|
90008
90144
|
return issues;
|
|
90009
90145
|
}
|
|
90146
|
+
/** moves the parameter, or its preceding section keyword, to a new line */
|
|
90147
|
+
buildFix(file, statement, param) {
|
|
90148
|
+
const tokens = statement.getTokens();
|
|
90149
|
+
const index = tokens.indexOf(param.getFirstToken());
|
|
90150
|
+
if (index < 1) {
|
|
90151
|
+
return undefined;
|
|
90152
|
+
}
|
|
90153
|
+
let target = tokens[index];
|
|
90154
|
+
let indent = statement.findFirstExpression(Expressions.MethodParam).getFirstToken().getStart().getCol();
|
|
90155
|
+
const before = tokens[index - 1];
|
|
90156
|
+
if (MaxOneMethodParameterPerLine.SECTIONS.includes(before.getStr().toUpperCase())) {
|
|
90157
|
+
if (index < 2) {
|
|
90158
|
+
return undefined;
|
|
90159
|
+
}
|
|
90160
|
+
target = before;
|
|
90161
|
+
indent = tokens.find(t => MaxOneMethodParameterPerLine.SECTIONS.includes(t.getStr().toUpperCase())).getStart().getCol();
|
|
90162
|
+
}
|
|
90163
|
+
const previous = tokens[tokens.indexOf(target) - 1];
|
|
90164
|
+
if (previous.getEnd().getRow() !== target.getStart().getRow()) {
|
|
90165
|
+
return undefined;
|
|
90166
|
+
}
|
|
90167
|
+
return edit_helper_1.EditHelper.replaceRange(file, previous.getEnd(), target.getStart(), "\n" + " ".repeat(indent - 1));
|
|
90168
|
+
}
|
|
90010
90169
|
}
|
|
90011
90170
|
exports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;
|
|
90171
|
+
MaxOneMethodParameterPerLine.SECTIONS = ["IMPORTING", "EXPORTING", "CHANGING", "RETURNING"];
|
|
90012
90172
|
//# sourceMappingURL=max_one_method_parameter_per_line.js.map
|
|
90013
90173
|
|
|
90014
90174
|
/***/ },
|
|
@@ -96433,7 +96593,7 @@ class PreferPragmas extends _abap_rule_1.ABAPRule {
|
|
|
96433
96593
|
return {
|
|
96434
96594
|
key: "prefer_pragmas",
|
|
96435
96595
|
title: "prefer pragmas over pseudo comments ",
|
|
96436
|
-
shortDescription: `prefer pragmas over pseudo comments
|
|
96596
|
+
shortDescription: `prefer pragmas over pseudo comments`,
|
|
96437
96597
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-pragmas-to-pseudo-comments`,
|
|
96438
96598
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
96439
96599
|
badExample: `DATA foo1 TYPE i. "#EC NEEDED`,
|
|
@@ -98322,9 +98482,9 @@ text = text.`,
|
|
|
98322
98482
|
context = this.infer(context, this.sourceType(child, scope));
|
|
98323
98483
|
}
|
|
98324
98484
|
else if (child.get() instanceof Expressions.ArithOperator) {
|
|
98325
|
-
|
|
98326
|
-
|
|
98327
|
-
|
|
98485
|
+
// the CONV sets the calculation type of arithmetic expressions, only redundant
|
|
98486
|
+
// if the assignment target has the same type, see arithmeticUsesSameTargetType
|
|
98487
|
+
return undefined;
|
|
98328
98488
|
}
|
|
98329
98489
|
else {
|
|
98330
98490
|
return undefined;
|
|
@@ -107003,7 +107163,6 @@ const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/pos
|
|
|
107003
107163
|
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
107004
107164
|
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
107005
107165
|
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
107006
|
-
// todo, check for cycles/circular dependencies, method findTop
|
|
107007
107166
|
// todo, add configurable error for multiple use includes
|
|
107008
107167
|
const FMXXINCLUDE = /^(\/\w+\/)?L.+XX$/;
|
|
107009
107168
|
function getABAPObjects(reg) {
|
|
@@ -107039,11 +107198,33 @@ class Graph {
|
|
|
107039
107198
|
}
|
|
107040
107199
|
this.edges[from.filename].push(toFilename);
|
|
107041
107200
|
}
|
|
107042
|
-
|
|
107201
|
+
// true if "to" is reachable from "from" via the edges, "from" itself counts
|
|
107202
|
+
isReachable(from, to) {
|
|
107203
|
+
const seen = new Set();
|
|
107204
|
+
const stack = [from];
|
|
107205
|
+
while (stack.length > 0) {
|
|
107206
|
+
const current = stack.pop();
|
|
107207
|
+
if (current === to) {
|
|
107208
|
+
return true;
|
|
107209
|
+
}
|
|
107210
|
+
if (seen.has(current) === false) {
|
|
107211
|
+
seen.add(current);
|
|
107212
|
+
stack.push(...this.edges[current] || []);
|
|
107213
|
+
}
|
|
107214
|
+
}
|
|
107215
|
+
return false;
|
|
107216
|
+
}
|
|
107217
|
+
findTop(filename, path = new Set()) {
|
|
107043
107218
|
const ret = [];
|
|
107219
|
+
path.add(filename);
|
|
107044
107220
|
for (const to of this.edges[filename] || []) {
|
|
107045
|
-
|
|
107221
|
+
// an INCLUDE cycle, the file is already on the current path
|
|
107222
|
+
if (path.has(to)) {
|
|
107223
|
+
continue;
|
|
107224
|
+
}
|
|
107225
|
+
ret.push(...this.findTop(to, path));
|
|
107046
107226
|
}
|
|
107227
|
+
path.delete(filename);
|
|
107047
107228
|
if (ret.length === 0) {
|
|
107048
107229
|
const found = this.findVertexByFilename(filename);
|
|
107049
107230
|
if (found !== undefined) {
|
|
@@ -107098,6 +107279,7 @@ class IncludeGraph {
|
|
|
107098
107279
|
///////////////////////////////
|
|
107099
107280
|
build() {
|
|
107100
107281
|
this.addVertices();
|
|
107282
|
+
const included = [];
|
|
107101
107283
|
for (const o of getABAPObjects(this.reg)) {
|
|
107102
107284
|
for (const f of o.getABAPFiles()) {
|
|
107103
107285
|
if (f.getFilename().includes(".prog.screen_") || f.getFilename().includes(".fugr.screen_")) {
|
|
@@ -107128,11 +107310,19 @@ class IncludeGraph {
|
|
|
107128
107310
|
}
|
|
107129
107311
|
else {
|
|
107130
107312
|
this.graph.addEdge(found, f.getFilename());
|
|
107313
|
+
included.push({ file: f, statement: s, vertex: found, name });
|
|
107131
107314
|
}
|
|
107132
107315
|
}
|
|
107133
107316
|
}
|
|
107134
107317
|
}
|
|
107135
107318
|
}
|
|
107319
|
+
// cycles are not followed, but ABAP rejects them, so report them
|
|
107320
|
+
for (const i of included) {
|
|
107321
|
+
if (this.graph.isReachable(i.file.getFilename(), i.vertex.filename)) {
|
|
107322
|
+
const issue = issue_1.Issue.atStatement(i.file, i.statement, "Cyclic INCLUDE, " + i.name, new check_include_1.CheckInclude().getMetadata().key, this.severity);
|
|
107323
|
+
this.issues.push(issue);
|
|
107324
|
+
}
|
|
107325
|
+
}
|
|
107136
107326
|
}
|
|
107137
107327
|
addVertices() {
|
|
107138
107328
|
for (const o of getABAPObjects(this.reg)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.79",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.79",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|