@abaplint/cli 2.99.11 → 2.100.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/cli.js +196 -18
- package/package.json +4 -3
package/build/cli.js
CHANGED
|
@@ -20687,6 +20687,9 @@ class CurrentScope {
|
|
|
20687
20687
|
getDDICReferences() {
|
|
20688
20688
|
return this.reg.getDDICReferences();
|
|
20689
20689
|
}
|
|
20690
|
+
getMSAGReferences() {
|
|
20691
|
+
return this.reg.getMSAGReferences();
|
|
20692
|
+
}
|
|
20690
20693
|
getParentObj() {
|
|
20691
20694
|
return this.parentObj;
|
|
20692
20695
|
}
|
|
@@ -24242,9 +24245,26 @@ const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ ".
|
|
|
24242
24245
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
24243
24246
|
class MessageSource {
|
|
24244
24247
|
runSyntax(node, scope, filename) {
|
|
24248
|
+
var _a, _b, _c, _d;
|
|
24245
24249
|
for (const f of node.findDirectExpressions(Expressions.Source)) {
|
|
24246
24250
|
new source_1.Source().runSyntax(f, scope, filename);
|
|
24247
24251
|
}
|
|
24252
|
+
if (node.getFirstToken().getStr().toUpperCase() === "ID") {
|
|
24253
|
+
const id = (_a = node.findExpressionAfterToken("ID")) === null || _a === void 0 ? void 0 : _a.concatTokens();
|
|
24254
|
+
const number = (_b = node.findDirectExpression(Expressions.MessageNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
24255
|
+
if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
|
|
24256
|
+
const messageClass = id.substring(1, id.length - 1).toUpperCase();
|
|
24257
|
+
scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
|
|
24258
|
+
}
|
|
24259
|
+
}
|
|
24260
|
+
else {
|
|
24261
|
+
const typeAndNumber = (_c = node.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
24262
|
+
const messageNumber = typeAndNumber === null || typeAndNumber === void 0 ? void 0 : typeAndNumber.substring(1);
|
|
24263
|
+
const messageClass = (_d = node.findDirectExpression(Expressions.MessageClass)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
|
|
24264
|
+
if (messageNumber && messageClass) {
|
|
24265
|
+
scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, messageNumber);
|
|
24266
|
+
}
|
|
24267
|
+
}
|
|
24248
24268
|
}
|
|
24249
24269
|
}
|
|
24250
24270
|
exports.MessageSource = MessageSource;
|
|
@@ -29635,7 +29655,7 @@ const raise_with_1 = __webpack_require__(/*! ../expressions/raise_with */ "./nod
|
|
|
29635
29655
|
class Raise {
|
|
29636
29656
|
runSyntax(node, scope, filename) {
|
|
29637
29657
|
// todo
|
|
29638
|
-
var _a;
|
|
29658
|
+
var _a, _b, _c;
|
|
29639
29659
|
const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
29640
29660
|
const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
|
|
29641
29661
|
if (classNam) {
|
|
@@ -29684,6 +29704,12 @@ class Raise {
|
|
|
29684
29704
|
for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
|
|
29685
29705
|
new message_source_1.MessageSource().runSyntax(s, scope, filename);
|
|
29686
29706
|
}
|
|
29707
|
+
const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
29708
|
+
const number = (_c = node.findDirectExpression(Expressions.MessageNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
29709
|
+
if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
|
|
29710
|
+
const messageClass = id.substring(1, id.length - 1).toUpperCase();
|
|
29711
|
+
scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
|
|
29712
|
+
}
|
|
29687
29713
|
}
|
|
29688
29714
|
}
|
|
29689
29715
|
exports.Raise = Raise;
|
|
@@ -31953,6 +31979,7 @@ class SyntaxLogic {
|
|
|
31953
31979
|
}
|
|
31954
31980
|
this.issues = [];
|
|
31955
31981
|
this.reg.getDDICReferences().clear(this.object);
|
|
31982
|
+
this.reg.getMSAGReferences().clear(this.object);
|
|
31956
31983
|
if (this.object instanceof objects_1.Program && this.object.isInclude()) {
|
|
31957
31984
|
// todo, show some kind of error?
|
|
31958
31985
|
return { issues: [], spaghetti: this.scope.pop(new position_1.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)) };
|
|
@@ -35987,21 +36014,21 @@ exports.InterfaceDefinition = InterfaceDefinition;
|
|
|
35987
36014
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
35988
36015
|
exports.Message = void 0;
|
|
35989
36016
|
class Message {
|
|
35990
|
-
constructor(
|
|
35991
|
-
this.
|
|
35992
|
-
if (this.
|
|
35993
|
-
this.
|
|
36017
|
+
constructor(number, message) {
|
|
36018
|
+
this.number = number;
|
|
36019
|
+
if (this.number === undefined) {
|
|
36020
|
+
this.number = "";
|
|
35994
36021
|
}
|
|
35995
|
-
this.
|
|
35996
|
-
if (this.
|
|
35997
|
-
this.
|
|
36022
|
+
this.message = message;
|
|
36023
|
+
if (this.message === undefined) {
|
|
36024
|
+
this.message = "";
|
|
35998
36025
|
}
|
|
35999
36026
|
}
|
|
36000
36027
|
getNumber() {
|
|
36001
|
-
return this.
|
|
36028
|
+
return this.number;
|
|
36002
36029
|
}
|
|
36003
36030
|
getMessage() {
|
|
36004
|
-
return this.
|
|
36031
|
+
return this.message;
|
|
36005
36032
|
}
|
|
36006
36033
|
getPlaceholderCount() {
|
|
36007
36034
|
return (this.getMessage().match(/&/g) || []).length;
|
|
@@ -38316,10 +38343,11 @@ class DDICReferences {
|
|
|
38316
38343
|
}
|
|
38317
38344
|
}
|
|
38318
38345
|
}
|
|
38319
|
-
|
|
38320
|
-
const
|
|
38321
|
-
|
|
38322
|
-
|
|
38346
|
+
// remove from name + type index
|
|
38347
|
+
const name = obj.getName().toUpperCase();
|
|
38348
|
+
const type = obj.getType();
|
|
38349
|
+
if ((_b = this.nameTypeIndex[name]) === null || _b === void 0 ? void 0 : _b[type]) {
|
|
38350
|
+
this.nameTypeIndex[name][type] = [];
|
|
38323
38351
|
}
|
|
38324
38352
|
}
|
|
38325
38353
|
listByFilename(filename, line) {
|
|
@@ -41084,6 +41112,65 @@ exports.Symbols = Symbols;
|
|
|
41084
41112
|
|
|
41085
41113
|
/***/ }),
|
|
41086
41114
|
|
|
41115
|
+
/***/ "./node_modules/@abaplint/core/build/src/msag_references.js":
|
|
41116
|
+
/*!******************************************************************!*\
|
|
41117
|
+
!*** ./node_modules/@abaplint/core/build/src/msag_references.js ***!
|
|
41118
|
+
\******************************************************************/
|
|
41119
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
41120
|
+
|
|
41121
|
+
"use strict";
|
|
41122
|
+
|
|
41123
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
41124
|
+
exports.MSAGReferences = void 0;
|
|
41125
|
+
class MSAGReferences {
|
|
41126
|
+
constructor() {
|
|
41127
|
+
this.nameNumberIndex = {};
|
|
41128
|
+
this.filenameIndex = {};
|
|
41129
|
+
}
|
|
41130
|
+
addUsing(filename, token, messageClass, number) {
|
|
41131
|
+
if (this.filenameIndex[filename] === undefined) {
|
|
41132
|
+
this.filenameIndex[filename] = [];
|
|
41133
|
+
}
|
|
41134
|
+
this.filenameIndex[filename].push({
|
|
41135
|
+
token: token,
|
|
41136
|
+
messageClass: messageClass,
|
|
41137
|
+
number: number,
|
|
41138
|
+
});
|
|
41139
|
+
if (this.nameNumberIndex[messageClass] === undefined) {
|
|
41140
|
+
this.nameNumberIndex[messageClass] = {};
|
|
41141
|
+
}
|
|
41142
|
+
if (this.nameNumberIndex[messageClass][number] === undefined) {
|
|
41143
|
+
this.nameNumberIndex[messageClass][number] = [];
|
|
41144
|
+
}
|
|
41145
|
+
this.nameNumberIndex[messageClass][number].push({
|
|
41146
|
+
filename: filename,
|
|
41147
|
+
token: token,
|
|
41148
|
+
});
|
|
41149
|
+
}
|
|
41150
|
+
clear(obj) {
|
|
41151
|
+
for (const file of obj.getFiles()) {
|
|
41152
|
+
const filename = file.getFilename();
|
|
41153
|
+
for (const fIndex of this.filenameIndex[filename] || []) {
|
|
41154
|
+
// this should be okay for performance, each message should be referenced less than 10 times typically
|
|
41155
|
+
this.nameNumberIndex[fIndex.messageClass][fIndex.number] =
|
|
41156
|
+
this.nameNumberIndex[fIndex.messageClass][fIndex.number].filter(i => i.filename !== filename);
|
|
41157
|
+
}
|
|
41158
|
+
delete this.filenameIndex[filename];
|
|
41159
|
+
}
|
|
41160
|
+
}
|
|
41161
|
+
listByFilename(filename) {
|
|
41162
|
+
return this.filenameIndex[filename] || [];
|
|
41163
|
+
}
|
|
41164
|
+
listByMessage(messageClass, number) {
|
|
41165
|
+
var _a;
|
|
41166
|
+
return ((_a = this.nameNumberIndex[messageClass]) === null || _a === void 0 ? void 0 : _a[number]) || [];
|
|
41167
|
+
}
|
|
41168
|
+
}
|
|
41169
|
+
exports.MSAGReferences = MSAGReferences;
|
|
41170
|
+
//# sourceMappingURL=msag_references.js.map
|
|
41171
|
+
|
|
41172
|
+
/***/ }),
|
|
41173
|
+
|
|
41087
41174
|
/***/ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js":
|
|
41088
41175
|
/*!***********************************************************************!*\
|
|
41089
41176
|
!*** ./node_modules/@abaplint/core/build/src/objects/_abap_object.js ***!
|
|
@@ -44597,6 +44684,7 @@ class MessageClass extends _abstract_object_1.AbstractObject {
|
|
|
44597
44684
|
return msg ? msg : [];
|
|
44598
44685
|
}
|
|
44599
44686
|
getByNumber(num) {
|
|
44687
|
+
// todo, optimize performance,
|
|
44600
44688
|
for (const message of this.getMessages()) {
|
|
44601
44689
|
if (message.getNumber() === num) {
|
|
44602
44690
|
return message;
|
|
@@ -47558,6 +47646,7 @@ const find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global
|
|
|
47558
47646
|
const excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ "./node_modules/@abaplint/core/build/src/utils/excludeHelper.js");
|
|
47559
47647
|
const ddic_references_1 = __webpack_require__(/*! ./ddic_references */ "./node_modules/@abaplint/core/build/src/ddic_references.js");
|
|
47560
47648
|
const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "./node_modules/@abaplint/core/build/src/rules_runner.js");
|
|
47649
|
+
const msag_references_1 = __webpack_require__(/*! ./msag_references */ "./node_modules/@abaplint/core/build/src/msag_references.js");
|
|
47561
47650
|
// todo, this should really be an instance in case there are multiple Registry'ies
|
|
47562
47651
|
class ParsingPerformance {
|
|
47563
47652
|
static clear() {
|
|
@@ -47610,14 +47699,18 @@ class Registry {
|
|
|
47610
47699
|
this.objectsByType = {};
|
|
47611
47700
|
this.dependencies = {};
|
|
47612
47701
|
this.conf = conf ? conf : config_1.Config.getDefault();
|
|
47613
|
-
this.
|
|
47702
|
+
this.ddicReferences = new ddic_references_1.DDICReferences();
|
|
47703
|
+
this.msagReferences = new msag_references_1.MSAGReferences();
|
|
47614
47704
|
}
|
|
47615
47705
|
static abaplintVersion() {
|
|
47616
47706
|
// magic, see build script "version.sh"
|
|
47617
|
-
return "2.
|
|
47707
|
+
return "2.100.1";
|
|
47618
47708
|
}
|
|
47619
47709
|
getDDICReferences() {
|
|
47620
|
-
return this.
|
|
47710
|
+
return this.ddicReferences;
|
|
47711
|
+
}
|
|
47712
|
+
getMSAGReferences() {
|
|
47713
|
+
return this.msagReferences;
|
|
47621
47714
|
}
|
|
47622
47715
|
*getObjects() {
|
|
47623
47716
|
for (const name in this.objects) {
|
|
@@ -47705,7 +47798,8 @@ class Registry {
|
|
|
47705
47798
|
const obj = this.find(file.getObjectName(), file.getObjectType());
|
|
47706
47799
|
obj.removeFile(file);
|
|
47707
47800
|
if (obj.getFiles().length === 0) {
|
|
47708
|
-
this.
|
|
47801
|
+
this.ddicReferences.clear(obj);
|
|
47802
|
+
this.msagReferences.clear(obj);
|
|
47709
47803
|
this.removeObject(obj);
|
|
47710
47804
|
}
|
|
47711
47805
|
return this;
|
|
@@ -54911,6 +55005,88 @@ exports.Downport = Downport;
|
|
|
54911
55005
|
|
|
54912
55006
|
/***/ }),
|
|
54913
55007
|
|
|
55008
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/easy_to_find_messages.js":
|
|
55009
|
+
/*!******************************************************************************!*\
|
|
55010
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/easy_to_find_messages.js ***!
|
|
55011
|
+
\******************************************************************************/
|
|
55012
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
55013
|
+
|
|
55014
|
+
"use strict";
|
|
55015
|
+
|
|
55016
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
55017
|
+
exports.EasyToFindMessages = exports.EasyToFindMessagesConf = void 0;
|
|
55018
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
55019
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
55020
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
55021
|
+
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
55022
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js");
|
|
55023
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
|
|
55024
|
+
class EasyToFindMessagesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
55025
|
+
}
|
|
55026
|
+
exports.EasyToFindMessagesConf = EasyToFindMessagesConf;
|
|
55027
|
+
class EasyToFindMessages {
|
|
55028
|
+
constructor() {
|
|
55029
|
+
this.conf = new EasyToFindMessagesConf();
|
|
55030
|
+
}
|
|
55031
|
+
getMetadata() {
|
|
55032
|
+
return {
|
|
55033
|
+
key: "easy_to_find_messages",
|
|
55034
|
+
title: "Easy to find messages",
|
|
55035
|
+
shortDescription: `Make messages easy to find`,
|
|
55036
|
+
extendedInformation: `All messages must be statically referenced exactly once
|
|
55037
|
+
|
|
55038
|
+
Only MESSAGE and RAISE statments are counted as static references
|
|
55039
|
+
|
|
55040
|
+
Also see rule "message_exists"
|
|
55041
|
+
|
|
55042
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#make-messages-easy-to-find`,
|
|
55043
|
+
tags: [_irule_1.RuleTag.Styleguide],
|
|
55044
|
+
};
|
|
55045
|
+
}
|
|
55046
|
+
getConfig() {
|
|
55047
|
+
return this.conf;
|
|
55048
|
+
}
|
|
55049
|
+
setConfig(conf) {
|
|
55050
|
+
this.conf = conf;
|
|
55051
|
+
}
|
|
55052
|
+
initialize(reg) {
|
|
55053
|
+
this.msagReferences = reg.getMSAGReferences();
|
|
55054
|
+
// the SyntaxLogic builds the references
|
|
55055
|
+
for (const obj of reg.getObjects()) {
|
|
55056
|
+
if (obj instanceof _abap_object_1.ABAPObject) {
|
|
55057
|
+
new syntax_1.SyntaxLogic(reg, obj).run();
|
|
55058
|
+
}
|
|
55059
|
+
}
|
|
55060
|
+
return this;
|
|
55061
|
+
}
|
|
55062
|
+
run(object) {
|
|
55063
|
+
const issues = [];
|
|
55064
|
+
if (object.getType() === "MSAG") {
|
|
55065
|
+
const msag = object;
|
|
55066
|
+
for (const message of msag.getMessages()) {
|
|
55067
|
+
const where = this.msagReferences.listByMessage(msag.getName().toUpperCase(), message.getNumber());
|
|
55068
|
+
if (where.length === 0) {
|
|
55069
|
+
const text = `Message ${message.getNumber()} not statically referenced`;
|
|
55070
|
+
const position = new position_1.Position(1, 1);
|
|
55071
|
+
const issue = issue_1.Issue.atPosition(object.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
55072
|
+
issues.push(issue);
|
|
55073
|
+
}
|
|
55074
|
+
else if (where.length >= 2) {
|
|
55075
|
+
const text = `Message ${message.getNumber()} referenced more than once`;
|
|
55076
|
+
const position = new position_1.Position(1, 1);
|
|
55077
|
+
const issue = issue_1.Issue.atPosition(object.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
55078
|
+
issues.push(issue);
|
|
55079
|
+
}
|
|
55080
|
+
}
|
|
55081
|
+
}
|
|
55082
|
+
return issues;
|
|
55083
|
+
}
|
|
55084
|
+
}
|
|
55085
|
+
exports.EasyToFindMessages = EasyToFindMessages;
|
|
55086
|
+
//# sourceMappingURL=easy_to_find_messages.js.map
|
|
55087
|
+
|
|
55088
|
+
/***/ }),
|
|
55089
|
+
|
|
54914
55090
|
/***/ "./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js":
|
|
54915
55091
|
/*!********************************************************************************!*\
|
|
54916
55092
|
!*** ./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js ***!
|
|
@@ -57519,6 +57695,7 @@ __exportStar(__webpack_require__(/*! ./definitions_top */ "./node_modules/@abapl
|
|
|
57519
57695
|
__exportStar(__webpack_require__(/*! ./description_empty */ "./node_modules/@abaplint/core/build/src/rules/description_empty.js"), exports);
|
|
57520
57696
|
__exportStar(__webpack_require__(/*! ./double_space */ "./node_modules/@abaplint/core/build/src/rules/double_space.js"), exports);
|
|
57521
57697
|
__exportStar(__webpack_require__(/*! ./downport */ "./node_modules/@abaplint/core/build/src/rules/downport.js"), exports);
|
|
57698
|
+
__exportStar(__webpack_require__(/*! ./easy_to_find_messages */ "./node_modules/@abaplint/core/build/src/rules/easy_to_find_messages.js"), exports);
|
|
57522
57699
|
__exportStar(__webpack_require__(/*! ./empty_line_in_statement */ "./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js"), exports);
|
|
57523
57700
|
__exportStar(__webpack_require__(/*! ./empty_statement */ "./node_modules/@abaplint/core/build/src/rules/empty_statement.js"), exports);
|
|
57524
57701
|
__exportStar(__webpack_require__(/*! ./empty_structure */ "./node_modules/@abaplint/core/build/src/rules/empty_structure.js"), exports);
|
|
@@ -59990,6 +60167,7 @@ class MSAGConsistency {
|
|
|
59990
60167
|
key: "msag_consistency",
|
|
59991
60168
|
title: "MSAG consistency check",
|
|
59992
60169
|
shortDescription: `Checks the validity of messages in message classes`,
|
|
60170
|
+
extendedInformation: `Message numbers must be 3 digits, and message text must not be empty`,
|
|
59993
60171
|
};
|
|
59994
60172
|
}
|
|
59995
60173
|
getDescription(reason) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.100.1",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
|
+
"funding": "https://github.com/sponsors/larshp",
|
|
5
6
|
"bin": {
|
|
6
7
|
"abaplint": "./abaplint"
|
|
7
8
|
},
|
|
@@ -37,12 +38,12 @@
|
|
|
37
38
|
},
|
|
38
39
|
"homepage": "https://abaplint.org",
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@abaplint/core": "^2.
|
|
41
|
+
"@abaplint/core": "^2.100.1",
|
|
41
42
|
"@types/chai": "^4.3.5",
|
|
42
43
|
"@types/glob": "^7.2.0",
|
|
43
44
|
"@types/minimist": "^1.2.2",
|
|
44
45
|
"@types/mocha": "^10.0.1",
|
|
45
|
-
"@types/node": "^20.1.
|
|
46
|
+
"@types/node": "^20.1.3",
|
|
46
47
|
"@types/progress": "^2.0.5",
|
|
47
48
|
"chai": "^4.3.7",
|
|
48
49
|
"chalk": "^5.2.0",
|