@abaplint/cli 2.113.216 → 2.113.218

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 +69 -22
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -437,7 +437,7 @@ class CodeClimate {
437
437
  end: issue.getEnd().getRow(),
438
438
  },
439
439
  },
440
- severity: (severityArray.includes(issue.getSeverity().toLowerCase())) ? issue.getSeverity().toLowerCase() : defaultSeverity,
440
+ severity: severityArray.includes(issue.getSeverity().toLowerCase()) ? issue.getSeverity().toLowerCase() : defaultSeverity,
441
441
  fingerprint: md5(issue.getKey() + issue.getMessage() + issue.getFilename() + issue.getStart().getRow() + issue.getEnd().getRow()),
442
442
  };
443
443
  out.push(single);
@@ -478,7 +478,7 @@ class CodeFrame {
478
478
  const builtIssues = this.convertAllIssues(issues).sort(issueSort); // Make sure it is sorted by filename for caching to work
479
479
  return [
480
480
  ...builtIssues.map(i => this.renderIssue(i)),
481
- (issues.length > 0 ? chalk_1.default.red(new total_1.Total().output(issues, fileCount)) : chalk_1.default.green(new total_1.Total().output(issues, fileCount))),
481
+ issues.length > 0 ? chalk_1.default.red(new total_1.Total().output(issues, fileCount)) : chalk_1.default.green(new total_1.Total().output(issues, fileCount)),
482
482
  ].join("\n");
483
483
  }
484
484
  convertAllIssues(issues) {
@@ -737,7 +737,7 @@ class Sonarqube {
737
737
  const single = {
738
738
  engineId: "abaplint",
739
739
  ruleId: issue.getKey(),
740
- severity: (severityArray.includes(issue.getSeverity().toUpperCase())) ? issue.getSeverity().toUpperCase() : defaultSeverity,
740
+ severity: severityArray.includes(issue.getSeverity().toUpperCase()) ? issue.getSeverity().toUpperCase() : defaultSeverity,
741
741
  type: "CODE_SMELL",
742
742
  primaryLocation: {
743
743
  message: issue.getMessage(),
@@ -1192,7 +1192,7 @@ class Rename {
1192
1192
  continue;
1193
1193
  }
1194
1194
  for (const p of rconfig.patterns || []) {
1195
- if (!(o.getType().match(p.type))) {
1195
+ if (!o.getType().match(p.type)) {
1196
1196
  continue;
1197
1197
  }
1198
1198
  const regex = new RegExp(p.oldName, "i");
@@ -4107,7 +4107,7 @@ exports.AssociationName = void 0;
4107
4107
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
4108
4108
  class AssociationName extends combi_1.Expression {
4109
4109
  getRunnable() {
4110
- return (0, combi_1.regex)(/^\\_[\w]+$/);
4110
+ return (0, combi_1.regex)(/^(\\_[\w]+)+$/);
4111
4111
  }
4112
4112
  }
4113
4113
  exports.AssociationName = AssociationName;
@@ -23835,7 +23835,7 @@ class TypeUtils {
23835
23835
  if (!(sourceRowType instanceof basic_1.StructureType)) {
23836
23836
  return false;
23837
23837
  }
23838
- else if (!(this.structureContainsString(sourceRowType))
23838
+ else if (!this.structureContainsString(sourceRowType)
23839
23839
  && this.structureContainsVoid(sourceRowType) === false) {
23840
23840
  return false;
23841
23841
  }
@@ -23845,7 +23845,7 @@ class TypeUtils {
23845
23845
  if (!(targetRowType instanceof basic_1.StructureType)) {
23846
23846
  return false;
23847
23847
  }
23848
- else if (!(this.structureContainsString(targetRowType))
23848
+ else if (!this.structureContainsString(targetRowType)
23849
23849
  && this.structureContainsVoid(targetRowType) === false) {
23850
23850
  return false;
23851
23851
  }
@@ -25643,7 +25643,7 @@ class CorrespondingBody {
25643
25643
  }
25644
25644
  const base = (_a = node.findDirectExpression(Expressions.CorrespondingBodyBase)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);
25645
25645
  if (base) {
25646
- source_1.Source.runSyntax(base, input);
25646
+ source_1.Source.runSyntax(base, input, targetType);
25647
25647
  }
25648
25648
  let type = undefined;
25649
25649
  for (const s of node.findDirectExpressions(Expressions.Source)) {
@@ -25959,8 +25959,10 @@ class FieldChain {
25959
25959
  }
25960
25960
  else if (current.get() instanceof tokens_1.Dash) {
25961
25961
  if (context instanceof basic_1.UnknownType) {
25962
+ /*
25962
25963
  const message = "Not a structure, type unknown, FieldChain";
25963
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
25964
+ input.issues.push(syntaxIssue(input, current.getFirstToken(), message));
25965
+ */
25964
25966
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
25965
25967
  }
25966
25968
  else if (!(context instanceof basic_1.StructureType)
@@ -32731,9 +32733,10 @@ const component_cond_1 = __webpack_require__(/*! ../expressions/component_cond *
32731
32733
  const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
32732
32734
  const loop_group_by_1 = __webpack_require__(/*! ../expressions/loop_group_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/loop_group_by.js");
32733
32735
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
32736
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
32734
32737
  class Loop {
32735
32738
  runSyntax(node, input) {
32736
- var _a;
32739
+ var _a, _b;
32737
32740
  const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
32738
32741
  let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
32739
32742
  const targetType = target ? target_1.Target.runSyntax(target, input) : undefined;
@@ -32783,6 +32786,7 @@ class Loop {
32783
32786
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32784
32787
  }
32785
32788
  const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
32789
+ const topType = sourceType; // todo: refactor topType vs sourceType vs rowType
32786
32790
  if (sourceType instanceof basic_1.TableType) {
32787
32791
  rowType = sourceType.getRowType();
32788
32792
  sourceType = rowType;
@@ -32790,6 +32794,10 @@ class Loop {
32790
32794
  sourceType = new basic_1.DataReference(sourceType);
32791
32795
  }
32792
32796
  }
32797
+ const cond = node.findDirectExpression(Expressions.ComponentCond);
32798
+ if (cond !== undefined) {
32799
+ component_cond_1.ComponentCond.runSyntax(cond, input, rowType);
32800
+ }
32793
32801
  if (targetConcat
32794
32802
  && targetConcat.startsWith("TRANSPORTING ")
32795
32803
  && node.findDirectTokenByText("WHERE") === undefined) {
@@ -32797,6 +32805,32 @@ class Loop {
32797
32805
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32798
32806
  return;
32799
32807
  }
32808
+ if (node.findDirectTokenByText("USING") !== undefined
32809
+ && cond !== undefined
32810
+ && topType instanceof basic_1.TableType) {
32811
+ // https://github.com/abap2xlsx/abap2xlsx/issues/1341
32812
+ const keyName = node.findExpressionAfterToken("KEY");
32813
+ let key = undefined;
32814
+ if ((keyName === null || keyName === void 0 ? void 0 : keyName.get()) instanceof Expressions.SimpleName) {
32815
+ // it might be dynamic, in that case we cannot check anything
32816
+ key = (_b = topType.getOptions().secondary) === null || _b === void 0 ? void 0 : _b.find(k => k.name.toUpperCase() === keyName.getFirstToken().getStr().toUpperCase());
32817
+ if (key === undefined) {
32818
+ const message = "Key " + (keyName === null || keyName === void 0 ? void 0 : keyName.concatTokens()) + " not found in table type";
32819
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32820
+ return;
32821
+ }
32822
+ if (input.scope.getRegistry().getConfig().getVersion() <= version_1.Version.v740sp02) {
32823
+ const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
32824
+ for (const keyField of key.keyFields) {
32825
+ if (compares.find(c => c === keyField.toUpperCase() + " IS INITIAL") !== undefined) {
32826
+ const message = "Loop, key check with IS INITIAL cannot optimized before 7.40 SP02";
32827
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32828
+ return;
32829
+ }
32830
+ }
32831
+ }
32832
+ }
32833
+ }
32800
32834
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
32801
32835
  if (inline) {
32802
32836
  inline_data_1.InlineData.runSyntax(inline, input, sourceType);
@@ -32817,9 +32851,6 @@ class Loop {
32817
32851
  fstarget_1.FSTarget.runSyntax(fstarget, input, sourceType);
32818
32852
  }
32819
32853
  }
32820
- for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
32821
- component_cond_1.ComponentCond.runSyntax(t, input, rowType);
32822
- }
32823
32854
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
32824
32855
  dynamic_1.Dynamic.runSyntax(t, input);
32825
32856
  }
@@ -41212,7 +41243,7 @@ const combi_1 = __webpack_require__(/*! ../../abap/2_statements/combi */ "./node
41212
41243
  class CDSCase extends combi_1.Expression {
41213
41244
  getRunnable() {
41214
41245
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName)));
41215
- const value = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, name);
41246
+ const value = (0, combi_1.altPrio)(_1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, _1.CDSFunction, name);
41216
41247
  const thenValue = (0, combi_1.altPrio)((0, combi_1.seq)("(", value, ")"), value);
41217
41248
  const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", thenValue)));
41218
41249
  const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", thenValue));
@@ -41343,7 +41374,7 @@ class CDSDefineCustom extends combi_1.Expression {
41343
41374
  getRunnable() {
41344
41375
  const field = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
41345
41376
  const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
41346
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), (0, combi_1.opt)(_1.CDSWithParameters), cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
41377
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
41347
41378
  }
41348
41379
  }
41349
41380
  exports.CDSDefineCustom = CDSDefineCustom;
@@ -54518,7 +54549,7 @@ class Registry {
54518
54549
  }
54519
54550
  static abaplintVersion() {
54520
54551
  // magic, see build script "version.sh"
54521
- return "2.113.216";
54552
+ return "2.113.218";
54522
54553
  }
54523
54554
  getDDICReferences() {
54524
54555
  return this.ddicReferences;
@@ -60556,7 +60587,6 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
60556
60587
  const source = high.findExpressionAfterToken("MESSAGE");
60557
60588
  if ((source === null || source === void 0 ? void 0 : source.get()) instanceof Expressions.MessageSourceSource
60558
60589
  && ((_a = source.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Source) {
60559
- ;
60560
60590
  const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
60561
60591
  const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
60562
60592
  const firstToken = high.getFirstToken();
@@ -63988,7 +64018,7 @@ class FullyTypeConstants extends _abap_rule_1.ABAPRule {
63988
64018
  for (const stat of file.getStatements()) {
63989
64019
  if ((stat.get() instanceof Statements.Constant
63990
64020
  || (this.conf.checkData === true && stat.get() instanceof Statements.Data))
63991
- && (!this.isTyped(stat))) {
64021
+ && !this.isTyped(stat)) {
63992
64022
  const type = stat.get() instanceof Statements.Constant ? "constant definition" : "data definition";
63993
64023
  let token = (_a = stat.findFirstExpression(expressions_1.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
63994
64024
  if (token === undefined) {
@@ -64003,7 +64033,7 @@ class FullyTypeConstants extends _abap_rule_1.ABAPRule {
64003
64033
  return issues;
64004
64034
  }
64005
64035
  isTyped(stat) {
64006
- return (stat.findFirstExpression(expressions_1.Type) || stat.findFirstExpression(expressions_1.TypeTable));
64036
+ return stat.findFirstExpression(expressions_1.Type) || stat.findFirstExpression(expressions_1.TypeTable);
64007
64037
  }
64008
64038
  }
64009
64039
  exports.FullyTypeConstants = FullyTypeConstants;
@@ -65216,7 +65246,7 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
65216
65246
  return [idef];
65217
65247
  }
65218
65248
  for (const m of this.findInterfaceMethods(idef)) {
65219
- if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {
65249
+ if (this.isAbstract(m, interfaceInfo, def)) {
65220
65250
  continue;
65221
65251
  }
65222
65252
  if (this.isImplemented(m, def, impl) === false) {
@@ -65235,6 +65265,23 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
65235
65265
  }
65236
65266
  return ret;
65237
65267
  }
65268
+ isAbstract(m, interfaceInfo, def) {
65269
+ if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {
65270
+ return true;
65271
+ }
65272
+ if (!def.superClassName) {
65273
+ return false;
65274
+ }
65275
+ // look up in superclass if method is abstract there
65276
+ const superClass = this.findClass(def.superClassName);
65277
+ const superInterface = superClass === null || superClass === void 0 ? void 0 : superClass.def.interfaces.find(iface => iface.name.toUpperCase() === m.objectName.toUpperCase());
65278
+ if (superClass && superInterface) {
65279
+ return this.isAbstract(m, superInterface, superClass.def);
65280
+ }
65281
+ else {
65282
+ return false;
65283
+ }
65284
+ }
65238
65285
  isImplemented(m, def, impl) {
65239
65286
  if (impl === undefined) {
65240
65287
  return false;
@@ -75597,9 +75644,9 @@ ENDFORM.`,
75597
75644
  for (let i = 0; i < statements.length; i++) {
75598
75645
  const node = statements[i];
75599
75646
  const nodeType = node.get();
75600
- if ((nodeType instanceof Statements.MethodImplementation
75647
+ if (nodeType instanceof Statements.MethodImplementation
75601
75648
  || nodeType instanceof Statements.Form
75602
- || nodeType instanceof Statements.FunctionModule)) {
75649
+ || nodeType instanceof Statements.FunctionModule) {
75603
75650
  statementCounter = 0;
75604
75651
  continue;
75605
75652
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.216",
3
+ "version": "2.113.218",
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.113.216",
41
+ "@abaplint/core": "^2.113.217",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",