@abaplint/cli 2.119.39 → 2.119.41

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 +120 -8
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -37437,6 +37437,7 @@ class DeleteInternal {
37437
37437
  if (tabl === undefined) {
37438
37438
  targetType = target_1.Target.runSyntax(target, input);
37439
37439
  if (node.findDirectTokenByText("TABLE") === undefined
37440
+ && node.findDirectTokenByText("ADJACENT") === undefined
37440
37441
  && node.findDirectTokenByText("FROM")
37441
37442
  && targetType instanceof basic_1.TableType
37442
37443
  && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
@@ -54065,8 +54066,8 @@ var __importStar = (this && this.__importStar) || (function () {
54065
54066
  };
54066
54067
  })();
54067
54068
  Object.defineProperty(exports, "__esModule", ({ value: true }));
54068
- exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = 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.Version = exports.Config = exports.Issue = void 0;
54069
- exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = void 0;
54069
+ exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = 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.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.Version = exports.Config = exports.Issue = void 0;
54070
+ exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = void 0;
54070
54071
  const issue_1 = __webpack_require__(/*! ./issue */ "../core/build/src/issue.js");
54071
54072
  Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
54072
54073
  const config_1 = __webpack_require__(/*! ./config */ "../core/build/src/config.js");
@@ -54172,6 +54173,10 @@ const _edit_1 = __webpack_require__(/*! ./lsp/_edit */ "../core/build/src/lsp/_e
54172
54173
  Object.defineProperty(exports, "LSPEdit", ({ enumerable: true, get: function () { return _edit_1.LSPEdit; } }));
54173
54174
  const _reference_1 = __webpack_require__(/*! ./abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
54174
54175
  Object.defineProperty(exports, "ReferenceType", ({ enumerable: true, get: function () { return _reference_1.ReferenceType; } }));
54176
+ const function_length_stats_1 = __webpack_require__(/*! ./utils/function_length_stats */ "../core/build/src/utils/function_length_stats.js");
54177
+ Object.defineProperty(exports, "FunctionLengthStats", ({ enumerable: true, get: function () { return function_length_stats_1.FunctionLengthStats; } }));
54178
+ const form_length_stats_1 = __webpack_require__(/*! ./utils/form_length_stats */ "../core/build/src/utils/form_length_stats.js");
54179
+ Object.defineProperty(exports, "FormLengthStats", ({ enumerable: true, get: function () { return form_length_stats_1.FormLengthStats; } }));
54175
54180
  // do not include this file from anywhere within abaplint
54176
54181
  // https://github.com/abaplint/abaplint/issues/873
54177
54182
  const Edits = {
@@ -66577,7 +66582,7 @@ class Registry {
66577
66582
  }
66578
66583
  static abaplintVersion() {
66579
66584
  // magic, see build script "version.js"
66580
- return "2.119.39";
66585
+ return "2.119.41";
66581
66586
  }
66582
66587
  getDDICReferences() {
66583
66588
  return this.ddicReferences;
@@ -82781,17 +82786,20 @@ const method_length_stats_1 = __webpack_require__(/*! ../utils/method_length_sta
82781
82786
  const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
82782
82787
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
82783
82788
  const form_length_stats_1 = __webpack_require__(/*! ../utils/form_length_stats */ "../core/build/src/utils/form_length_stats.js");
82789
+ const function_length_stats_1 = __webpack_require__(/*! ../utils/function_length_stats */ "../core/build/src/utils/function_length_stats.js");
82784
82790
  class MethodLengthConf extends _basic_rule_config_1.BasicRuleConfig {
82785
82791
  constructor() {
82786
82792
  super(...arguments);
82787
- /** Maximum method/form length in statements. */
82793
+ /** Maximum method/form/function module length in statements. */
82788
82794
  this.statements = 100;
82789
- /** Checks for empty methods/forms. */
82795
+ /** Checks for empty methods/forms/function modules. */
82790
82796
  this.errorWhenEmpty = true;
82791
82797
  /** Option to ignore test classes for this check. */
82792
82798
  this.ignoreTestClasses = false;
82793
82799
  /** Option to check forms. */
82794
82800
  this.checkForms = true;
82801
+ /** Option to check function modules. */
82802
+ this.checkFunctionModules = true;
82795
82803
  }
82796
82804
  }
82797
82805
  exports.MethodLengthConf = MethodLengthConf;
@@ -82807,8 +82815,8 @@ class MethodLength {
82807
82815
  getMetadata() {
82808
82816
  return {
82809
82817
  key: "method_length",
82810
- title: "Method/Form Length",
82811
- shortDescription: `Checks relating to method/form length.`,
82818
+ title: "Method/Form/Function Module Length",
82819
+ shortDescription: `Checks relating to method/form/function module length.`,
82812
82820
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-methods-small
82813
82821
 
82814
82822
  Abstract methods without statements are considered okay.`,
@@ -82851,7 +82859,12 @@ Abstract methods without statements are considered okay.`,
82851
82859
  const formStats = form_length_stats_1.FormLengthStats.run(obj);
82852
82860
  formIssues = this.check(formStats, "FORM");
82853
82861
  }
82854
- return methodIssues.concat(formIssues);
82862
+ let functionIssues = [];
82863
+ if (this.conf.checkFunctionModules) {
82864
+ const functionStats = function_length_stats_1.FunctionLengthStats.run(obj);
82865
+ functionIssues = this.check(functionStats, "FUNCTION MODULE");
82866
+ }
82867
+ return methodIssues.concat(formIssues).concat(functionIssues);
82855
82868
  }
82856
82869
  // ***********************
82857
82870
  check(stats, type) {
@@ -95489,6 +95502,105 @@ exports.FormLengthStats = FormLengthStats;
95489
95502
 
95490
95503
  /***/ },
95491
95504
 
95505
+ /***/ "../core/build/src/utils/function_length_stats.js"
95506
+ /*!********************************************************!*\
95507
+ !*** ../core/build/src/utils/function_length_stats.js ***!
95508
+ \********************************************************/
95509
+ (__unused_webpack_module, exports, __webpack_require__) {
95510
+
95511
+ "use strict";
95512
+
95513
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
95514
+ if (k2 === undefined) k2 = k;
95515
+ var desc = Object.getOwnPropertyDescriptor(m, k);
95516
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
95517
+ desc = { enumerable: true, get: function() { return m[k]; } };
95518
+ }
95519
+ Object.defineProperty(o, k2, desc);
95520
+ }) : (function(o, m, k, k2) {
95521
+ if (k2 === undefined) k2 = k;
95522
+ o[k2] = m[k];
95523
+ }));
95524
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
95525
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
95526
+ }) : function(o, v) {
95527
+ o["default"] = v;
95528
+ });
95529
+ var __importStar = (this && this.__importStar) || (function () {
95530
+ var ownKeys = function(o) {
95531
+ ownKeys = Object.getOwnPropertyNames || function (o) {
95532
+ var ar = [];
95533
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
95534
+ return ar;
95535
+ };
95536
+ return ownKeys(o);
95537
+ };
95538
+ return function (mod) {
95539
+ if (mod && mod.__esModule) return mod;
95540
+ var result = {};
95541
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
95542
+ __setModuleDefault(result, mod);
95543
+ return result;
95544
+ };
95545
+ })();
95546
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
95547
+ exports.FunctionLengthStats = void 0;
95548
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
95549
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
95550
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
95551
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
95552
+ class FunctionLengthStats {
95553
+ static run(obj) {
95554
+ const res = [];
95555
+ let pos = undefined;
95556
+ let name = "";
95557
+ let count = 0;
95558
+ let func = false;
95559
+ if (!(obj instanceof _abap_object_1.ABAPObject)) {
95560
+ return [];
95561
+ }
95562
+ for (const file of obj.getABAPFiles()) {
95563
+ for (const stat of file.getStatements()) {
95564
+ const type = stat.get();
95565
+ if (type instanceof Statements.FunctionModule) {
95566
+ pos = stat.getFirstToken().getStart();
95567
+ name = this.findName(stat);
95568
+ func = true;
95569
+ count = 0;
95570
+ }
95571
+ else if (type instanceof Statements.EndFunction) {
95572
+ if (pos) {
95573
+ res.push({ name: name, className: "", count, file, pos });
95574
+ }
95575
+ else {
95576
+ continue;
95577
+ }
95578
+ func = false;
95579
+ }
95580
+ else if (func === true
95581
+ && !(type instanceof _statement_1.Comment)
95582
+ && !(type instanceof _statement_1.Empty)) {
95583
+ count = count + 1;
95584
+ }
95585
+ }
95586
+ }
95587
+ return res;
95588
+ }
95589
+ static findName(stat) {
95590
+ const nameExpr = stat.findFirstExpression(Expressions.Field);
95591
+ if (nameExpr) {
95592
+ return nameExpr.getFirstToken().getStr();
95593
+ }
95594
+ else {
95595
+ throw new Error("FunctionLength, findName, expected Field");
95596
+ }
95597
+ }
95598
+ }
95599
+ exports.FunctionLengthStats = FunctionLengthStats;
95600
+ //# sourceMappingURL=function_length_stats.js.map
95601
+
95602
+ /***/ },
95603
+
95492
95604
  /***/ "../core/build/src/utils/include_graph.js"
95493
95605
  /*!************************************************!*\
95494
95606
  !*** ../core/build/src/utils/include_graph.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.39",
3
+ "version": "2.119.41",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.119.39",
41
+ "@abaplint/core": "^2.119.41",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",
@@ -49,7 +49,7 @@
49
49
  "eslint": "^9.39.4",
50
50
  "glob": "^13.0.6",
51
51
  "json5": "^2.2.3",
52
- "memfs": "^4.57.7",
52
+ "memfs": "^4.57.8",
53
53
  "minimist": "^1.2.8",
54
54
  "mocha": "^11.7.6",
55
55
  "p-limit": "^3.1.0",