@abaplint/cli 2.101.35 → 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.
Files changed (2) hide show
  1. package/build/cli.js +112 -13
  2. 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.101.35";
48468
+ return "2.102.0";
48469
48469
  }
48470
48470
  getDDICReferences() {
48471
48471
  return this.ddicReferences;
@@ -51649,7 +51649,7 @@ class CloudTypes {
51649
51649
  key: "cloud_types",
51650
51650
  title: "Check cloud types",
51651
51651
  shortDescription: `Checks that the package does not contain any object types unsupported in cloud ABAP.`,
51652
- tags: [_irule_1.RuleTag.SingleFile],
51652
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Syntax],
51653
51653
  };
51654
51654
  }
51655
51655
  getDescription(objectType) {
@@ -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 ***!
@@ -67241,7 +67328,9 @@ class UnnecessaryPragma extends _abap_rule_1.ABAPRule {
67241
67328
 
67242
67329
  * NO_TEXT without texts
67243
67330
 
67244
- * SUBRC_OK where sy-subrc is checked`,
67331
+ * SUBRC_OK where sy-subrc is checked
67332
+
67333
+ NO_HANDLER inside macros are not checked`,
67245
67334
  tags: [_irule_1.RuleTag.SingleFile],
67246
67335
  badExample: `TRY.
67247
67336
  ...
@@ -67372,6 +67461,7 @@ ENDIF.`,
67372
67461
  }
67373
67462
  if (next
67374
67463
  && next.get() instanceof _statement_1.Comment
67464
+ && !(statement.get() instanceof _statement_1.MacroContent)
67375
67465
  && next.concatTokens().toUpperCase().includes("#EC NO_HANDLER")) {
67376
67466
  return true;
67377
67467
  }
@@ -67402,7 +67492,6 @@ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/
67402
67492
  class UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {
67403
67493
  }
67404
67494
  exports.UnnecessaryReturnConf = UnnecessaryReturnConf;
67405
- // todo: make this rule more intelligent, eg RETURN. ENDTRY. ENDMETHOD.
67406
67495
  class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
67407
67496
  constructor() {
67408
67497
  super(...arguments);
@@ -67436,17 +67525,27 @@ ENDFORM.`,
67436
67525
  if (structure === undefined) {
67437
67526
  return [];
67438
67527
  }
67528
+ const message = "Unnecessary RETURN";
67439
67529
  const statements = file.getStatements();
67440
- for (let i = 0; i < statements.length - 1; i++) {
67530
+ for (let i = 0; i < statements.length; i++) {
67441
67531
  const node = statements[i];
67442
- const next = statements[i + 1];
67443
- if (node.get() instanceof Statements.Return
67444
- && (next.get() instanceof Statements.EndMethod
67445
- || next.get() instanceof Statements.EndForm
67446
- || next.get() instanceof Statements.EndFunction)) {
67447
- const message = "Unnecessary RETURN";
67448
- const fix = edit_helper_1.EditHelper.deleteStatement(file, node);
67449
- issues.push(issue_1.Issue.atStatement(file, node, message, this.getMetadata().key, this.getConfig().severity, fix));
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));
67450
67549
  }
67451
67550
  }
67452
67551
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.35",
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.101.35",
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.1",
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",