@abaplint/cli 2.102.41 → 2.102.42

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 +37 -14
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -36801,7 +36801,7 @@ class MethodDefinition extends _identifier_1.Identifier {
36801
36801
  this.exceptions.push(name);
36802
36802
  }
36803
36803
  this.visibility = visibility;
36804
- this.parameters = new method_parameters_1.MethodParameters(node, this.filename, scope);
36804
+ this.parameters = new method_parameters_1.MethodParameters(node, this.filename, scope, this.abstract);
36805
36805
  }
36806
36806
  getVisibility() {
36807
36807
  return this.visibility;
@@ -36959,7 +36959,7 @@ const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "./node
36959
36959
  // this.exceptions = [];
36960
36960
  // also consider RAISING vs EXCEPTIONS
36961
36961
  class MethodParameters {
36962
- constructor(node, filename, scope) {
36962
+ constructor(node, filename, scope, abstractMethod) {
36963
36963
  if (!(node.get() instanceof method_def_1.MethodDef)) {
36964
36964
  throw new Error("MethodDefinition, expected MethodDef as part of input node");
36965
36965
  }
@@ -36975,7 +36975,7 @@ class MethodParameters {
36975
36975
  // need the scope for LIKE typing inside method parameters
36976
36976
  const parentName = scope.getName();
36977
36977
  scope.push(_scope_type_1.ScopeType.MethodDefinition, "method definition", node.getStart(), filename);
36978
- this.parse(node, scope, filename, parentName);
36978
+ this.parse(node, scope, filename, parentName, abstractMethod);
36979
36979
  scope.pop(node.getEnd());
36980
36980
  }
36981
36981
  getFilename() {
@@ -37051,7 +37051,7 @@ class MethodParameters {
37051
37051
  return this.defaults[parameter.toUpperCase()];
37052
37052
  }
37053
37053
  ///////////////////
37054
- parse(node, scope, filename, parentName) {
37054
+ parse(node, scope, filename, parentName, abstractMethod) {
37055
37055
  var _a, _b;
37056
37056
  const handler = node.findFirstExpression(Expressions.EventHandler);
37057
37057
  if (handler) {
@@ -37091,7 +37091,7 @@ class MethodParameters {
37091
37091
  }
37092
37092
  const importing = node.findFirstExpression(Expressions.MethodDefImporting);
37093
37093
  if (importing) {
37094
- this.add(this.importing, importing, scope, ["importing" /* IdentifierMeta.MethodImporting */]);
37094
+ this.add(this.importing, importing, scope, ["importing" /* IdentifierMeta.MethodImporting */], abstractMethod);
37095
37095
  if (importing.concatTokens().toUpperCase().includes(" PREFERRED PARAMETER")) {
37096
37096
  this.preferred = importing.getLastToken().getStr().toUpperCase();
37097
37097
  if (this.preferred.startsWith("!")) {
@@ -37101,11 +37101,11 @@ class MethodParameters {
37101
37101
  }
37102
37102
  const exporting = node.findFirstExpression(Expressions.MethodDefExporting);
37103
37103
  if (exporting) {
37104
- this.add(this.exporting, exporting, scope, ["exporting" /* IdentifierMeta.MethodExporting */]);
37104
+ this.add(this.exporting, exporting, scope, ["exporting" /* IdentifierMeta.MethodExporting */], abstractMethod);
37105
37105
  }
37106
37106
  const changing = node.findFirstExpression(Expressions.MethodDefChanging);
37107
37107
  if (changing) {
37108
- this.add(this.changing, changing, scope, ["changing" /* IdentifierMeta.MethodChanging */]);
37108
+ this.add(this.changing, changing, scope, ["changing" /* IdentifierMeta.MethodChanging */], abstractMethod);
37109
37109
  }
37110
37110
  const returning = node.findFirstExpression(Expressions.MethodDefReturning);
37111
37111
  if (returning) {
@@ -37151,7 +37151,7 @@ class MethodParameters {
37151
37151
  this.importing.push(...tempImporting);
37152
37152
  }
37153
37153
  }
37154
- add(target, source, scope, meta) {
37154
+ add(target, source, scope, meta, abstractMethod) {
37155
37155
  var _a;
37156
37156
  for (const opt of source.findAllExpressions(Expressions.MethodParamOptional)) {
37157
37157
  const p = opt.findDirectExpression(Expressions.MethodParam);
@@ -37165,6 +37165,9 @@ class MethodParameters {
37165
37165
  else if (meta.includes("importing" /* IdentifierMeta.MethodImporting */)) {
37166
37166
  extraMeta.push("read_only" /* IdentifierMeta.ReadOnly */);
37167
37167
  }
37168
+ if (abstractMethod === true) {
37169
+ extraMeta.push("abstract" /* IdentifierMeta.Abstract */);
37170
+ }
37168
37171
  const id = new method_param_1.MethodParam().runSyntax(p, scope, this.filename, [...meta, ...extraMeta]);
37169
37172
  scope.addIdentifier(id);
37170
37173
  target.push(id);
@@ -48893,7 +48896,7 @@ class Registry {
48893
48896
  }
48894
48897
  static abaplintVersion() {
48895
48898
  // magic, see build script "version.sh"
48896
- return "2.102.41";
48899
+ return "2.102.42";
48897
48900
  }
48898
48901
  getDDICReferences() {
48899
48902
  return this.ddicReferences;
@@ -61182,7 +61185,9 @@ class MethodLength {
61182
61185
  key: "method_length",
61183
61186
  title: "Method/Form Length",
61184
61187
  shortDescription: `Checks relating to method/form length.`,
61185
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-methods-small`,
61188
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-methods-small
61189
+
61190
+ Abstract methods without statements are considered okay.`,
61186
61191
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
61187
61192
  };
61188
61193
  }
@@ -61227,6 +61232,9 @@ class MethodLength {
61227
61232
  continue;
61228
61233
  }
61229
61234
  if (s.count === 0 && this.conf.errorWhenEmpty === true) {
61235
+ if (this.isAbstract(s)) {
61236
+ continue;
61237
+ }
61230
61238
  const issue = issue_1.Issue.atPosition(s.file, s.pos, this.getDescription(IssueType.EmptyMethod, "0", type), this.getMetadata().key, this.conf.severity);
61231
61239
  issues.push(issue);
61232
61240
  continue;
@@ -61239,6 +61247,10 @@ class MethodLength {
61239
61247
  }
61240
61248
  return issues;
61241
61249
  }
61250
+ isAbstract(result) {
61251
+ const cdef = result.file.getInfo().getClassDefinitionByName(result.className);
61252
+ return (cdef === null || cdef === void 0 ? void 0 : cdef.isAbstract) === true;
61253
+ }
61242
61254
  }
61243
61255
  exports.MethodLength = MethodLength;
61244
61256
  //# sourceMappingURL=method_length.js.map
@@ -68809,6 +68821,8 @@ class UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {
68809
68821
  * @uniqueItems true
68810
68822
  */
68811
68823
  this.skipNames = [];
68824
+ /** skip parameters from abstract methods */
68825
+ this.skipAbstract = false;
68812
68826
  }
68813
68827
  }
68814
68828
  exports.UnusedVariablesConf = UnusedVariablesConf;
@@ -68951,6 +68965,9 @@ Errors found in INCLUDES are reported for the main program.`,
68951
68965
  && this.conf.skipNames.some((a) => a.toUpperCase() === name)) {
68952
68966
  continue;
68953
68967
  }
68968
+ else if (this.conf.skipAbstract === true && meta.includes("abstract" /* IdentifierMeta.Abstract */)) {
68969
+ continue;
68970
+ }
68954
68971
  else if (name === "ME"
68955
68972
  || name === "SUPER"
68956
68973
  || meta.includes("selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */)
@@ -70096,7 +70113,7 @@ class FormLengthStats {
70096
70113
  }
70097
70114
  else if (type instanceof Statements.EndForm) {
70098
70115
  if (pos) {
70099
- res.push({ name, count, file, pos });
70116
+ res.push({ name: name, className: "", count, file, pos });
70100
70117
  }
70101
70118
  else {
70102
70119
  continue;
@@ -70349,31 +70366,37 @@ exports.IncludeGraph = IncludeGraph;
70349
70366
  Object.defineProperty(exports, "__esModule", ({ value: true }));
70350
70367
  exports.MethodLengthStats = void 0;
70351
70368
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
70369
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
70352
70370
  const expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
70353
70371
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
70354
70372
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
70355
70373
  class MethodLengthStats {
70356
70374
  static run(obj) {
70375
+ var _a;
70357
70376
  const res = [];
70358
70377
  let pos = undefined;
70359
- let name = "";
70378
+ let methodName = "";
70360
70379
  let count = 0;
70361
70380
  let method = false;
70362
70381
  if (!(obj instanceof _abap_object_1.ABAPObject)) {
70363
70382
  return [];
70364
70383
  }
70365
70384
  for (const file of obj.getABAPFiles()) {
70385
+ let className = "";
70366
70386
  for (const stat of file.getStatements()) {
70367
70387
  const type = stat.get();
70368
70388
  if (type instanceof Statements.MethodImplementation) {
70369
70389
  pos = stat.getFirstToken().getStart();
70370
- name = this.findName(stat);
70390
+ methodName = this.findName(stat);
70371
70391
  method = true;
70372
70392
  count = 0;
70373
70393
  }
70394
+ else if (type instanceof Statements.ClassImplementation) {
70395
+ className = ((_a = stat.findFirstExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "INTERNAL_ERROR";
70396
+ }
70374
70397
  else if (type instanceof Statements.EndMethod) {
70375
70398
  if (pos) {
70376
- res.push({ name, count, file, pos });
70399
+ res.push({ name: methodName, className, count, file, pos });
70377
70400
  }
70378
70401
  else {
70379
70402
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.41",
3
+ "version": "2.102.42",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,19 +38,19 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.41",
41
+ "@abaplint/core": "^2.102.42",
42
42
  "@types/chai": "^4.3.6",
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.6.0",
46
+ "@types/node": "^20.6.2",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.8",
49
49
  "chalk": "^5.3.0",
50
50
  "eslint": "^8.49.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^4.2.1",
53
+ "memfs": "^4.3.0",
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",