@abaplint/cli 2.120.84 → 2.120.86
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 +272 -13
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -11305,23 +11305,25 @@ class Result {
|
|
|
11305
11305
|
return this.tokens[this.tokenIndex + offset];
|
|
11306
11306
|
}
|
|
11307
11307
|
shift(node) {
|
|
11308
|
-
return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, previous: this.nodes }, this.nodeCount + 1);
|
|
11308
|
+
return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, tokenCount: 1, previous: this.nodes }, this.nodeCount + 1);
|
|
11309
11309
|
}
|
|
11310
11310
|
wrapConsumed(consumedTokens, node) {
|
|
11311
11311
|
let current = this.nodes;
|
|
11312
11312
|
let currentCount = this.nodeCount;
|
|
11313
|
+
let tokenCount = 0;
|
|
11313
11314
|
const children = [];
|
|
11314
11315
|
while (consumedTokens > 0) {
|
|
11315
11316
|
if (current === undefined) {
|
|
11316
11317
|
break;
|
|
11317
11318
|
}
|
|
11318
11319
|
children.push(current.node);
|
|
11319
|
-
consumedTokens = consumedTokens - current.
|
|
11320
|
+
consumedTokens = consumedTokens - current.tokenCount;
|
|
11321
|
+
tokenCount = tokenCount + current.tokenCount;
|
|
11320
11322
|
current = current.previous;
|
|
11321
11323
|
currentCount--;
|
|
11322
11324
|
}
|
|
11323
11325
|
node.setChildren(children.reverse());
|
|
11324
|
-
this.nodes = { node, previous: current };
|
|
11326
|
+
this.nodes = { node, tokenCount, previous: current };
|
|
11325
11327
|
this.nodeCount = currentCount + 1;
|
|
11326
11328
|
return this;
|
|
11327
11329
|
}
|
|
@@ -11350,7 +11352,7 @@ class Result {
|
|
|
11350
11352
|
this.nodes = undefined;
|
|
11351
11353
|
this.nodeCount = 0;
|
|
11352
11354
|
for (const node of n) {
|
|
11353
|
-
this.nodes = { node, previous: this.nodes };
|
|
11355
|
+
this.nodes = { node, tokenCount: node.countTokens(), previous: this.nodes };
|
|
11354
11356
|
this.nodeCount++;
|
|
11355
11357
|
}
|
|
11356
11358
|
}
|
|
@@ -19440,11 +19442,15 @@ class Submit {
|
|
|
19440
19442
|
const datasetExpiration = (0, combi_1.seq)("DATASET EXPIRATION", expressions_1.Source);
|
|
19441
19443
|
const coverText = (0, combi_1.seq)("COVER TEXT", expressions_1.Source);
|
|
19442
19444
|
const listName = (0, combi_1.seq)("LIST NAME", expressions_1.Source);
|
|
19445
|
+
const listDataset = (0, combi_1.seq)("LIST DATASET", expressions_1.Source);
|
|
19446
|
+
const listAuthority = (0, combi_1.seq)("LIST AUTHORITY", expressions_1.Source);
|
|
19447
|
+
const coverPage = (0, combi_1.seq)("COVER PAGE", expressions_1.Source);
|
|
19448
|
+
const department = (0, combi_1.seq)("DEPARTMENT", expressions_1.Source);
|
|
19443
19449
|
const keep = (0, combi_1.seq)("KEEP IN SPOOL", expressions_1.Source);
|
|
19444
19450
|
const imm = (0, combi_1.seq)("IMMEDIATELY", expressions_1.Source);
|
|
19445
19451
|
const dest = (0, combi_1.seq)("DESTINATION", expressions_1.Source);
|
|
19446
19452
|
const language = (0, combi_1.seq)("LANGUAGE", expressions_1.Source);
|
|
19447
|
-
const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
|
|
19453
|
+
const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, listDataset, listAuthority, coverPage, department, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
|
|
19448
19454
|
const ret = (0, combi_1.seq)("SUBMIT", prog, (0, combi_1.opt)(perm));
|
|
19449
19455
|
return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
|
|
19450
19456
|
}
|
|
@@ -29815,6 +29821,10 @@ class BasicTypes {
|
|
|
29815
29821
|
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, chain.getFirstToken(), message));
|
|
29816
29822
|
return undefined;
|
|
29817
29823
|
}
|
|
29824
|
+
else if (concat === "SY-REPID" || concat === "SYST-REPID") {
|
|
29825
|
+
// predefined constant in every program, not a SYST component
|
|
29826
|
+
return undefined;
|
|
29827
|
+
}
|
|
29818
29828
|
return this.resolveConstantValue(chain);
|
|
29819
29829
|
}
|
|
29820
29830
|
throw new Error("findValue, unexpected");
|
|
@@ -50834,7 +50844,6 @@ const _abstract_node_1 = __webpack_require__(/*! ./_abstract_node */ "../core/bu
|
|
|
50834
50844
|
class ExpressionNode extends _abstract_node_1.AbstractNode {
|
|
50835
50845
|
constructor(expression) {
|
|
50836
50846
|
super();
|
|
50837
|
-
this.tokenCount = 0;
|
|
50838
50847
|
this.expression = expression;
|
|
50839
50848
|
}
|
|
50840
50849
|
addChild(_n) {
|
|
@@ -50845,13 +50854,15 @@ class ExpressionNode extends _abstract_node_1.AbstractNode {
|
|
|
50845
50854
|
}
|
|
50846
50855
|
setChildren(children) {
|
|
50847
50856
|
super.setChildren(children);
|
|
50848
|
-
for (const child of this.getChildren()) {
|
|
50849
|
-
this.tokenCount = this.tokenCount + child.countTokens();
|
|
50850
|
-
}
|
|
50851
50857
|
return this;
|
|
50852
50858
|
}
|
|
50859
|
+
// not stored on the node, saves a field per ExpressionNode, the statement parser tracks counts itself
|
|
50853
50860
|
countTokens() {
|
|
50854
|
-
|
|
50861
|
+
let count = 0;
|
|
50862
|
+
for (const child of this.getChildren()) {
|
|
50863
|
+
count = count + child.countTokens();
|
|
50864
|
+
}
|
|
50865
|
+
return count;
|
|
50855
50866
|
}
|
|
50856
50867
|
getFirstToken() {
|
|
50857
50868
|
for (const child of this.getChildren()) {
|
|
@@ -72651,7 +72662,7 @@ class Registry {
|
|
|
72651
72662
|
}
|
|
72652
72663
|
static abaplintVersion() {
|
|
72653
72664
|
// magic, see build script "version.js"
|
|
72654
|
-
return "2.120.
|
|
72665
|
+
return "2.120.86";
|
|
72655
72666
|
}
|
|
72656
72667
|
getDDICReferences() {
|
|
72657
72668
|
return this.ddicReferences;
|
|
@@ -75308,6 +75319,104 @@ exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
|
75308
75319
|
|
|
75309
75320
|
/***/ },
|
|
75310
75321
|
|
|
75322
|
+
/***/ "../core/build/src/rules/abapdoc_shorttext_length.js"
|
|
75323
|
+
/*!***********************************************************!*\
|
|
75324
|
+
!*** ../core/build/src/rules/abapdoc_shorttext_length.js ***!
|
|
75325
|
+
\***********************************************************/
|
|
75326
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75327
|
+
|
|
75328
|
+
"use strict";
|
|
75329
|
+
|
|
75330
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75331
|
+
exports.AbapdocShorttextLength = exports.AbapdocShorttextLengthConf = void 0;
|
|
75332
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75333
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
75334
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75335
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
75336
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
75337
|
+
class AbapdocShorttextLengthConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75338
|
+
}
|
|
75339
|
+
exports.AbapdocShorttextLengthConf = AbapdocShorttextLengthConf;
|
|
75340
|
+
const MAX_LENGTH = 60;
|
|
75341
|
+
class AbapdocShorttextLength extends _abap_rule_1.ABAPRule {
|
|
75342
|
+
constructor() {
|
|
75343
|
+
super(...arguments);
|
|
75344
|
+
this.conf = new AbapdocShorttextLengthConf();
|
|
75345
|
+
}
|
|
75346
|
+
getMetadata() {
|
|
75347
|
+
return {
|
|
75348
|
+
key: "abapdoc_shorttext_length",
|
|
75349
|
+
title: "ABAP Doc shorttext too long",
|
|
75350
|
+
shortDescription: `Reports ABAP Doc shorttexts longer than 60 characters.`,
|
|
75351
|
+
extendedInformation: `A shorttext is written as <p class="shorttext">...</p> or
|
|
75352
|
+
<p class="shorttext synchronized">...</p>, the system warns "Shorttext must not exceed 60 characters."
|
|
75353
|
+
if the text is longer.
|
|
75354
|
+
|
|
75355
|
+
The text may span several "! lines, line breaks count as one blank. Leading and trailing blanks are not counted,
|
|
75356
|
+
an entity like < counts as one character.`,
|
|
75357
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
75358
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
75359
|
+
"! <p class="shorttext synchronized">Returns the name of the selected row in the table of the view</p>
|
|
75360
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
75361
|
+
ENDINTERFACE.`,
|
|
75362
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
75363
|
+
"! <p class="shorttext synchronized">Returns the name of the selected row</p>
|
|
75364
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
75365
|
+
ENDINTERFACE.`,
|
|
75366
|
+
};
|
|
75367
|
+
}
|
|
75368
|
+
getConfig() {
|
|
75369
|
+
return this.conf;
|
|
75370
|
+
}
|
|
75371
|
+
setConfig(conf) {
|
|
75372
|
+
this.conf = conf;
|
|
75373
|
+
}
|
|
75374
|
+
runParsed(file) {
|
|
75375
|
+
const issues = [];
|
|
75376
|
+
let block = [];
|
|
75377
|
+
for (const statement of file.getStatements()) {
|
|
75378
|
+
const token = statement.getFirstToken();
|
|
75379
|
+
const doc = statement.get() instanceof _statement_1.Comment && token.getStr().startsWith(`"!`);
|
|
75380
|
+
const previous = block[block.length - 1];
|
|
75381
|
+
if (doc === false || (previous !== undefined && token.getStart().getRow() !== previous.getStart().getRow() + 1)) {
|
|
75382
|
+
issues.push(...this.checkBlock(file, block));
|
|
75383
|
+
block = [];
|
|
75384
|
+
}
|
|
75385
|
+
if (doc === true) {
|
|
75386
|
+
block.push(token);
|
|
75387
|
+
}
|
|
75388
|
+
}
|
|
75389
|
+
issues.push(...this.checkBlock(file, block));
|
|
75390
|
+
return issues;
|
|
75391
|
+
}
|
|
75392
|
+
checkBlock(file, block) {
|
|
75393
|
+
const issues = [];
|
|
75394
|
+
if (block.length === 0) {
|
|
75395
|
+
return issues;
|
|
75396
|
+
}
|
|
75397
|
+
const text = block.map(t => t.getStr().substring(2)).join("\n");
|
|
75398
|
+
const regex = /<p\s[^>]*class\s*=\s*"shorttext(?:\s+synchronized)?"[^>]*>([\s\S]*?)<\/p>/gi;
|
|
75399
|
+
let match;
|
|
75400
|
+
while ((match = regex.exec(text)) !== null) {
|
|
75401
|
+
const length = this.decode(match[1].replace(/\s+/g, " ").trim()).length;
|
|
75402
|
+
if (length <= MAX_LENGTH) {
|
|
75403
|
+
continue;
|
|
75404
|
+
}
|
|
75405
|
+
const token = block[text.substring(0, match.index).split("\n").length - 1];
|
|
75406
|
+
const message = `Shorttext must not exceed ${MAX_LENGTH} characters, found ${length}`;
|
|
75407
|
+
issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
75408
|
+
}
|
|
75409
|
+
return issues;
|
|
75410
|
+
}
|
|
75411
|
+
decode(text) {
|
|
75412
|
+
return text.replace(/&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);/g, "_");
|
|
75413
|
+
}
|
|
75414
|
+
}
|
|
75415
|
+
exports.AbapdocShorttextLength = AbapdocShorttextLength;
|
|
75416
|
+
//# sourceMappingURL=abapdoc_shorttext_length.js.map
|
|
75417
|
+
|
|
75418
|
+
/***/ },
|
|
75419
|
+
|
|
75311
75420
|
/***/ "../core/build/src/rules/add_test_attributes.js"
|
|
75312
75421
|
/*!******************************************************!*\
|
|
75313
75422
|
!*** ../core/build/src/rules/add_test_attributes.js ***!
|
|
@@ -76761,8 +76870,28 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
|
|
|
76761
76870
|
|
|
76762
76871
|
BREAK points`,
|
|
76763
76872
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
76764
|
-
badExample: `
|
|
76765
|
-
|
|
76873
|
+
badExample: `DEFINE _hello.
|
|
76874
|
+
WRITE 'hello'.
|
|
76875
|
+
END-OF-DEFINITION.
|
|
76876
|
+
|
|
76877
|
+
STATICS count TYPE i.
|
|
76878
|
+
|
|
76879
|
+
TYPES ty_items TYPE STANDARD TABLE OF i WITH DEFAULT KEY.
|
|
76880
|
+
|
|
76881
|
+
BREAK-POINT.
|
|
76882
|
+
|
|
76883
|
+
TEST-SEAM seam_name.
|
|
76884
|
+
count = 1.
|
|
76885
|
+
END-TEST-SEAM.
|
|
76886
|
+
|
|
76887
|
+
DESCRIBE TABLE items LINES count.
|
|
76888
|
+
|
|
76889
|
+
EXPORT data = items TO MEMORY ID 'ZFOO'.
|
|
76890
|
+
|
|
76891
|
+
EXPORT data = items TO DATABASE indx(zz) ID 'ZFOO'.`,
|
|
76892
|
+
goodExample: `count = lines( items ).
|
|
76893
|
+
|
|
76894
|
+
TYPES ty_items TYPE STANDARD TABLE OF i WITH EMPTY KEY.`,
|
|
76766
76895
|
};
|
|
76767
76896
|
}
|
|
76768
76897
|
getDescription(statement) {
|
|
@@ -91715,6 +91844,7 @@ __exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapd
|
|
|
91715
91844
|
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
91716
91845
|
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
91717
91846
|
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
91847
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_shorttext_length */ "../core/build/src/rules/abapdoc_shorttext_length.js"), exports);
|
|
91718
91848
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
|
|
91719
91849
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
|
|
91720
91850
|
__exportStar(__webpack_require__(/*! ./alias_never_reassigned */ "../core/build/src/rules/alias_never_reassigned.js"), exports);
|
|
@@ -91869,6 +91999,7 @@ __exportStar(__webpack_require__(/*! ./prefer_pragmas */ "../core/build/src/rule
|
|
|
91869
91999
|
__exportStar(__webpack_require__(/*! ./prefer_abap_bool */ "../core/build/src/rules/prefer_abap_bool.js"), exports);
|
|
91870
92000
|
__exportStar(__webpack_require__(/*! ./prefer_abap_bool_values */ "../core/build/src/rules/prefer_abap_bool_values.js"), exports);
|
|
91871
92001
|
__exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ "../core/build/src/rules/prefer_raise_exception_new.js"), exports);
|
|
92002
|
+
__exportStar(__webpack_require__(/*! ./prefer_raise_message */ "../core/build/src/rules/prefer_raise_message.js"), exports);
|
|
91872
92003
|
__exportStar(__webpack_require__(/*! ./prefer_string_template */ "../core/build/src/rules/prefer_string_template.js"), exports);
|
|
91873
92004
|
__exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "../core/build/src/rules/prefer_returning_to_exporting.js"), exports);
|
|
91874
92005
|
__exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "../core/build/src/rules/prefer_xsdbool.js"), exports);
|
|
@@ -101304,6 +101435,134 @@ exports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;
|
|
|
101304
101435
|
|
|
101305
101436
|
/***/ },
|
|
101306
101437
|
|
|
101438
|
+
/***/ "../core/build/src/rules/prefer_raise_message.js"
|
|
101439
|
+
/*!*******************************************************!*\
|
|
101440
|
+
!*** ../core/build/src/rules/prefer_raise_message.js ***!
|
|
101441
|
+
\*******************************************************/
|
|
101442
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
101443
|
+
|
|
101444
|
+
"use strict";
|
|
101445
|
+
|
|
101446
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
101447
|
+
if (k2 === undefined) k2 = k;
|
|
101448
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
101449
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
101450
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
101451
|
+
}
|
|
101452
|
+
Object.defineProperty(o, k2, desc);
|
|
101453
|
+
}) : (function(o, m, k, k2) {
|
|
101454
|
+
if (k2 === undefined) k2 = k;
|
|
101455
|
+
o[k2] = m[k];
|
|
101456
|
+
}));
|
|
101457
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
101458
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
101459
|
+
}) : function(o, v) {
|
|
101460
|
+
o["default"] = v;
|
|
101461
|
+
});
|
|
101462
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
101463
|
+
var ownKeys = function(o) {
|
|
101464
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
101465
|
+
var ar = [];
|
|
101466
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
101467
|
+
return ar;
|
|
101468
|
+
};
|
|
101469
|
+
return ownKeys(o);
|
|
101470
|
+
};
|
|
101471
|
+
return function (mod) {
|
|
101472
|
+
if (mod && mod.__esModule) return mod;
|
|
101473
|
+
var result = {};
|
|
101474
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
101475
|
+
__setModuleDefault(result, mod);
|
|
101476
|
+
return result;
|
|
101477
|
+
};
|
|
101478
|
+
})();
|
|
101479
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
101480
|
+
exports.PreferRaiseMessage = exports.PreferRaiseMessageConf = void 0;
|
|
101481
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
101482
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
101483
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
101484
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
101485
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
101486
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
101487
|
+
class PreferRaiseMessageConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
101488
|
+
constructor() {
|
|
101489
|
+
super(...arguments);
|
|
101490
|
+
/** List of exception class names to ignore, case insensitive */
|
|
101491
|
+
this.ignoreExceptionClasses = [];
|
|
101492
|
+
}
|
|
101493
|
+
}
|
|
101494
|
+
exports.PreferRaiseMessageConf = PreferRaiseMessageConf;
|
|
101495
|
+
class PreferRaiseMessage extends _abap_rule_1.ABAPRule {
|
|
101496
|
+
constructor() {
|
|
101497
|
+
super(...arguments);
|
|
101498
|
+
this.conf = new PreferRaiseMessageConf();
|
|
101499
|
+
}
|
|
101500
|
+
getMetadata() {
|
|
101501
|
+
return {
|
|
101502
|
+
key: "prefer_raise_message",
|
|
101503
|
+
title: "Prefer RAISE EXCEPTION with MESSAGE",
|
|
101504
|
+
shortDescription: `Prefer RAISE EXCEPTION with MESSAGE instead of supplying parameter TEXT or TEXTID`,
|
|
101505
|
+
extendedInformation: `Reports RAISE EXCEPTION statements where parameter TEXT or TEXTID is supplied.
|
|
101506
|
+
|
|
101507
|
+
Use a message class instead, so the text is translatable and can be found via where-used.
|
|
101508
|
+
|
|
101509
|
+
Exception classes can be excluded via configuration "ignoreExceptionClasses".`,
|
|
101510
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
101511
|
+
goodExample: `RAISE EXCEPTION TYPE zcx_error MESSAGE e001(zclass).`,
|
|
101512
|
+
badExample: `RAISE EXCEPTION TYPE zcx_error
|
|
101513
|
+
EXPORTING text = 'hello world'.`,
|
|
101514
|
+
};
|
|
101515
|
+
}
|
|
101516
|
+
getConfig() {
|
|
101517
|
+
return this.conf;
|
|
101518
|
+
}
|
|
101519
|
+
setConfig(conf) {
|
|
101520
|
+
this.conf = conf;
|
|
101521
|
+
}
|
|
101522
|
+
runParsed(file) {
|
|
101523
|
+
var _a, _b, _c, _d;
|
|
101524
|
+
var _e;
|
|
101525
|
+
const issues = [];
|
|
101526
|
+
const ignore = ((_e = this.conf.ignoreExceptionClasses) !== null && _e !== void 0 ? _e : []).map(c => c.toUpperCase());
|
|
101527
|
+
for (const statement of file.getStatements()) {
|
|
101528
|
+
if (!(statement.get() instanceof Statements.Raise)) {
|
|
101529
|
+
continue;
|
|
101530
|
+
}
|
|
101531
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
101532
|
+
if (!concat.startsWith("RAISE EXCEPTION ") && !concat.startsWith("RAISE RESUMABLE EXCEPTION ")) {
|
|
101533
|
+
continue;
|
|
101534
|
+
}
|
|
101535
|
+
else if (concat.includes(" MESSAGE")) {
|
|
101536
|
+
continue;
|
|
101537
|
+
}
|
|
101538
|
+
let className;
|
|
101539
|
+
let parameters;
|
|
101540
|
+
const newObject = (_b = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.MethodCallChain)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.NewObject);
|
|
101541
|
+
if (newObject) {
|
|
101542
|
+
className = (_c = newObject.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
101543
|
+
parameters = newObject.findDirectExpression(Expressions.ParameterListS);
|
|
101544
|
+
}
|
|
101545
|
+
else {
|
|
101546
|
+
className = (_d = statement.findDirectExpression(Expressions.ClassName)) === null || _d === void 0 ? void 0 : _d.concatTokens();
|
|
101547
|
+
parameters = statement.findDirectExpression(Expressions.ParameterListS);
|
|
101548
|
+
}
|
|
101549
|
+
if (className === undefined || ignore.includes(className.toUpperCase())) {
|
|
101550
|
+
continue;
|
|
101551
|
+
}
|
|
101552
|
+
const name = parameters === null || parameters === void 0 ? void 0 : parameters.findDirectExpressions(Expressions.ParameterS).map(p => { var _a; return (_a = p.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); }).find(n => n === "TEXT" || n === "TEXTID");
|
|
101553
|
+
if (name) {
|
|
101554
|
+
const message = "Prefer RAISE EXCEPTION with MESSAGE, " + className + " raised with parameter " + name;
|
|
101555
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
101556
|
+
}
|
|
101557
|
+
}
|
|
101558
|
+
return issues;
|
|
101559
|
+
}
|
|
101560
|
+
}
|
|
101561
|
+
exports.PreferRaiseMessage = PreferRaiseMessage;
|
|
101562
|
+
//# sourceMappingURL=prefer_raise_message.js.map
|
|
101563
|
+
|
|
101564
|
+
/***/ },
|
|
101565
|
+
|
|
101307
101566
|
/***/ "../core/build/src/rules/prefer_returning_to_exporting.js"
|
|
101308
101567
|
/*!****************************************************************!*\
|
|
101309
101568
|
!*** ../core/build/src/rules/prefer_returning_to_exporting.js ***!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.86",
|
|
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.86",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|