@abaplint/cli 2.101.36 → 2.102.0
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 +107 -11
- package/package.json +3 -3
package/build/cli.js
CHANGED
|
@@ -48465,7 +48465,7 @@ class Registry {
|
|
|
48465
48465
|
}
|
|
48466
48466
|
static abaplintVersion() {
|
|
48467
48467
|
// magic, see build script "version.sh"
|
|
48468
|
-
return "2.
|
|
48468
|
+
return "2.102.0";
|
|
48469
48469
|
}
|
|
48470
48470
|
getDDICReferences() {
|
|
48471
48471
|
return this.ddicReferences;
|
|
@@ -57147,6 +57147,7 @@ class FunctionModuleRecommendationsConf extends _basic_rule_config_1.BasicRuleCo
|
|
|
57147
57147
|
*/
|
|
57148
57148
|
this.recommendations = [
|
|
57149
57149
|
{ name: "CALCULATE_HASH_FOR_RAW", replace: "use CL_ABAP_HMAC or CL_ABAP_MESSAGE_DIGEST" },
|
|
57150
|
+
{ name: "CCU_TIMESTAMP_DIFFERENCE", replace: "use CL_ABAP_TSTMP" },
|
|
57150
57151
|
{ name: "ECATT_CONV_XSTRING_TO_STRING", replace: "use CL_BINARY_CONVERT" },
|
|
57151
57152
|
{ name: "F4_FILENAME", replace: "use CL_GUI_FRONTEND_SERVICES" },
|
|
57152
57153
|
{ name: "FUNCTION_EXISTS", replace: "surround with try-catch CX_SY_DYN_CALL_ILLEGAL_METHOD instead" },
|
|
@@ -58691,6 +58692,7 @@ __exportStar(__webpack_require__(/*! ./pragma_style */ "./node_modules/@abaplint
|
|
|
58691
58692
|
__exportStar(__webpack_require__(/*! ./prefer_corresponding */ "./node_modules/@abaplint/core/build/src/rules/prefer_corresponding.js"), exports);
|
|
58692
58693
|
__exportStar(__webpack_require__(/*! ./prefer_inline */ "./node_modules/@abaplint/core/build/src/rules/prefer_inline.js"), exports);
|
|
58693
58694
|
__exportStar(__webpack_require__(/*! ./prefer_is_not */ "./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js"), exports);
|
|
58695
|
+
__exportStar(__webpack_require__(/*! ./prefer_pragmas */ "./node_modules/@abaplint/core/build/src/rules/prefer_pragmas.js"), exports);
|
|
58694
58696
|
__exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ "./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js"), exports);
|
|
58695
58697
|
__exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js"), exports);
|
|
58696
58698
|
__exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js"), exports);
|
|
@@ -63778,6 +63780,91 @@ exports.PreferIsNot = PreferIsNot;
|
|
|
63778
63780
|
|
|
63779
63781
|
/***/ }),
|
|
63780
63782
|
|
|
63783
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/prefer_pragmas.js":
|
|
63784
|
+
/*!***********************************************************************!*\
|
|
63785
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/prefer_pragmas.js ***!
|
|
63786
|
+
\***********************************************************************/
|
|
63787
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
63788
|
+
|
|
63789
|
+
"use strict";
|
|
63790
|
+
|
|
63791
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
63792
|
+
exports.PreferPragmas = exports.PreferPragmasConf = void 0;
|
|
63793
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
63794
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
63795
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
63796
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
63797
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
63798
|
+
class PreferPragmasConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
63799
|
+
constructor() {
|
|
63800
|
+
super(...arguments);
|
|
63801
|
+
this.check = [
|
|
63802
|
+
{
|
|
63803
|
+
pseudo: "#EC CI_SUBRC",
|
|
63804
|
+
pragma: "SUBRC_OK",
|
|
63805
|
+
},
|
|
63806
|
+
{
|
|
63807
|
+
pseudo: "#EC NEEDED",
|
|
63808
|
+
pragma: "NEEDED",
|
|
63809
|
+
},
|
|
63810
|
+
{
|
|
63811
|
+
pseudo: "#EC NOTEXT",
|
|
63812
|
+
pragma: "NO_TEXT",
|
|
63813
|
+
},
|
|
63814
|
+
{
|
|
63815
|
+
pseudo: "#EC NO_HANDLER",
|
|
63816
|
+
pragma: "NO_HANDLER",
|
|
63817
|
+
},
|
|
63818
|
+
];
|
|
63819
|
+
}
|
|
63820
|
+
}
|
|
63821
|
+
exports.PreferPragmasConf = PreferPragmasConf;
|
|
63822
|
+
class PreferPragmas extends _abap_rule_1.ABAPRule {
|
|
63823
|
+
constructor() {
|
|
63824
|
+
super(...arguments);
|
|
63825
|
+
this.conf = new PreferPragmasConf();
|
|
63826
|
+
}
|
|
63827
|
+
getMetadata() {
|
|
63828
|
+
return {
|
|
63829
|
+
key: "prefer_pragmas",
|
|
63830
|
+
title: "prefer pragmas over pseudo comments ",
|
|
63831
|
+
shortDescription: `prefer pragmas over pseudo comments `,
|
|
63832
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-pragmas-to-pseudo-comments`,
|
|
63833
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
63834
|
+
};
|
|
63835
|
+
}
|
|
63836
|
+
getConfig() {
|
|
63837
|
+
return this.conf;
|
|
63838
|
+
}
|
|
63839
|
+
setConfig(conf) {
|
|
63840
|
+
this.conf = conf;
|
|
63841
|
+
}
|
|
63842
|
+
runParsed(file) {
|
|
63843
|
+
const issues = [];
|
|
63844
|
+
const config = this.getConfig();
|
|
63845
|
+
for (const statement of file.getStatements()) {
|
|
63846
|
+
if (!(statement.get() instanceof _statement_1.Comment)) {
|
|
63847
|
+
continue;
|
|
63848
|
+
}
|
|
63849
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
63850
|
+
if (concat.includes("#EC") === false) {
|
|
63851
|
+
continue;
|
|
63852
|
+
}
|
|
63853
|
+
for (const check of config.check) {
|
|
63854
|
+
if (concat.includes(check.pseudo.toUpperCase())) {
|
|
63855
|
+
const message = `Prefer pragma ${check.pragma}`;
|
|
63856
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.getConfig().severity));
|
|
63857
|
+
}
|
|
63858
|
+
}
|
|
63859
|
+
}
|
|
63860
|
+
return issues;
|
|
63861
|
+
}
|
|
63862
|
+
}
|
|
63863
|
+
exports.PreferPragmas = PreferPragmas;
|
|
63864
|
+
//# sourceMappingURL=prefer_pragmas.js.map
|
|
63865
|
+
|
|
63866
|
+
/***/ }),
|
|
63867
|
+
|
|
63781
63868
|
/***/ "./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js":
|
|
63782
63869
|
/*!***********************************************************************************!*\
|
|
63783
63870
|
!*** ./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js ***!
|
|
@@ -67405,7 +67492,6 @@ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/
|
|
|
67405
67492
|
class UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
67406
67493
|
}
|
|
67407
67494
|
exports.UnnecessaryReturnConf = UnnecessaryReturnConf;
|
|
67408
|
-
// todo: make this rule more intelligent, eg RETURN. ENDTRY. ENDMETHOD.
|
|
67409
67495
|
class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
|
|
67410
67496
|
constructor() {
|
|
67411
67497
|
super(...arguments);
|
|
@@ -67439,17 +67525,27 @@ ENDFORM.`,
|
|
|
67439
67525
|
if (structure === undefined) {
|
|
67440
67526
|
return [];
|
|
67441
67527
|
}
|
|
67528
|
+
const message = "Unnecessary RETURN";
|
|
67442
67529
|
const statements = file.getStatements();
|
|
67443
|
-
for (let i = 0; i < statements.length
|
|
67530
|
+
for (let i = 0; i < statements.length; i++) {
|
|
67444
67531
|
const node = statements[i];
|
|
67445
|
-
|
|
67446
|
-
|
|
67447
|
-
|
|
67448
|
-
|
|
67449
|
-
|
|
67450
|
-
|
|
67451
|
-
|
|
67452
|
-
|
|
67532
|
+
if (!(node.get() instanceof Statements.EndMethod
|
|
67533
|
+
|| node.get() instanceof Statements.EndForm
|
|
67534
|
+
|| node.get() instanceof Statements.EndFunction)) {
|
|
67535
|
+
continue;
|
|
67536
|
+
}
|
|
67537
|
+
const prev = statements[i - 1];
|
|
67538
|
+
if (prev && prev.get() instanceof Statements.Return) {
|
|
67539
|
+
const fix = edit_helper_1.EditHelper.deleteStatement(file, prev);
|
|
67540
|
+
issues.push(issue_1.Issue.atStatement(file, prev, message, this.getMetadata().key, this.getConfig().severity, fix));
|
|
67541
|
+
}
|
|
67542
|
+
const prevprev = statements[i - 2];
|
|
67543
|
+
if (prev && prevprev
|
|
67544
|
+
&& prevprev.get() instanceof Statements.Return
|
|
67545
|
+
&& (prev.get() instanceof Statements.EndIf
|
|
67546
|
+
|| prev.get() instanceof Statements.EndTry)) {
|
|
67547
|
+
const fix = edit_helper_1.EditHelper.deleteStatement(file, prevprev);
|
|
67548
|
+
issues.push(issue_1.Issue.atStatement(file, prevprev, message, this.getMetadata().key, this.getConfig().severity, fix));
|
|
67453
67549
|
}
|
|
67454
67550
|
}
|
|
67455
67551
|
return issues;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.102.0",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://abaplint.org",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@abaplint/core": "^2.
|
|
41
|
+
"@abaplint/core": "^2.102.0",
|
|
42
42
|
"@types/chai": "^4.3.5",
|
|
43
43
|
"@types/glob": "^7.2.0",
|
|
44
44
|
"@types/minimist": "^1.2.2",
|
|
45
45
|
"@types/mocha": "^10.0.1",
|
|
46
|
-
"@types/node": "^20.4.
|
|
46
|
+
"@types/node": "^20.4.2",
|
|
47
47
|
"@types/progress": "^2.0.5",
|
|
48
48
|
"chai": "^4.3.7",
|
|
49
49
|
"chalk": "^5.3.0",
|