@abaplint/cli 2.103.10 → 2.104.1

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
@@ -40873,8 +40873,8 @@ exports.MemoryFile = MemoryFile;
40873
40873
  "use strict";
40874
40874
 
40875
40875
  Object.defineProperty(exports, "__esModule", ({ value: true }));
40876
- exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
40877
- exports.RuleTag = void 0;
40876
+ exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
40877
+ exports.RuleTag = exports.Severity = void 0;
40878
40878
  const issue_1 = __webpack_require__(/*! ./issue */ "./node_modules/@abaplint/core/build/src/issue.js");
40879
40879
  Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
40880
40880
  const config_1 = __webpack_require__(/*! ./config */ "./node_modules/@abaplint/core/build/src/config.js");
@@ -40973,6 +40973,8 @@ const _irule_1 = __webpack_require__(/*! ./rules/_irule */ "./node_modules/@abap
40973
40973
  Object.defineProperty(exports, "RuleTag", ({ enumerable: true, get: function () { return _irule_1.RuleTag; } }));
40974
40974
  const cyclomatic_complexity_stats_1 = __webpack_require__(/*! ./utils/cyclomatic_complexity_stats */ "./node_modules/@abaplint/core/build/src/utils/cyclomatic_complexity_stats.js");
40975
40975
  Object.defineProperty(exports, "CyclomaticComplexityStats", ({ enumerable: true, get: function () { return cyclomatic_complexity_stats_1.CyclomaticComplexityStats; } }));
40976
+ const skip_logic_1 = __webpack_require__(/*! ./skip_logic */ "./node_modules/@abaplint/core/build/src/skip_logic.js");
40977
+ Object.defineProperty(exports, "SkipLogic", ({ enumerable: true, get: function () { return skip_logic_1.SkipLogic; } }));
40976
40978
  //# sourceMappingURL=index.js.map
40977
40979
 
40978
40980
  /***/ }),
@@ -51033,7 +51035,7 @@ class Registry {
51033
51035
  }
51034
51036
  static abaplintVersion() {
51035
51037
  // magic, see build script "version.sh"
51036
- return "2.103.10";
51038
+ return "2.104.1";
51037
51039
  }
51038
51040
  getDDICReferences() {
51039
51041
  return this.ddicReferences;
@@ -61422,6 +61424,7 @@ __exportStar(__webpack_require__(/*! ./prefer_returning_to_exporting */ "./node_
61422
61424
  __exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js"), exports);
61423
61425
  __exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "./node_modules/@abaplint/core/build/src/rules/preferred_compare_operator.js"), exports);
61424
61426
  __exportStar(__webpack_require__(/*! ./prefix_is_current_class */ "./node_modules/@abaplint/core/build/src/rules/prefix_is_current_class.js"), exports);
61427
+ __exportStar(__webpack_require__(/*! ./reduce_procedural_code */ "./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js"), exports);
61425
61428
  __exportStar(__webpack_require__(/*! ./reduce_string_templates */ "./node_modules/@abaplint/core/build/src/rules/reduce_string_templates.js"), exports);
61426
61429
  __exportStar(__webpack_require__(/*! ./release_idoc */ "./node_modules/@abaplint/core/build/src/rules/release_idoc.js"), exports);
61427
61430
  __exportStar(__webpack_require__(/*! ./remove_descriptions */ "./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js"), exports);
@@ -67188,6 +67191,98 @@ exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
67188
67191
 
67189
67192
  /***/ }),
67190
67193
 
67194
+ /***/ "./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js":
67195
+ /*!*******************************************************************************!*\
67196
+ !*** ./node_modules/@abaplint/core/build/src/rules/reduce_procedural_code.js ***!
67197
+ \*******************************************************************************/
67198
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
67199
+
67200
+ "use strict";
67201
+
67202
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
67203
+ exports.ReduceProceduralCode = exports.ReduceProceduralCodeConf = void 0;
67204
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
67205
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
67206
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
67207
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
67208
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
67209
+ class ReduceProceduralCodeConf extends _basic_rule_config_1.BasicRuleConfig {
67210
+ constructor() {
67211
+ super(...arguments);
67212
+ this.maxStatements = 10;
67213
+ }
67214
+ }
67215
+ exports.ReduceProceduralCodeConf = ReduceProceduralCodeConf;
67216
+ class ReduceProceduralCode extends _abap_rule_1.ABAPRule {
67217
+ constructor() {
67218
+ super(...arguments);
67219
+ this.conf = new ReduceProceduralCodeConf();
67220
+ }
67221
+ getMetadata() {
67222
+ return {
67223
+ key: "reduce_procedural_code",
67224
+ title: "Reduce procedural code",
67225
+ shortDescription: `Checks FORM and FUNCTION-MODULE have few statements`,
67226
+ extendedInformation: `Delegate logic to a class method instead of using FORM or FUNCTION-MODULE.
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 ***!
@@ -70325,6 +70420,8 @@ DATA: BEGIN OF blah ##NEEDED,
70325
70420
  && !(statement.get() instanceof Statements.Parameter)
70326
70421
  && !(statement.get() instanceof Statements.Data)
70327
70422
  && !(statement.get() instanceof Statements.DataBegin)
70423
+ && !(statement.get() instanceof Statements.ClassData)
70424
+ && !(statement.get() instanceof Statements.ClassDataBegin)
70328
70425
  && !(statement.get() instanceof Statements.Type)
70329
70426
  && !(statement.get() instanceof Statements.Form)
70330
70427
  && !(statement.get() instanceof Statements.Tables)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.103.10",
3
+ "version": "2.104.1",
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.1",
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",