@abaplint/cli 2.103.9 → 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 +100 -3
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -3960,9 +3960,11 @@ const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules
3960
3960
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/source.js");
3961
3961
  const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/dynamic.js");
3962
3962
  const field_1 = __webpack_require__(/*! ./field */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/field.js");
3963
+ const simple_source3_1 = __webpack_require__(/*! ./simple_source3 */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/simple_source3.js");
3964
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
3963
3965
  class AssignSource extends combi_1.Expression {
3964
3966
  getRunnable() {
3965
- const component = (0, combi_1.seq)("COMPONENT", source_1.Source, "OF STRUCTURE", source_1.Source);
3967
+ const component = (0, combi_1.seq)("COMPONENT", (0, combi_1.alt)(simple_source3_1.SimpleSource3, (0, combi_1.ver)(version_1.Version.v740sp02, source_1.Source)), "OF STRUCTURE", source_1.Source);
3966
3968
  const tableField = (0, combi_1.seq)("TABLE FIELD", (0, combi_1.alt)(source_1.Source, dynamic_1.Dynamic));
3967
3969
  const arrow = (0, combi_1.alt)((0, combi_1.tok)(tokens_1.InstanceArrow), (0, combi_1.tok)(tokens_1.StaticArrow));
3968
3970
  const source = (0, combi_1.alt)((0, combi_1.seq)(source_1.Source, (0, combi_1.opt)((0, combi_1.seq)(arrow, dynamic_1.Dynamic))), component, tableField, (0, combi_1.seq)(dynamic_1.Dynamic, (0, combi_1.opt)((0, combi_1.seq)(arrow, (0, combi_1.alt)(field_1.Field, dynamic_1.Dynamic)))));
@@ -28215,7 +28217,7 @@ class Assign {
28215
28217
  runSyntax(node, scope, filename) {
28216
28218
  var _a;
28217
28219
  const assignSource = node.findDirectExpression(Expressions.AssignSource);
28218
- const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressions(Expressions.Source)) || [];
28220
+ const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource3])) || [];
28219
28221
  const theSource = sources[sources.length - 1];
28220
28222
  let sourceType = undefined;
28221
28223
  const firstAssign = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getChildren()[0];
@@ -51031,7 +51033,7 @@ class Registry {
51031
51033
  }
51032
51034
  static abaplintVersion() {
51033
51035
  // magic, see build script "version.sh"
51034
- return "2.103.9";
51036
+ return "2.104.0";
51035
51037
  }
51036
51038
  getDDICReferences() {
51037
51039
  return this.ddicReferences;
@@ -61420,6 +61422,7 @@ __exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "./node_
61420
61422
  __exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js"), exports);
61421
61423
  __exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "./node_modules/@abaplint/core/build/src/rules/preferred_compare_operator.js"), exports);
61422
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);
61423
61426
  __exportStar(__webpack_require__(/*! ./reduce_string_templates */ "./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js"), exports);
61424
61427
  __exportStar(__webpack_require__(/*! ./release_idoc */ "./node_modules/@abaplint/core/build/src/rules/release_idoc.js"), exports);
61425
61428
  __exportStar(__webpack_require__(/*! ./remove_descriptions */ "./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js"), exports);
@@ -67186,6 +67189,100 @@ exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
67186
67189
 
67187
67190
  /***/ }),
67188
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
+
67189
67286
  /***/ "./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js":
67190
67287
  /*!********************************************************************************!*\
67191
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.9",
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.9",
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.9.4",
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",