@abaplint/cli 2.120.72 → 2.120.73
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 +98 -1
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -70708,7 +70708,7 @@ class Registry {
|
|
|
70708
70708
|
}
|
|
70709
70709
|
static abaplintVersion() {
|
|
70710
70710
|
// magic, see build script "version.js"
|
|
70711
|
-
return "2.120.
|
|
70711
|
+
return "2.120.73";
|
|
70712
70712
|
}
|
|
70713
70713
|
getDDICReferences() {
|
|
70714
70714
|
return this.ddicReferences;
|
|
@@ -83493,6 +83493,102 @@ exports.FunctionalWriting = FunctionalWriting;
|
|
|
83493
83493
|
|
|
83494
83494
|
/***/ },
|
|
83495
83495
|
|
|
83496
|
+
/***/ "../core/build/src/rules/generic_regex.js"
|
|
83497
|
+
/*!************************************************!*\
|
|
83498
|
+
!*** ../core/build/src/rules/generic_regex.js ***!
|
|
83499
|
+
\************************************************/
|
|
83500
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
83501
|
+
|
|
83502
|
+
"use strict";
|
|
83503
|
+
|
|
83504
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83505
|
+
exports.GenericRegex = exports.GenericRegexConf = void 0;
|
|
83506
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
83507
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
83508
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
83509
|
+
class GenericRegexConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
83510
|
+
constructor() {
|
|
83511
|
+
super(...arguments);
|
|
83512
|
+
/** List of forbidden regular expressions, case insensitive, checked against each line of every file.
|
|
83513
|
+
* Patterns use JavaScript regex syntax without enclosing slashes or flags.
|
|
83514
|
+
* @uniqueItems true
|
|
83515
|
+
*/
|
|
83516
|
+
this.regexes = [];
|
|
83517
|
+
}
|
|
83518
|
+
}
|
|
83519
|
+
exports.GenericRegexConf = GenericRegexConf;
|
|
83520
|
+
class GenericRegex {
|
|
83521
|
+
constructor() {
|
|
83522
|
+
this.conf = new GenericRegexConf();
|
|
83523
|
+
this.regexes = [];
|
|
83524
|
+
}
|
|
83525
|
+
getMetadata() {
|
|
83526
|
+
return {
|
|
83527
|
+
key: "generic_regex",
|
|
83528
|
+
title: "Generic regex",
|
|
83529
|
+
shortDescription: "Report an issue for each match of a configured regular expression.",
|
|
83530
|
+
extendedInformation: `Checks each line of every object file, including comments, strings, and XML.
|
|
83531
|
+
Patterns use JavaScript regular expression syntax without enclosing slashes or flags.
|
|
83532
|
+
Matching is case insensitive and does not span multiple lines. Each non-overlapping match is reported.
|
|
83533
|
+
Use the standard exclude configuration to skip files.
|
|
83534
|
+
|
|
83535
|
+
Example configuration: \`{"generic_regex": {"regexes": ["TODO", "BREAK-POINT"]}}\``,
|
|
83536
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
83537
|
+
};
|
|
83538
|
+
}
|
|
83539
|
+
getConfig() {
|
|
83540
|
+
return this.conf;
|
|
83541
|
+
}
|
|
83542
|
+
setConfig(conf) {
|
|
83543
|
+
var _a;
|
|
83544
|
+
this.conf = Object.assign(new GenericRegexConf(), conf);
|
|
83545
|
+
this.conf.regexes = (_a = this.conf.regexes) !== null && _a !== void 0 ? _a : [];
|
|
83546
|
+
}
|
|
83547
|
+
initialize(_reg) {
|
|
83548
|
+
this.regexes = this.conf.regexes.map(pattern => {
|
|
83549
|
+
try {
|
|
83550
|
+
return new RegExp(pattern, "gi");
|
|
83551
|
+
}
|
|
83552
|
+
catch (_a) {
|
|
83553
|
+
throw new Error(`generic_regex: Invalid regular expression "${pattern}"`);
|
|
83554
|
+
}
|
|
83555
|
+
});
|
|
83556
|
+
return this;
|
|
83557
|
+
}
|
|
83558
|
+
run(obj) {
|
|
83559
|
+
const issues = [];
|
|
83560
|
+
if (this.regexes.length === 0) {
|
|
83561
|
+
return issues;
|
|
83562
|
+
}
|
|
83563
|
+
for (const file of obj.getFiles()) {
|
|
83564
|
+
const rows = file.getRawRows();
|
|
83565
|
+
for (let row = 0; row < rows.length; row++) {
|
|
83566
|
+
const text = rows[row].replace(/\r$/, "");
|
|
83567
|
+
for (const regex of this.regexes) {
|
|
83568
|
+
regex.lastIndex = 0;
|
|
83569
|
+
for (;;) {
|
|
83570
|
+
const match = regex.exec(text);
|
|
83571
|
+
if (match === null) {
|
|
83572
|
+
break;
|
|
83573
|
+
}
|
|
83574
|
+
const startCol = match.index + 1;
|
|
83575
|
+
const message = `Text matches forbidden regular expression "${regex.source}"`;
|
|
83576
|
+
issues.push(issue_1.Issue.atRowRange(file, row + 1, startCol, startCol + match[0].length, message, this.getMetadata().key, this.conf.severity));
|
|
83577
|
+
if (match[0].length === 0) {
|
|
83578
|
+
regex.lastIndex++;
|
|
83579
|
+
}
|
|
83580
|
+
}
|
|
83581
|
+
}
|
|
83582
|
+
}
|
|
83583
|
+
}
|
|
83584
|
+
return issues;
|
|
83585
|
+
}
|
|
83586
|
+
}
|
|
83587
|
+
exports.GenericRegex = GenericRegex;
|
|
83588
|
+
//# sourceMappingURL=generic_regex.js.map
|
|
83589
|
+
|
|
83590
|
+
/***/ },
|
|
83591
|
+
|
|
83496
83592
|
/***/ "../core/build/src/rules/global_class.js"
|
|
83497
83593
|
/*!***********************************************!*\
|
|
83498
83594
|
!*** ../core/build/src/rules/global_class.js ***!
|
|
@@ -85407,6 +85503,7 @@ __exportStar(__webpack_require__(/*! ./fully_type_constants */ "../core/build/sr
|
|
|
85407
85503
|
__exportStar(__webpack_require__(/*! ./fully_type_itabs */ "../core/build/src/rules/fully_type_itabs.js"), exports);
|
|
85408
85504
|
__exportStar(__webpack_require__(/*! ./function_module_recommendations */ "../core/build/src/rules/function_module_recommendations.js"), exports);
|
|
85409
85505
|
__exportStar(__webpack_require__(/*! ./functional_writing */ "../core/build/src/rules/functional_writing.js"), exports);
|
|
85506
|
+
__exportStar(__webpack_require__(/*! ./generic_regex */ "../core/build/src/rules/generic_regex.js"), exports);
|
|
85410
85507
|
__exportStar(__webpack_require__(/*! ./global_class */ "../core/build/src/rules/global_class.js"), exports);
|
|
85411
85508
|
__exportStar(__webpack_require__(/*! ./identical_conditions */ "../core/build/src/rules/identical_conditions.js"), exports);
|
|
85412
85509
|
__exportStar(__webpack_require__(/*! ./identical_contents */ "../core/build/src/rules/identical_contents.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.73",
|
|
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.73",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|