@abaplint/cli 2.120.90 → 2.120.92
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 +296 -11
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -13538,9 +13538,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
13538
13538
|
exports.Data = void 0;
|
|
13539
13539
|
const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_statements/combi.js");
|
|
13540
13540
|
const expressions_1 = __webpack_require__(/*! ../expressions */ "../core/build/src/abap/2_statements/expressions/index.js");
|
|
13541
|
+
const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
13541
13542
|
class Data {
|
|
13542
13543
|
getMatcher() {
|
|
13543
|
-
|
|
13544
|
+
// unnamed field, only relevant inside DATA BEGIN OF
|
|
13545
|
+
const unnamed = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeft), (0, combi_1.tok)(tokens_1.ParenLeft)), expressions_1.Integer, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.ParenRight)));
|
|
13546
|
+
return (0, combi_1.seq)("DATA", (0, combi_1.altPrio)(expressions_1.DataDefinition, unnamed), (0, combi_1.optPrio)("%_PREDEFINED"));
|
|
13544
13547
|
}
|
|
13545
13548
|
}
|
|
13546
13549
|
exports.Data = Data;
|
|
@@ -24748,6 +24751,7 @@ class ABAPFileInformationParser {
|
|
|
24748
24751
|
}
|
|
24749
24752
|
parseAttributes(node, visibility) {
|
|
24750
24753
|
var _a;
|
|
24754
|
+
var _b;
|
|
24751
24755
|
if (node === undefined) {
|
|
24752
24756
|
return [];
|
|
24753
24757
|
}
|
|
@@ -24764,7 +24768,10 @@ class ABAPFileInformationParser {
|
|
|
24764
24768
|
}
|
|
24765
24769
|
}
|
|
24766
24770
|
for (const d of data) {
|
|
24767
|
-
const name = d.findFirstExpression(Expressions.DefinitionName).getFirstToken();
|
|
24771
|
+
const name = (_a = d.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
24772
|
+
if (name === undefined) {
|
|
24773
|
+
continue;
|
|
24774
|
+
}
|
|
24768
24775
|
ret.push({
|
|
24769
24776
|
name: name.getStr(),
|
|
24770
24777
|
identifier: new _identifier_1.Identifier(name, this.filename),
|
|
@@ -24778,7 +24785,7 @@ class ABAPFileInformationParser {
|
|
|
24778
24785
|
classData.push(structure.findDirectStatement(Statements.ClassDataBegin));
|
|
24779
24786
|
}
|
|
24780
24787
|
for (const d of classData) {
|
|
24781
|
-
const name = ((
|
|
24788
|
+
const name = ((_b = d.findFirstExpression(Expressions.DefinitionName)) !== null && _b !== void 0 ? _b : d.findDirectExpression(Expressions.NamespaceSimpleName)).getFirstToken();
|
|
24782
24789
|
ret.push({
|
|
24783
24790
|
name: name.getStr(),
|
|
24784
24791
|
identifier: new _identifier_1.Identifier(name, this.filename),
|
|
@@ -34757,6 +34764,8 @@ class NewObject {
|
|
|
34757
34764
|
}
|
|
34758
34765
|
}
|
|
34759
34766
|
else if (typeName === "#" && targetType) {
|
|
34767
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, targetType);
|
|
34768
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
|
|
34760
34769
|
ret = targetType;
|
|
34761
34770
|
}
|
|
34762
34771
|
else if (typeName === "#") {
|
|
@@ -49224,6 +49233,11 @@ class Data {
|
|
|
49224
49233
|
for (const c of node.getChildren()) {
|
|
49225
49234
|
const ctyp = c.get();
|
|
49226
49235
|
if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Data) {
|
|
49236
|
+
const unnamedLength = c.findDirectExpression(Expressions.Integer);
|
|
49237
|
+
if (unnamedLength && c.findDirectExpression(Expressions.DataDefinition) === undefined) {
|
|
49238
|
+
components.push({ name: "", type: new Basic.CharacterType(parseInt(unnamedLength.concatTokens(), 10)) });
|
|
49239
|
+
continue;
|
|
49240
|
+
}
|
|
49227
49241
|
const found = new data_1.Data().runSyntax(c, input);
|
|
49228
49242
|
if (found) {
|
|
49229
49243
|
components.push({ name: found.getName(), type: found.getType() });
|
|
@@ -53156,6 +53170,9 @@ class StructureType extends _abstract_type_1.AbstractType {
|
|
|
53156
53170
|
}
|
|
53157
53171
|
this.indexed = {};
|
|
53158
53172
|
for (const c of components) {
|
|
53173
|
+
if (c.name === "") {
|
|
53174
|
+
continue; // unnamed field, eg. "DATA: BEGIN OF str, (10), END OF str."
|
|
53175
|
+
}
|
|
53159
53176
|
const upper = c.name.toUpperCase();
|
|
53160
53177
|
if (this.indexed[upper] !== undefined) {
|
|
53161
53178
|
throw new Error("Structure, duplicate field name \"" + upper + "\", " + qualifiedName);
|
|
@@ -72777,7 +72794,7 @@ class Registry {
|
|
|
72777
72794
|
}
|
|
72778
72795
|
static abaplintVersion() {
|
|
72779
72796
|
// magic, see build script "version.js"
|
|
72780
|
-
return "2.120.
|
|
72797
|
+
return "2.120.92";
|
|
72781
72798
|
}
|
|
72782
72799
|
getDDICReferences() {
|
|
72783
72800
|
return this.ddicReferences;
|
|
@@ -75434,6 +75451,149 @@ exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
|
75434
75451
|
|
|
75435
75452
|
/***/ },
|
|
75436
75453
|
|
|
75454
|
+
/***/ "../core/build/src/rules/abapdoc_short_link.js"
|
|
75455
|
+
/*!*****************************************************!*\
|
|
75456
|
+
!*** ../core/build/src/rules/abapdoc_short_link.js ***!
|
|
75457
|
+
\*****************************************************/
|
|
75458
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75459
|
+
|
|
75460
|
+
"use strict";
|
|
75461
|
+
|
|
75462
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
75463
|
+
if (k2 === undefined) k2 = k;
|
|
75464
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
75465
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
75466
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
75467
|
+
}
|
|
75468
|
+
Object.defineProperty(o, k2, desc);
|
|
75469
|
+
}) : (function(o, m, k, k2) {
|
|
75470
|
+
if (k2 === undefined) k2 = k;
|
|
75471
|
+
o[k2] = m[k];
|
|
75472
|
+
}));
|
|
75473
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
75474
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
75475
|
+
}) : function(o, v) {
|
|
75476
|
+
o["default"] = v;
|
|
75477
|
+
});
|
|
75478
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
75479
|
+
var ownKeys = function(o) {
|
|
75480
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
75481
|
+
var ar = [];
|
|
75482
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
75483
|
+
return ar;
|
|
75484
|
+
};
|
|
75485
|
+
return ownKeys(o);
|
|
75486
|
+
};
|
|
75487
|
+
return function (mod) {
|
|
75488
|
+
if (mod && mod.__esModule) return mod;
|
|
75489
|
+
var result = {};
|
|
75490
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
75491
|
+
__setModuleDefault(result, mod);
|
|
75492
|
+
return result;
|
|
75493
|
+
};
|
|
75494
|
+
})();
|
|
75495
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75496
|
+
exports.AbapdocShortLink = exports.AbapdocShortLinkConf = void 0;
|
|
75497
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
75498
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
75499
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75500
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
75501
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75502
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
75503
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
75504
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
75505
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
75506
|
+
class AbapdocShortLinkConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75507
|
+
}
|
|
75508
|
+
exports.AbapdocShortLinkConf = AbapdocShortLinkConf;
|
|
75509
|
+
class AbapdocShortLink extends _abap_rule_1.ABAPRule {
|
|
75510
|
+
constructor() {
|
|
75511
|
+
super(...arguments);
|
|
75512
|
+
this.conf = new AbapdocShortLinkConf();
|
|
75513
|
+
}
|
|
75514
|
+
getMetadata() {
|
|
75515
|
+
return {
|
|
75516
|
+
key: "abapdoc_short_link",
|
|
75517
|
+
title: "Use short form of ABAP Doc links",
|
|
75518
|
+
shortDescription: `Reports ABAP Doc links to components of the current global class or interface which repeat the object name.`,
|
|
75519
|
+
extendedInformation: `Links to components of the same repository object can omit the object name and start with a period,
|
|
75520
|
+
{@link zif_foo.data:field} can be written as {@link .data:field}.
|
|
75521
|
+
|
|
75522
|
+
Only checks ABAP Doc inside the definition of the global class or interface.
|
|
75523
|
+
|
|
75524
|
+
https://github.com/SAP/abap-file-formats/issues/880`,
|
|
75525
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
75526
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
75527
|
+
"! Same as {@link zif_foo.data:bar}
|
|
75528
|
+
DATA foo TYPE string.
|
|
75529
|
+
DATA bar TYPE string.
|
|
75530
|
+
ENDINTERFACE.`,
|
|
75531
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
75532
|
+
"! Same as {@link .data:bar}
|
|
75533
|
+
DATA foo TYPE string.
|
|
75534
|
+
DATA bar TYPE string.
|
|
75535
|
+
ENDINTERFACE.`,
|
|
75536
|
+
};
|
|
75537
|
+
}
|
|
75538
|
+
getConfig() {
|
|
75539
|
+
return this.conf;
|
|
75540
|
+
}
|
|
75541
|
+
setConfig(conf) {
|
|
75542
|
+
this.conf = conf;
|
|
75543
|
+
}
|
|
75544
|
+
runParsed(file, obj) {
|
|
75545
|
+
var _a;
|
|
75546
|
+
const issues = [];
|
|
75547
|
+
const objectType = obj.getType();
|
|
75548
|
+
if (objectType !== "CLAS" && objectType !== "INTF") {
|
|
75549
|
+
return [];
|
|
75550
|
+
}
|
|
75551
|
+
const objectName = obj.getName().toLowerCase();
|
|
75552
|
+
let definition = false;
|
|
75553
|
+
for (const statement of file.getStatements()) {
|
|
75554
|
+
const type = statement.get();
|
|
75555
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
75556
|
+
const name = (_a = statement.findFirstExpression(Expressions.ClassName)) !== null && _a !== void 0 ? _a : statement.findFirstExpression(Expressions.InterfaceName);
|
|
75557
|
+
definition = (name === null || name === void 0 ? void 0 : name.getFirstToken().getStr().toLowerCase()) === objectName;
|
|
75558
|
+
continue;
|
|
75559
|
+
}
|
|
75560
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
75561
|
+
definition = false;
|
|
75562
|
+
continue;
|
|
75563
|
+
}
|
|
75564
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
75565
|
+
continue;
|
|
75566
|
+
}
|
|
75567
|
+
const token = statement.getFirstToken();
|
|
75568
|
+
const str = token.getStr();
|
|
75569
|
+
if (str.startsWith(`"!`) === false) {
|
|
75570
|
+
continue;
|
|
75571
|
+
}
|
|
75572
|
+
const regex = /\{@link\s+((?:(\w+):)?([\w/]+))\./gi;
|
|
75573
|
+
let match;
|
|
75574
|
+
while ((match = regex.exec(str)) !== null) {
|
|
75575
|
+
const kind = match[2];
|
|
75576
|
+
if (match[3].toLowerCase() !== objectName
|
|
75577
|
+
|| (kind !== undefined && kind.toLowerCase() !== objectType.toLowerCase())) {
|
|
75578
|
+
continue;
|
|
75579
|
+
}
|
|
75580
|
+
const row = token.getStart().getRow();
|
|
75581
|
+
const col = token.getStart().getCol() + match.index + match[0].length - 1 - match[1].length;
|
|
75582
|
+
const start = new position_1.Position(row, col);
|
|
75583
|
+
const end = new position_1.Position(row, col + match[1].length);
|
|
75584
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);
|
|
75585
|
+
const message = `Use short form of ABAP Doc link, remove "${match[1]}"`;
|
|
75586
|
+
issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));
|
|
75587
|
+
}
|
|
75588
|
+
}
|
|
75589
|
+
return issues;
|
|
75590
|
+
}
|
|
75591
|
+
}
|
|
75592
|
+
exports.AbapdocShortLink = AbapdocShortLink;
|
|
75593
|
+
//# sourceMappingURL=abapdoc_short_link.js.map
|
|
75594
|
+
|
|
75595
|
+
/***/ },
|
|
75596
|
+
|
|
75437
75597
|
/***/ "../core/build/src/rules/abapdoc_shorttext_length.js"
|
|
75438
75598
|
/*!***********************************************************!*\
|
|
75439
75599
|
!*** ../core/build/src/rules/abapdoc_shorttext_length.js ***!
|
|
@@ -87615,12 +87775,9 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87615
87775
|
}
|
|
87616
87776
|
}
|
|
87617
87777
|
/** NEW into a data reference creates data, CREATE OBJECT cannot: "target = NEW #|type( [value] )"
|
|
87618
|
-
* with a
|
|
87778
|
+
* with a target typed REF TO a data type becomes CREATE DATA plus the assignment of the value */
|
|
87619
87779
|
newDataReference(high, target, found, lowFile, highSyntax) {
|
|
87620
87780
|
var _a, _b, _c;
|
|
87621
|
-
if (target.getChildren().length !== 1 || !(((_a = target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.TargetField)) {
|
|
87622
|
-
return undefined;
|
|
87623
|
-
}
|
|
87624
87781
|
const children = found.getChildren();
|
|
87625
87782
|
const value = found.findDirectExpression(Expressions.Source);
|
|
87626
87783
|
// NEW, the type, "(", optionally one value, ")"
|
|
@@ -87628,12 +87785,23 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87628
87785
|
return undefined;
|
|
87629
87786
|
}
|
|
87630
87787
|
const name = target.concatTokens();
|
|
87788
|
+
const typeExpr = found.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
87789
|
+
const typeName = typeExpr === null || typeExpr === void 0 ? void 0 : typeExpr.concatTokens();
|
|
87631
87790
|
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
87632
|
-
|
|
87791
|
+
let type = undefined;
|
|
87792
|
+
if (typeName === "#") {
|
|
87793
|
+
// the type of the target, as inferred by the syntax check
|
|
87794
|
+
const typeToken = typeExpr.getFirstToken();
|
|
87795
|
+
const resolved = (_a = spag === null || spag === void 0 ? void 0 : spag.getData().references.find(r => r.referenceType === _reference_1.ReferenceType.InferredType
|
|
87796
|
+
&& r.position.getStart().equals(typeToken.getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
|
|
87797
|
+
type = resolved instanceof _typed_identifier_1.TypedIdentifier ? resolved.getType() : undefined;
|
|
87798
|
+
}
|
|
87799
|
+
else if (target.getChildren().length === 1 && ((_b = target.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.TargetField) {
|
|
87800
|
+
type = (_c = spag === null || spag === void 0 ? void 0 : spag.findVariable(name)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
87801
|
+
}
|
|
87633
87802
|
if (!(type instanceof basic_1.DataReference)) {
|
|
87634
87803
|
return undefined;
|
|
87635
87804
|
}
|
|
87636
|
-
const typeName = (_c = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
87637
87805
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
87638
87806
|
let abap = `CREATE DATA ${name}` + (typeName === "#" ? "" : ` TYPE ${typeName}`) + ".";
|
|
87639
87807
|
if (value === undefined) {
|
|
@@ -87681,7 +87849,7 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87681
87849
|
}
|
|
87682
87850
|
}
|
|
87683
87851
|
else {
|
|
87684
|
-
|
|
87852
|
+
return undefined; // not an object, CREATE OBJECT does not apply
|
|
87685
87853
|
}
|
|
87686
87854
|
}
|
|
87687
87855
|
if (cdef && cdef.getMethodDefinitions === undefined) {
|
|
@@ -89188,6 +89356,121 @@ exports.ForbiddenIdentifier = ForbiddenIdentifier;
|
|
|
89188
89356
|
|
|
89189
89357
|
/***/ },
|
|
89190
89358
|
|
|
89359
|
+
/***/ "../core/build/src/rules/forbidden_kernel_write.js"
|
|
89360
|
+
/*!*********************************************************!*\
|
|
89361
|
+
!*** ../core/build/src/rules/forbidden_kernel_write.js ***!
|
|
89362
|
+
\*********************************************************/
|
|
89363
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
89364
|
+
|
|
89365
|
+
"use strict";
|
|
89366
|
+
|
|
89367
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
89368
|
+
if (k2 === undefined) k2 = k;
|
|
89369
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
89370
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
89371
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
89372
|
+
}
|
|
89373
|
+
Object.defineProperty(o, k2, desc);
|
|
89374
|
+
}) : (function(o, m, k, k2) {
|
|
89375
|
+
if (k2 === undefined) k2 = k;
|
|
89376
|
+
o[k2] = m[k];
|
|
89377
|
+
}));
|
|
89378
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
89379
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
89380
|
+
}) : function(o, v) {
|
|
89381
|
+
o["default"] = v;
|
|
89382
|
+
});
|
|
89383
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
89384
|
+
var ownKeys = function(o) {
|
|
89385
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
89386
|
+
var ar = [];
|
|
89387
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
89388
|
+
return ar;
|
|
89389
|
+
};
|
|
89390
|
+
return ownKeys(o);
|
|
89391
|
+
};
|
|
89392
|
+
return function (mod) {
|
|
89393
|
+
if (mod && mod.__esModule) return mod;
|
|
89394
|
+
var result = {};
|
|
89395
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
89396
|
+
__setModuleDefault(result, mod);
|
|
89397
|
+
return result;
|
|
89398
|
+
};
|
|
89399
|
+
})();
|
|
89400
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89401
|
+
exports.ForbiddenKernelWrite = exports.ForbiddenKernelWriteConf = void 0;
|
|
89402
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
89403
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
89404
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
89405
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
89406
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
89407
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
89408
|
+
class ForbiddenKernelWriteConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
89409
|
+
constructor() {
|
|
89410
|
+
super(...arguments);
|
|
89411
|
+
/** Objects allowed to use WRITE '@KERNEL', array of string regex matched against the object name.
|
|
89412
|
+
* Empty, the default, allows every object
|
|
89413
|
+
* @uniqueItems true
|
|
89414
|
+
*/
|
|
89415
|
+
this.allow = [];
|
|
89416
|
+
}
|
|
89417
|
+
}
|
|
89418
|
+
exports.ForbiddenKernelWriteConf = ForbiddenKernelWriteConf;
|
|
89419
|
+
class ForbiddenKernelWrite extends _abap_rule_1.ABAPRule {
|
|
89420
|
+
constructor() {
|
|
89421
|
+
super(...arguments);
|
|
89422
|
+
this.conf = new ForbiddenKernelWriteConf();
|
|
89423
|
+
this.allow = [];
|
|
89424
|
+
}
|
|
89425
|
+
getMetadata() {
|
|
89426
|
+
return {
|
|
89427
|
+
key: "forbidden_kernel_write",
|
|
89428
|
+
title: "Forbidden kernel WRITE",
|
|
89429
|
+
shortDescription: `Forbid WRITE '@KERNEL' outside the listed objects`,
|
|
89430
|
+
extendedInformation: `The transpiler emits the literal of WRITE '@KERNEL ...' as raw JavaScript,
|
|
89431
|
+
which runs with the privileges of the host. Open-abap uses this for its kernel classes, code compiled by a host it did not write should not.
|
|
89432
|
+
|
|
89433
|
+
allow is a list of regex, case insensitive, matched against the object name, eg. ["^CL_", "^KERNEL_"].
|
|
89434
|
+
An empty list, the default, allows every object. To forbid WRITE '@KERNEL' everywhere use a regex matching no name, eg. ["^$"].`,
|
|
89435
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
89436
|
+
badExample: `WRITE '@KERNEL process.exit(1);'.`,
|
|
89437
|
+
};
|
|
89438
|
+
}
|
|
89439
|
+
getConfig() {
|
|
89440
|
+
return this.conf;
|
|
89441
|
+
}
|
|
89442
|
+
setConfig(conf) {
|
|
89443
|
+
this.conf = conf;
|
|
89444
|
+
if (this.conf.allow === undefined) {
|
|
89445
|
+
this.conf.allow = [];
|
|
89446
|
+
}
|
|
89447
|
+
this.allow = this.conf.allow.map(a => new RegExp(a, "i"));
|
|
89448
|
+
}
|
|
89449
|
+
runParsed(file, obj) {
|
|
89450
|
+
var _a;
|
|
89451
|
+
if (this.allow.length === 0 || this.allow.some(a => a.test(obj.getName()))) {
|
|
89452
|
+
return [];
|
|
89453
|
+
}
|
|
89454
|
+
const ret = [];
|
|
89455
|
+
for (const s of file.getStatements()) {
|
|
89456
|
+
if (!(s.get() instanceof Statements.Write)) {
|
|
89457
|
+
continue;
|
|
89458
|
+
}
|
|
89459
|
+
// same check as the transpiler, statements/write.ts
|
|
89460
|
+
const source = (_a = s.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
89461
|
+
if ((source === null || source === void 0 ? void 0 : source.startsWith("'@KERNEL ")) === true) {
|
|
89462
|
+
const message = "WRITE '@KERNEL' not allowed in " + obj.getName();
|
|
89463
|
+
ret.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.conf.severity));
|
|
89464
|
+
}
|
|
89465
|
+
}
|
|
89466
|
+
return ret;
|
|
89467
|
+
}
|
|
89468
|
+
}
|
|
89469
|
+
exports.ForbiddenKernelWrite = ForbiddenKernelWrite;
|
|
89470
|
+
//# sourceMappingURL=forbidden_kernel_write.js.map
|
|
89471
|
+
|
|
89472
|
+
/***/ },
|
|
89473
|
+
|
|
89191
89474
|
/***/ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"
|
|
89192
89475
|
/*!**************************************************************!*\
|
|
89193
89476
|
!*** ../core/build/src/rules/forbidden_pseudo_and_pragma.js ***!
|
|
@@ -92084,6 +92367,7 @@ __exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapd
|
|
|
92084
92367
|
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
92085
92368
|
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
92086
92369
|
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
92370
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_short_link */ "../core/build/src/rules/abapdoc_short_link.js"), exports);
|
|
92087
92371
|
__exportStar(__webpack_require__(/*! ./abapdoc_shorttext_length */ "../core/build/src/rules/abapdoc_shorttext_length.js"), exports);
|
|
92088
92372
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
|
|
92089
92373
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
|
|
@@ -92158,6 +92442,7 @@ __exportStar(__webpack_require__(/*! ./exporting */ "../core/build/src/rules/exp
|
|
|
92158
92442
|
__exportStar(__webpack_require__(/*! ./final_newline */ "../core/build/src/rules/final_newline.js"), exports);
|
|
92159
92443
|
__exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "../core/build/src/rules/fm_global_parameters_obsolete.js"), exports);
|
|
92160
92444
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "../core/build/src/rules/forbidden_identifier.js"), exports);
|
|
92445
|
+
__exportStar(__webpack_require__(/*! ./forbidden_kernel_write */ "../core/build/src/rules/forbidden_kernel_write.js"), exports);
|
|
92161
92446
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
92162
92447
|
__exportStar(__webpack_require__(/*! ./forbidden_void_type */ "../core/build/src/rules/forbidden_void_type.js"), exports);
|
|
92163
92448
|
__exportStar(__webpack_require__(/*! ./form_tables_obsolete */ "../core/build/src/rules/form_tables_obsolete.js"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.92",
|
|
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.92",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|