@abaplint/cli 2.120.89 → 2.120.91
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 +364 -13
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -32152,6 +32152,7 @@ class FieldChain {
|
|
|
32152
32152
|
const children = node.getChildren();
|
|
32153
32153
|
context = this.findTop(children[0], input, refType);
|
|
32154
32154
|
let prev = children[0].concatTokens();
|
|
32155
|
+
let afterTableExpression = false;
|
|
32155
32156
|
for (let i = 1; i < children.length; i++) {
|
|
32156
32157
|
const current = children[i];
|
|
32157
32158
|
if (current === undefined) {
|
|
@@ -32199,6 +32200,9 @@ class FieldChain {
|
|
|
32199
32200
|
}
|
|
32200
32201
|
}
|
|
32201
32202
|
else if (current.get() instanceof tokens_1.InstanceArrow) {
|
|
32203
|
+
if (afterTableExpression && table_expression_1.TableExpression.checkArrowAfter(input, current.getFirstToken())) {
|
|
32204
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32205
|
+
}
|
|
32202
32206
|
if (!(context instanceof basic_1.ObjectReferenceType)
|
|
32203
32207
|
&& !(context instanceof basic_1.DataReference)
|
|
32204
32208
|
&& !(context instanceof basic_1.VoidType)) {
|
|
@@ -32231,6 +32235,7 @@ class FieldChain {
|
|
|
32231
32235
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32232
32236
|
}
|
|
32233
32237
|
table_expression_1.TableExpression.runSyntax(current, input, context);
|
|
32238
|
+
afterTableExpression = true;
|
|
32234
32239
|
if (!(context instanceof basic_1.VoidType) && !(context instanceof basic_1.UnknownType)) {
|
|
32235
32240
|
context = context.getRowType();
|
|
32236
32241
|
}
|
|
@@ -33586,6 +33591,7 @@ const method_call_param_1 = __webpack_require__(/*! ./method_call_param */ "../c
|
|
|
33586
33591
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
33587
33592
|
const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
|
|
33588
33593
|
const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
|
|
33594
|
+
const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
|
|
33589
33595
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
33590
33596
|
class MethodCallChain {
|
|
33591
33597
|
static runSyntax(node, input, targetType) {
|
|
@@ -33598,6 +33604,13 @@ class MethodCallChain {
|
|
|
33598
33604
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
33599
33605
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33600
33606
|
}
|
|
33607
|
+
// the field chain is followed by "->", eg. "itab[ 1 ]-ref->meth( )"
|
|
33608
|
+
if (first instanceof nodes_1.ExpressionNode
|
|
33609
|
+
&& first.get() instanceof Expressions.FieldChain
|
|
33610
|
+
&& first.findDirectExpression(Expressions.TableExpression) !== undefined
|
|
33611
|
+
&& table_expression_1.TableExpression.checkArrowAfter(input, children[1].getFirstToken())) {
|
|
33612
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33613
|
+
}
|
|
33601
33614
|
let currentIndex = 1;
|
|
33602
33615
|
let context = this.findTop(first, input, targetType);
|
|
33603
33616
|
if (first.get() instanceof Expressions.MethodCall) {
|
|
@@ -34744,6 +34757,8 @@ class NewObject {
|
|
|
34744
34757
|
}
|
|
34745
34758
|
}
|
|
34746
34759
|
else if (typeName === "#" && targetType) {
|
|
34760
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, targetType);
|
|
34761
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
|
|
34747
34762
|
ret = targetType;
|
|
34748
34763
|
}
|
|
34749
34764
|
else if (typeName === "#") {
|
|
@@ -37007,9 +37022,23 @@ exports.TableExpression = void 0;
|
|
|
37007
37022
|
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
37008
37023
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
37009
37024
|
const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
|
|
37025
|
+
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
37010
37026
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
37011
37027
|
const component_chain_1 = __webpack_require__(/*! ./component_chain */ "../core/build/src/abap/5_syntax/expressions/component_chain.js");
|
|
37028
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
|
|
37012
37029
|
class TableExpression {
|
|
37030
|
+
/** below v750 the object component selector "->" cannot follow a table expression, eg. "itab[ 1 ]-ref->meth( )",
|
|
37031
|
+
* returns true and adds an issue if not allowed */
|
|
37032
|
+
static checkArrowAfter(input, arrow) {
|
|
37033
|
+
if ((0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v750)
|
|
37034
|
+
|| input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
|
|
37035
|
+
|| input.scope.getOpenABAP()) {
|
|
37036
|
+
return false;
|
|
37037
|
+
}
|
|
37038
|
+
const message = "Object component selector \"->\" after table expression not possible below v750";
|
|
37039
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, arrow, message));
|
|
37040
|
+
return true;
|
|
37041
|
+
}
|
|
37013
37042
|
static runSyntax(node, input, rowType) {
|
|
37014
37043
|
if (node === undefined) {
|
|
37015
37044
|
return;
|
|
@@ -37126,6 +37155,7 @@ class Target {
|
|
|
37126
37155
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
37127
37156
|
}
|
|
37128
37157
|
let currentIndex = 1;
|
|
37158
|
+
let afterTableExpression = false;
|
|
37129
37159
|
while (currentIndex <= children.length) {
|
|
37130
37160
|
const current = children[currentIndex];
|
|
37131
37161
|
if (current === undefined) {
|
|
@@ -37151,6 +37181,9 @@ class Target {
|
|
|
37151
37181
|
}
|
|
37152
37182
|
}
|
|
37153
37183
|
else if (current.get() instanceof tokens_1.InstanceArrow) {
|
|
37184
|
+
if (afterTableExpression && table_expression_1.TableExpression.checkArrowAfter(input, current.getFirstToken())) {
|
|
37185
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
37186
|
+
}
|
|
37154
37187
|
if (!(context instanceof basic_1.ObjectReferenceType)
|
|
37155
37188
|
&& !(context instanceof basic_1.DataReference)
|
|
37156
37189
|
&& !(context instanceof basic_1.VoidType)) {
|
|
@@ -37199,6 +37232,7 @@ class Target {
|
|
|
37199
37232
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
37200
37233
|
}
|
|
37201
37234
|
table_expression_1.TableExpression.runSyntax(current, input, context);
|
|
37235
|
+
afterTableExpression = true;
|
|
37202
37236
|
if (!(context instanceof basic_1.VoidType) && !(context instanceof unknown_type_1.UnknownType)) {
|
|
37203
37237
|
context = context.getRowType();
|
|
37204
37238
|
}
|
|
@@ -65381,8 +65415,12 @@ exports.DataControl = DataControl;
|
|
|
65381
65415
|
|
|
65382
65416
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
65383
65417
|
exports.DataDefinition = void 0;
|
|
65418
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
65419
|
+
const combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
|
|
65384
65420
|
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
65385
65421
|
const cds_determine_types_1 = __webpack_require__(/*! ../cds/cds_determine_types */ "../core/build/src/cds/cds_determine_types.js");
|
|
65422
|
+
const cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ "../core/build/src/cds/cds_lexer.js");
|
|
65423
|
+
const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
|
|
65386
65424
|
const cds_parser_1 = __webpack_require__(/*! ../cds/cds_parser */ "../core/build/src/cds/cds_parser.js");
|
|
65387
65425
|
const expressions_1 = __webpack_require__(/*! ../cds/expressions */ "../core/build/src/cds/expressions/index.js");
|
|
65388
65426
|
const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "../core/build/src/objects/_abstract_object.js");
|
|
@@ -65474,8 +65512,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
65474
65512
|
associations: [],
|
|
65475
65513
|
tree: undefined,
|
|
65476
65514
|
};
|
|
65477
|
-
this.findSQLViewName();
|
|
65478
65515
|
this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
|
|
65516
|
+
this.findSQLViewName(this.parsedData.tree);
|
|
65479
65517
|
if (this.parsedData.tree) {
|
|
65480
65518
|
for (const c of ((_a = this.parsedData.tree) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {
|
|
65481
65519
|
if (c.get() instanceof expressions_1.CDSAnnotation) {
|
|
@@ -65500,11 +65538,30 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
65500
65538
|
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
|
|
65501
65539
|
}
|
|
65502
65540
|
//////////
|
|
65503
|
-
findSQLViewName() {
|
|
65541
|
+
findSQLViewName(tree) {
|
|
65504
65542
|
var _a;
|
|
65505
|
-
|
|
65506
|
-
if (
|
|
65507
|
-
|
|
65543
|
+
let annotations = tree === null || tree === void 0 ? void 0 : tree.findDirectExpressions(expressions_1.CDSAnnotation);
|
|
65544
|
+
if (annotations === undefined) {
|
|
65545
|
+
const file = this.findSourceFile();
|
|
65546
|
+
if (file === undefined) {
|
|
65547
|
+
return;
|
|
65548
|
+
}
|
|
65549
|
+
// Keep SQL view lookup available even when the view body cannot be parsed.
|
|
65550
|
+
const tokens = cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment));
|
|
65551
|
+
const leadingAnnotations = (0, combi_1.seq)((0, combi_1.starPrio)(expressions_1.CDSAnnotation), (0, combi_1.starPrio)((0, combi_1.regex)(/.*/)));
|
|
65552
|
+
annotations = (_a = combi_1.Combi.run(leadingAnnotations, tokens, version_1.defaultRelease)) === null || _a === void 0 ? void 0 : _a.filter((n) => n instanceof nodes_1.ExpressionNode && n.get() instanceof expressions_1.CDSAnnotation);
|
|
65553
|
+
}
|
|
65554
|
+
for (const annotation of annotations || []) {
|
|
65555
|
+
const tokens = annotation.getTokens().map(t => t.getStr());
|
|
65556
|
+
const colon = tokens.indexOf(":");
|
|
65557
|
+
if (tokens.slice(0, colon).join("") !== "@AbapCatalog.sqlViewName") {
|
|
65558
|
+
continue;
|
|
65559
|
+
}
|
|
65560
|
+
const match = tokens.slice(colon + 1).join(" ").match(/^'([\w/]+)'$/);
|
|
65561
|
+
if (match) {
|
|
65562
|
+
this.parsedData.sqlViewName = match[1].toUpperCase();
|
|
65563
|
+
return;
|
|
65564
|
+
}
|
|
65508
65565
|
}
|
|
65509
65566
|
}
|
|
65510
65567
|
findDescription() {
|
|
@@ -72722,7 +72779,7 @@ class Registry {
|
|
|
72722
72779
|
}
|
|
72723
72780
|
static abaplintVersion() {
|
|
72724
72781
|
// magic, see build script "version.js"
|
|
72725
|
-
return "2.120.
|
|
72782
|
+
return "2.120.91";
|
|
72726
72783
|
}
|
|
72727
72784
|
getDDICReferences() {
|
|
72728
72785
|
return this.ddicReferences;
|
|
@@ -75379,6 +75436,149 @@ exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
|
75379
75436
|
|
|
75380
75437
|
/***/ },
|
|
75381
75438
|
|
|
75439
|
+
/***/ "../core/build/src/rules/abapdoc_short_link.js"
|
|
75440
|
+
/*!*****************************************************!*\
|
|
75441
|
+
!*** ../core/build/src/rules/abapdoc_short_link.js ***!
|
|
75442
|
+
\*****************************************************/
|
|
75443
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75444
|
+
|
|
75445
|
+
"use strict";
|
|
75446
|
+
|
|
75447
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
75448
|
+
if (k2 === undefined) k2 = k;
|
|
75449
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
75450
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
75451
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
75452
|
+
}
|
|
75453
|
+
Object.defineProperty(o, k2, desc);
|
|
75454
|
+
}) : (function(o, m, k, k2) {
|
|
75455
|
+
if (k2 === undefined) k2 = k;
|
|
75456
|
+
o[k2] = m[k];
|
|
75457
|
+
}));
|
|
75458
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
75459
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
75460
|
+
}) : function(o, v) {
|
|
75461
|
+
o["default"] = v;
|
|
75462
|
+
});
|
|
75463
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
75464
|
+
var ownKeys = function(o) {
|
|
75465
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
75466
|
+
var ar = [];
|
|
75467
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
75468
|
+
return ar;
|
|
75469
|
+
};
|
|
75470
|
+
return ownKeys(o);
|
|
75471
|
+
};
|
|
75472
|
+
return function (mod) {
|
|
75473
|
+
if (mod && mod.__esModule) return mod;
|
|
75474
|
+
var result = {};
|
|
75475
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
75476
|
+
__setModuleDefault(result, mod);
|
|
75477
|
+
return result;
|
|
75478
|
+
};
|
|
75479
|
+
})();
|
|
75480
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75481
|
+
exports.AbapdocShortLink = exports.AbapdocShortLinkConf = void 0;
|
|
75482
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
75483
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
75484
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75485
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
75486
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75487
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
75488
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
75489
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
75490
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
75491
|
+
class AbapdocShortLinkConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75492
|
+
}
|
|
75493
|
+
exports.AbapdocShortLinkConf = AbapdocShortLinkConf;
|
|
75494
|
+
class AbapdocShortLink extends _abap_rule_1.ABAPRule {
|
|
75495
|
+
constructor() {
|
|
75496
|
+
super(...arguments);
|
|
75497
|
+
this.conf = new AbapdocShortLinkConf();
|
|
75498
|
+
}
|
|
75499
|
+
getMetadata() {
|
|
75500
|
+
return {
|
|
75501
|
+
key: "abapdoc_short_link",
|
|
75502
|
+
title: "Use short form of ABAP Doc links",
|
|
75503
|
+
shortDescription: `Reports ABAP Doc links to components of the current global class or interface which repeat the object name.`,
|
|
75504
|
+
extendedInformation: `Links to components of the same repository object can omit the object name and start with a period,
|
|
75505
|
+
{@link zif_foo.data:field} can be written as {@link .data:field}.
|
|
75506
|
+
|
|
75507
|
+
Only checks ABAP Doc inside the definition of the global class or interface.
|
|
75508
|
+
|
|
75509
|
+
https://github.com/SAP/abap-file-formats/issues/880`,
|
|
75510
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
75511
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
75512
|
+
"! Same as {@link zif_foo.data:bar}
|
|
75513
|
+
DATA foo TYPE string.
|
|
75514
|
+
DATA bar TYPE string.
|
|
75515
|
+
ENDINTERFACE.`,
|
|
75516
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
75517
|
+
"! Same as {@link .data:bar}
|
|
75518
|
+
DATA foo TYPE string.
|
|
75519
|
+
DATA bar TYPE string.
|
|
75520
|
+
ENDINTERFACE.`,
|
|
75521
|
+
};
|
|
75522
|
+
}
|
|
75523
|
+
getConfig() {
|
|
75524
|
+
return this.conf;
|
|
75525
|
+
}
|
|
75526
|
+
setConfig(conf) {
|
|
75527
|
+
this.conf = conf;
|
|
75528
|
+
}
|
|
75529
|
+
runParsed(file, obj) {
|
|
75530
|
+
var _a;
|
|
75531
|
+
const issues = [];
|
|
75532
|
+
const objectType = obj.getType();
|
|
75533
|
+
if (objectType !== "CLAS" && objectType !== "INTF") {
|
|
75534
|
+
return [];
|
|
75535
|
+
}
|
|
75536
|
+
const objectName = obj.getName().toLowerCase();
|
|
75537
|
+
let definition = false;
|
|
75538
|
+
for (const statement of file.getStatements()) {
|
|
75539
|
+
const type = statement.get();
|
|
75540
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
75541
|
+
const name = (_a = statement.findFirstExpression(Expressions.ClassName)) !== null && _a !== void 0 ? _a : statement.findFirstExpression(Expressions.InterfaceName);
|
|
75542
|
+
definition = (name === null || name === void 0 ? void 0 : name.getFirstToken().getStr().toLowerCase()) === objectName;
|
|
75543
|
+
continue;
|
|
75544
|
+
}
|
|
75545
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
75546
|
+
definition = false;
|
|
75547
|
+
continue;
|
|
75548
|
+
}
|
|
75549
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
75550
|
+
continue;
|
|
75551
|
+
}
|
|
75552
|
+
const token = statement.getFirstToken();
|
|
75553
|
+
const str = token.getStr();
|
|
75554
|
+
if (str.startsWith(`"!`) === false) {
|
|
75555
|
+
continue;
|
|
75556
|
+
}
|
|
75557
|
+
const regex = /\{@link\s+((?:(\w+):)?([\w/]+))\./gi;
|
|
75558
|
+
let match;
|
|
75559
|
+
while ((match = regex.exec(str)) !== null) {
|
|
75560
|
+
const kind = match[2];
|
|
75561
|
+
if (match[3].toLowerCase() !== objectName
|
|
75562
|
+
|| (kind !== undefined && kind.toLowerCase() !== objectType.toLowerCase())) {
|
|
75563
|
+
continue;
|
|
75564
|
+
}
|
|
75565
|
+
const row = token.getStart().getRow();
|
|
75566
|
+
const col = token.getStart().getCol() + match.index + match[0].length - 1 - match[1].length;
|
|
75567
|
+
const start = new position_1.Position(row, col);
|
|
75568
|
+
const end = new position_1.Position(row, col + match[1].length);
|
|
75569
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);
|
|
75570
|
+
const message = `Use short form of ABAP Doc link, remove "${match[1]}"`;
|
|
75571
|
+
issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));
|
|
75572
|
+
}
|
|
75573
|
+
}
|
|
75574
|
+
return issues;
|
|
75575
|
+
}
|
|
75576
|
+
}
|
|
75577
|
+
exports.AbapdocShortLink = AbapdocShortLink;
|
|
75578
|
+
//# sourceMappingURL=abapdoc_short_link.js.map
|
|
75579
|
+
|
|
75580
|
+
/***/ },
|
|
75581
|
+
|
|
75382
75582
|
/***/ "../core/build/src/rules/abapdoc_shorttext_length.js"
|
|
75383
75583
|
/*!***********************************************************!*\
|
|
75384
75584
|
!*** ../core/build/src/rules/abapdoc_shorttext_length.js ***!
|
|
@@ -87560,12 +87760,9 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87560
87760
|
}
|
|
87561
87761
|
}
|
|
87562
87762
|
/** NEW into a data reference creates data, CREATE OBJECT cannot: "target = NEW #|type( [value] )"
|
|
87563
|
-
* with a
|
|
87763
|
+
* with a target typed REF TO a data type becomes CREATE DATA plus the assignment of the value */
|
|
87564
87764
|
newDataReference(high, target, found, lowFile, highSyntax) {
|
|
87565
87765
|
var _a, _b, _c;
|
|
87566
|
-
if (target.getChildren().length !== 1 || !(((_a = target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.TargetField)) {
|
|
87567
|
-
return undefined;
|
|
87568
|
-
}
|
|
87569
87766
|
const children = found.getChildren();
|
|
87570
87767
|
const value = found.findDirectExpression(Expressions.Source);
|
|
87571
87768
|
// NEW, the type, "(", optionally one value, ")"
|
|
@@ -87573,12 +87770,23 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87573
87770
|
return undefined;
|
|
87574
87771
|
}
|
|
87575
87772
|
const name = target.concatTokens();
|
|
87773
|
+
const typeExpr = found.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
87774
|
+
const typeName = typeExpr === null || typeExpr === void 0 ? void 0 : typeExpr.concatTokens();
|
|
87576
87775
|
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
87577
|
-
|
|
87776
|
+
let type = undefined;
|
|
87777
|
+
if (typeName === "#") {
|
|
87778
|
+
// the type of the target, as inferred by the syntax check
|
|
87779
|
+
const typeToken = typeExpr.getFirstToken();
|
|
87780
|
+
const resolved = (_a = spag === null || spag === void 0 ? void 0 : spag.getData().references.find(r => r.referenceType === _reference_1.ReferenceType.InferredType
|
|
87781
|
+
&& r.position.getStart().equals(typeToken.getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
|
|
87782
|
+
type = resolved instanceof _typed_identifier_1.TypedIdentifier ? resolved.getType() : undefined;
|
|
87783
|
+
}
|
|
87784
|
+
else if (target.getChildren().length === 1 && ((_b = target.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.TargetField) {
|
|
87785
|
+
type = (_c = spag === null || spag === void 0 ? void 0 : spag.findVariable(name)) === null || _c === void 0 ? void 0 : _c.getType();
|
|
87786
|
+
}
|
|
87578
87787
|
if (!(type instanceof basic_1.DataReference)) {
|
|
87579
87788
|
return undefined;
|
|
87580
87789
|
}
|
|
87581
|
-
const typeName = (_c = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
87582
87790
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
87583
87791
|
let abap = `CREATE DATA ${name}` + (typeName === "#" ? "" : ` TYPE ${typeName}`) + ".";
|
|
87584
87792
|
if (value === undefined) {
|
|
@@ -87626,7 +87834,7 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87626
87834
|
}
|
|
87627
87835
|
}
|
|
87628
87836
|
else {
|
|
87629
|
-
|
|
87837
|
+
return undefined; // not an object, CREATE OBJECT does not apply
|
|
87630
87838
|
}
|
|
87631
87839
|
}
|
|
87632
87840
|
if (cdef && cdef.getMethodDefinitions === undefined) {
|
|
@@ -89133,6 +89341,121 @@ exports.ForbiddenIdentifier = ForbiddenIdentifier;
|
|
|
89133
89341
|
|
|
89134
89342
|
/***/ },
|
|
89135
89343
|
|
|
89344
|
+
/***/ "../core/build/src/rules/forbidden_kernel_write.js"
|
|
89345
|
+
/*!*********************************************************!*\
|
|
89346
|
+
!*** ../core/build/src/rules/forbidden_kernel_write.js ***!
|
|
89347
|
+
\*********************************************************/
|
|
89348
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
89349
|
+
|
|
89350
|
+
"use strict";
|
|
89351
|
+
|
|
89352
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
89353
|
+
if (k2 === undefined) k2 = k;
|
|
89354
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
89355
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
89356
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
89357
|
+
}
|
|
89358
|
+
Object.defineProperty(o, k2, desc);
|
|
89359
|
+
}) : (function(o, m, k, k2) {
|
|
89360
|
+
if (k2 === undefined) k2 = k;
|
|
89361
|
+
o[k2] = m[k];
|
|
89362
|
+
}));
|
|
89363
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
89364
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
89365
|
+
}) : function(o, v) {
|
|
89366
|
+
o["default"] = v;
|
|
89367
|
+
});
|
|
89368
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
89369
|
+
var ownKeys = function(o) {
|
|
89370
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
89371
|
+
var ar = [];
|
|
89372
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
89373
|
+
return ar;
|
|
89374
|
+
};
|
|
89375
|
+
return ownKeys(o);
|
|
89376
|
+
};
|
|
89377
|
+
return function (mod) {
|
|
89378
|
+
if (mod && mod.__esModule) return mod;
|
|
89379
|
+
var result = {};
|
|
89380
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
89381
|
+
__setModuleDefault(result, mod);
|
|
89382
|
+
return result;
|
|
89383
|
+
};
|
|
89384
|
+
})();
|
|
89385
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89386
|
+
exports.ForbiddenKernelWrite = exports.ForbiddenKernelWriteConf = void 0;
|
|
89387
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
89388
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
89389
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
89390
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
89391
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
89392
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
89393
|
+
class ForbiddenKernelWriteConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
89394
|
+
constructor() {
|
|
89395
|
+
super(...arguments);
|
|
89396
|
+
/** Objects allowed to use WRITE '@KERNEL', array of string regex matched against the object name.
|
|
89397
|
+
* Empty, the default, allows every object
|
|
89398
|
+
* @uniqueItems true
|
|
89399
|
+
*/
|
|
89400
|
+
this.allow = [];
|
|
89401
|
+
}
|
|
89402
|
+
}
|
|
89403
|
+
exports.ForbiddenKernelWriteConf = ForbiddenKernelWriteConf;
|
|
89404
|
+
class ForbiddenKernelWrite extends _abap_rule_1.ABAPRule {
|
|
89405
|
+
constructor() {
|
|
89406
|
+
super(...arguments);
|
|
89407
|
+
this.conf = new ForbiddenKernelWriteConf();
|
|
89408
|
+
this.allow = [];
|
|
89409
|
+
}
|
|
89410
|
+
getMetadata() {
|
|
89411
|
+
return {
|
|
89412
|
+
key: "forbidden_kernel_write",
|
|
89413
|
+
title: "Forbidden kernel WRITE",
|
|
89414
|
+
shortDescription: `Forbid WRITE '@KERNEL' outside the listed objects`,
|
|
89415
|
+
extendedInformation: `The transpiler emits the literal of WRITE '@KERNEL ...' as raw JavaScript,
|
|
89416
|
+
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.
|
|
89417
|
+
|
|
89418
|
+
allow is a list of regex, case insensitive, matched against the object name, eg. ["^CL_", "^KERNEL_"].
|
|
89419
|
+
An empty list, the default, allows every object. To forbid WRITE '@KERNEL' everywhere use a regex matching no name, eg. ["^$"].`,
|
|
89420
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
89421
|
+
badExample: `WRITE '@KERNEL process.exit(1);'.`,
|
|
89422
|
+
};
|
|
89423
|
+
}
|
|
89424
|
+
getConfig() {
|
|
89425
|
+
return this.conf;
|
|
89426
|
+
}
|
|
89427
|
+
setConfig(conf) {
|
|
89428
|
+
this.conf = conf;
|
|
89429
|
+
if (this.conf.allow === undefined) {
|
|
89430
|
+
this.conf.allow = [];
|
|
89431
|
+
}
|
|
89432
|
+
this.allow = this.conf.allow.map(a => new RegExp(a, "i"));
|
|
89433
|
+
}
|
|
89434
|
+
runParsed(file, obj) {
|
|
89435
|
+
var _a;
|
|
89436
|
+
if (this.allow.length === 0 || this.allow.some(a => a.test(obj.getName()))) {
|
|
89437
|
+
return [];
|
|
89438
|
+
}
|
|
89439
|
+
const ret = [];
|
|
89440
|
+
for (const s of file.getStatements()) {
|
|
89441
|
+
if (!(s.get() instanceof Statements.Write)) {
|
|
89442
|
+
continue;
|
|
89443
|
+
}
|
|
89444
|
+
// same check as the transpiler, statements/write.ts
|
|
89445
|
+
const source = (_a = s.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
89446
|
+
if ((source === null || source === void 0 ? void 0 : source.startsWith("'@KERNEL ")) === true) {
|
|
89447
|
+
const message = "WRITE '@KERNEL' not allowed in " + obj.getName();
|
|
89448
|
+
ret.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.conf.severity));
|
|
89449
|
+
}
|
|
89450
|
+
}
|
|
89451
|
+
return ret;
|
|
89452
|
+
}
|
|
89453
|
+
}
|
|
89454
|
+
exports.ForbiddenKernelWrite = ForbiddenKernelWrite;
|
|
89455
|
+
//# sourceMappingURL=forbidden_kernel_write.js.map
|
|
89456
|
+
|
|
89457
|
+
/***/ },
|
|
89458
|
+
|
|
89136
89459
|
/***/ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"
|
|
89137
89460
|
/*!**************************************************************!*\
|
|
89138
89461
|
!*** ../core/build/src/rules/forbidden_pseudo_and_pragma.js ***!
|
|
@@ -92029,6 +92352,7 @@ __exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapd
|
|
|
92029
92352
|
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
92030
92353
|
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
92031
92354
|
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
92355
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_short_link */ "../core/build/src/rules/abapdoc_short_link.js"), exports);
|
|
92032
92356
|
__exportStar(__webpack_require__(/*! ./abapdoc_shorttext_length */ "../core/build/src/rules/abapdoc_shorttext_length.js"), exports);
|
|
92033
92357
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
|
|
92034
92358
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
|
|
@@ -92103,6 +92427,7 @@ __exportStar(__webpack_require__(/*! ./exporting */ "../core/build/src/rules/exp
|
|
|
92103
92427
|
__exportStar(__webpack_require__(/*! ./final_newline */ "../core/build/src/rules/final_newline.js"), exports);
|
|
92104
92428
|
__exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "../core/build/src/rules/fm_global_parameters_obsolete.js"), exports);
|
|
92105
92429
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "../core/build/src/rules/forbidden_identifier.js"), exports);
|
|
92430
|
+
__exportStar(__webpack_require__(/*! ./forbidden_kernel_write */ "../core/build/src/rules/forbidden_kernel_write.js"), exports);
|
|
92106
92431
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
92107
92432
|
__exportStar(__webpack_require__(/*! ./forbidden_void_type */ "../core/build/src/rules/forbidden_void_type.js"), exports);
|
|
92108
92433
|
__exportStar(__webpack_require__(/*! ./form_tables_obsolete */ "../core/build/src/rules/form_tables_obsolete.js"), exports);
|
|
@@ -112149,6 +112474,7 @@ class XMLConsistency {
|
|
|
112149
112474
|
extendedInformation: `Checks:
|
|
112150
112475
|
* XML is well-formed and parseable
|
|
112151
112476
|
* Naming for CLAS and INTF objects
|
|
112477
|
+
* CLAS and INTF objects do not contain fields that abapGit clears, eg. AUTHOR, CREATEDON and VERSION
|
|
112152
112478
|
* QUAN fields in TABL objects have reference table and field values
|
|
112153
112479
|
* Transparent TABL objects have delivery class and size category set
|
|
112154
112480
|
* TABL fields with a built-in type carry the INTTYPE abapGit serializes for it, for the confirmed pairs
|
|
@@ -112234,6 +112560,22 @@ class XMLConsistency {
|
|
|
112234
112560
|
else if (((_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getStructure()) !== undefined && obj.getClassDefinition() === undefined) {
|
|
112235
112561
|
issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
|
|
112236
112562
|
}
|
|
112563
|
+
issues.push(...this.checkClearedFields(obj, file, "VSEOCLASS", XMLConsistency.clearedClassFields));
|
|
112564
|
+
return issues;
|
|
112565
|
+
}
|
|
112566
|
+
checkClearedFields(obj, file, structure, fields) {
|
|
112567
|
+
var _a, _b;
|
|
112568
|
+
const issues = [];
|
|
112569
|
+
const block = (_b = (_a = obj.getXML()) === null || _a === void 0 ? void 0 : _a.match(new RegExp(`<${structure}>([\\s\\S]*?)</${structure}>`))) === null || _b === void 0 ? void 0 : _b[1];
|
|
112570
|
+
if (block === undefined) {
|
|
112571
|
+
return issues;
|
|
112572
|
+
}
|
|
112573
|
+
for (const field of fields) {
|
|
112574
|
+
if (block.match(new RegExp(`<${field}[\\s/>]`)) !== null) {
|
|
112575
|
+
const message = `Field ${field} in ${structure} is cleared by abapGit and should not be in the XML`;
|
|
112576
|
+
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
|
|
112577
|
+
}
|
|
112578
|
+
}
|
|
112237
112579
|
return issues;
|
|
112238
112580
|
}
|
|
112239
112581
|
runTextPool(obj, file) {
|
|
@@ -112267,6 +112609,7 @@ class XMLConsistency {
|
|
|
112267
112609
|
else if (obj.getDefinition() !== undefined && ((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.getName().toUpperCase()) !== name.toUpperCase()) {
|
|
112268
112610
|
issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
|
|
112269
112611
|
}
|
|
112612
|
+
issues.push(...this.checkClearedFields(obj, file, "VSEOINTERF", XMLConsistency.clearedInterfaceFields));
|
|
112270
112613
|
return issues;
|
|
112271
112614
|
}
|
|
112272
112615
|
checkTextLength(file, fieldName, text, maxLength, lang) {
|
|
@@ -112447,6 +112790,14 @@ class XMLConsistency {
|
|
|
112447
112790
|
}
|
|
112448
112791
|
}
|
|
112449
112792
|
exports.XMLConsistency = XMLConsistency;
|
|
112793
|
+
// fields abapGit clears before serializing, see ZCL_ABAPGIT_OO_CLASS and ZCL_ABAPGIT_OO_INTERFACE;
|
|
112794
|
+
// abapGit omits initial fields, so any occurrence shows as a diff on every pull
|
|
112795
|
+
XMLConsistency.clearedInterfaceFields = [
|
|
112796
|
+
"UUID", "AUTHOR", "CREATEDON", "CHANGEDBY", "CHANGEDON", "CHGDANYBY", "CHGDANYON", "R3RELEASE", "VERSION",
|
|
112797
|
+
];
|
|
112798
|
+
XMLConsistency.clearedClassFields = [
|
|
112799
|
+
...XMLConsistency.clearedInterfaceFields, "CLSFINAL", "CLSABSTRCT", "EXPOSURE",
|
|
112800
|
+
];
|
|
112450
112801
|
// INTTYPE that abapGit serializes for a built-in DATATYPE, confirmed by exported tables;
|
|
112451
112802
|
// a different value activates, but shows as a diff on every pull
|
|
112452
112803
|
XMLConsistency.intTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.91",
|
|
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.91",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|