@abaplint/cli 2.103.10 → 2.104.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 +96 -1
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -51033,7 +51033,7 @@ class Registry {
51033
51033
  }
51034
51034
  static abaplintVersion() {
51035
51035
  // magic, see build script "version.sh"
51036
- return "2.103.10";
51036
+ return "2.104.0";
51037
51037
  }
51038
51038
  getDDICReferences() {
51039
51039
  return this.ddicReferences;
@@ -61422,6 +61422,7 @@ __exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "./node_
61422
61422
  __exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js"), exports);
61423
61423
  __exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "./node_modules/@abaplint/core/build/src/rules/preferred_compare_operator.js"), exports);
61424
61424
  __exportStar(__webpack_require__(/*! ./prefix_is_current_class */ "./node_modules/@abaplint/core/build/src/rules/prefix_is_current_class.js"), exports);
61425
+ __exportStar(__webpack_require__(/*! ./reduce_procedural_code */ "./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js"), exports);
61425
61426
  __exportStar(__webpack_require__(/*! ./reduce_string_templates */ "./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js"), exports);
61426
61427
  __exportStar(__webpack_require__(/*! ./release_idoc */ "./node_modules/@abaplint/core/build/src/rules/release_idoc.js"), exports);
61427
61428
  __exportStar(__webpack_require__(/*! ./remove_descriptions */ "./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js"), exports);
@@ -67188,6 +67189,100 @@ exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
67188
67189
 
67189
67190
  /***/ }),
67190
67191
 
67192
+ /***/ "./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js":
67193
+ /*!*******************************************************************************!*\
67194
+ !*** ./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js ***!
67195
+ \*******************************************************************************/
67196
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
67197
+
67198
+ "use strict";
67199
+
67200
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
67201
+ exports.ReduceProceduralCode = exports.ReduceProceduralCodeConf = void 0;
67202
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
67203
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
67204
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
67205
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
67206
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
67207
+ class ReduceProceduralCodeConf extends _basic_rule_config_1.BasicRuleConfig {
67208
+ constructor() {
67209
+ super(...arguments);
67210
+ this.maxStatements = 10;
67211
+ }
67212
+ }
67213
+ exports.ReduceProceduralCodeConf = ReduceProceduralCodeConf;
67214
+ class ReduceProceduralCode extends _abap_rule_1.ABAPRule {
67215
+ constructor() {
67216
+ super(...arguments);
67217
+ this.conf = new ReduceProceduralCodeConf();
67218
+ }
67219
+ getMetadata() {
67220
+ return {
67221
+ key: "reduce_procedural_code",
67222
+ title: "Reduce procedural code",
67223
+ shortDescription: `Checks FORM and FUNCTION-MODULE have few statements`,
67224
+ extendedInformation: `Delegate logic to a class method instead of using FORM or FUNCTION-MODULE.
67225
+
67226
+ Only one issue is reported per include/file.
67227
+
67228
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-object-orientation-to-procedural-programming`,
67229
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
67230
+ badExample: `FORM foo.
67231
+ DATA lv_bar TYPE i.
67232
+ lv_bar = 2 + 2.
67233
+ IF lv_bar = 4.
67234
+ WRITE 'hello world'.
67235
+ ENDIF.
67236
+ DATA lv_bar TYPE i.
67237
+ lv_bar = 2 + 2.
67238
+ IF lv_bar = 4.
67239
+ WRITE 'hello world'.
67240
+ ENDIF.
67241
+ ENDFORM.`,
67242
+ goodExample: `FORM foo.
67243
+ NEW zcl_global_class( )->run_logic( ).
67244
+ ENDFORM.`,
67245
+ };
67246
+ }
67247
+ getConfig() {
67248
+ return this.conf;
67249
+ }
67250
+ setConfig(conf) {
67251
+ this.conf = conf;
67252
+ }
67253
+ runParsed(file) {
67254
+ const issues = [];
67255
+ if (file.getStructure() === undefined) {
67256
+ // constains syntax errors, skip this check
67257
+ return issues;
67258
+ }
67259
+ let doCount = undefined;
67260
+ let count = 0;
67261
+ for (const statement of file.getStatements()) {
67262
+ if (statement.get() instanceof Statements.Form || statement.get() instanceof Statements.FunctionModule) {
67263
+ doCount = statement;
67264
+ count = 0;
67265
+ }
67266
+ else if (statement.get() instanceof Statements.EndForm || statement.get() instanceof Statements.EndFunction) {
67267
+ if (count >= this.conf.maxStatements && doCount !== undefined) {
67268
+ const message = "Reduce procedural code, max " + this.conf.maxStatements + " statements";
67269
+ const issue = issue_1.Issue.atStatement(file, doCount, message, this.getMetadata().key, this.conf.severity);
67270
+ issues.push(issue);
67271
+ }
67272
+ doCount = undefined;
67273
+ }
67274
+ else if (doCount !== undefined) {
67275
+ count = count + 1;
67276
+ }
67277
+ }
67278
+ return issues;
67279
+ }
67280
+ }
67281
+ exports.ReduceProceduralCode = ReduceProceduralCode;
67282
+ //# sourceMappingURL=reduce_procedural_code.js.map
67283
+
67284
+ /***/ }),
67285
+
67191
67286
  /***/ "./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js":
67192
67287
  /*!********************************************************************************!*\
67193
67288
  !*** ./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.103.10",
3
+ "version": "2.104.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.103.10",
41
+ "@abaplint/core": "^2.104.0",
42
42
  "@types/chai": "^4.3.11",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.6",
46
- "@types/node": "^20.10.0",
46
+ "@types/node": "^20.10.1",
47
47
  "@types/progress": "^2.0.7",
48
48
  "chai": "^4.3.10",
49
49
  "chalk": "^5.3.0",