@abaplint/cli 2.101.20 → 2.101.22

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 +70 -57
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -48453,7 +48453,7 @@ class Registry {
48453
48453
  }
48454
48454
  static abaplintVersion() {
48455
48455
  // magic, see build script "version.sh"
48456
- return "2.101.20";
48456
+ return "2.101.22";
48457
48457
  }
48458
48458
  getDDICReferences() {
48459
48459
  return this.ddicReferences;
@@ -49721,6 +49721,10 @@ class AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {
49721
49721
  this.testSeams = true;
49722
49722
  /** Detects DESCRIBE TABLE LINES, use lines() instead */
49723
49723
  this.describeLines = true;
49724
+ /** Detects EXPORT TO MEMORY */
49725
+ this.exportToMemory = true;
49726
+ /** Detects EXPORT TO DATABASE */
49727
+ this.exportToDatabase = true;
49724
49728
  }
49725
49729
  }
49726
49730
  exports.AvoidUseConf = AvoidUseConf;
@@ -49780,6 +49784,12 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
49780
49784
  else if (this.conf.statics && statement instanceof Statements.StaticEnd) {
49781
49785
  isStaticsBlock = false;
49782
49786
  }
49787
+ else if (this.conf.exportToMemory && statement instanceof Statements.Export && statementNode.concatTokens().includes("TO MEMORY ")) {
49788
+ message = "EXPORT TO MEMORY";
49789
+ }
49790
+ else if (this.conf.exportToDatabase && statement instanceof Statements.Export && statementNode.concatTokens().includes("TO DATABASE ")) {
49791
+ message = "EXPORT TO DATABASE";
49792
+ }
49783
49793
  else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {
49784
49794
  message = "TEST-SEAM";
49785
49795
  }
@@ -54109,7 +54119,7 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
54109
54119
  bar->if_t100_dyn_msg~msgv4 = 'abc'.
54110
54120
  RAISE EXCEPTION bar.
54111
54121
  */
54112
- var _a, _b, _c;
54122
+ var _a, _b, _c, _d, _e, _f, _g;
54113
54123
  if (!(node.get() instanceof Statements.Raise)) {
54114
54124
  return undefined;
54115
54125
  }
@@ -54133,20 +54143,45 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
54133
54143
  if (s === undefined) {
54134
54144
  return undefined;
54135
54145
  }
54136
- id = "'" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + "'";
54137
- number = "'" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + "'";
54146
+ if (s.findDirectExpression(Expressions.MessageClass)) {
54147
+ id = "'" + ((_b = (_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "'";
54148
+ }
54149
+ else {
54150
+ id = (_c = s.findExpressionAfterToken("ID")) === null || _c === void 0 ? void 0 : _c.concatTokens();
54151
+ }
54152
+ if (s.findDirectExpression(Expressions.MessageTypeAndNumber)) {
54153
+ number = "'" + ((_d = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _d === void 0 ? void 0 : _d.concatTokens().substring(1)) + "'";
54154
+ }
54155
+ else {
54156
+ number = (_e = s.findExpressionAfterToken("NUMBER")) === null || _e === void 0 ? void 0 : _e.concatTokens();
54157
+ }
54138
54158
  startToken = node.getFirstToken();
54139
54159
  }
54140
- const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "ERROR";
54160
+ const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.Source)) || [];
54161
+ const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
54141
54162
  const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54142
54163
  const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54143
54164
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
54144
- const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
54145
- ${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.
54146
- ${indentation}${uniqueName1}-msgno = ${number}.
54147
- ${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
54148
- ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.
54149
- ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
54165
+ let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
54166
+ ${indentation}${uniqueName1}-msgid = ${id}.
54167
+ ${indentation}${uniqueName1}-msgno = ${number}.\n`;
54168
+ if (withs.length > 0) {
54169
+ abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
54170
+ ${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
54171
+ ${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
54172
+ ${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
54173
+ }
54174
+ abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
54175
+ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
54176
+ if (withs.length > 0) {
54177
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
54178
+ }
54179
+ let count = 1;
54180
+ for (const w of withs) {
54181
+ abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgv${count} = ${w.concatTokens()}.\n`;
54182
+ count++;
54183
+ }
54184
+ abap += `${indentation}RAISE EXCEPTION ${uniqueName2}.`;
54150
54185
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
54151
54186
  return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
54152
54187
  }
@@ -54616,50 +54651,36 @@ ${indentation}${uniqueName}`;
54616
54651
  }
54617
54652
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
54618
54653
  stringTemplateAlpha(low, high, lowFile, highSyntax) {
54619
- var _a, _b, _c;
54654
+ var _a, _b;
54620
54655
  if (!(low.get() instanceof _statement_1.Unknown)) {
54621
54656
  return undefined;
54622
54657
  }
54623
54658
  else if (!(high.get() instanceof Statements.Move)) {
54624
54659
  return undefined;
54625
54660
  }
54626
- const topSource = high.findDirectExpression(Expressions.Source);
54627
- if (topSource === undefined || topSource.getChildren().length !== 1) {
54628
- return undefined;
54629
- }
54630
- let top = true;
54631
- let child = topSource.getFirstChild();
54632
- if (!(child.get() instanceof Expressions.StringTemplate)) {
54633
- child = child.findFirstExpression(Expressions.StringTemplate);
54634
- top = false;
54635
- }
54636
- if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {
54637
- return undefined;
54638
- }
54639
- const templateTokens = child.getChildren();
54640
- if (templateTokens.length !== 3
54641
- || templateTokens[0].getFirstToken().getStr() !== "|{"
54642
- || templateTokens[2].getFirstToken().getStr() !== "}|") {
54643
- return undefined;
54644
- }
54645
- const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
54646
- const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
54647
- let functionName = "";
54648
- switch (formatting) {
54649
- case "ALPHA = IN":
54650
- functionName = "CONVERSION_EXIT_ALPHA_INPUT";
54651
- break;
54652
- case "ALPHA = OUT":
54653
- functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
54654
- break;
54655
- default:
54661
+ for (const child of high.findAllExpressionsRecursive(Expressions.StringTemplate)) {
54662
+ const templateTokens = child.getChildren();
54663
+ if (templateTokens.length !== 3
54664
+ || templateTokens[0].getFirstToken().getStr() !== "|{"
54665
+ || templateTokens[2].getFirstToken().getStr() !== "}|") {
54656
54666
  return undefined;
54657
- }
54658
- const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
54659
- const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
54660
- const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
54661
- const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54662
- if (top === false) {
54667
+ }
54668
+ const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);
54669
+ const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();
54670
+ let functionName = "";
54671
+ switch (formatting) {
54672
+ case "ALPHA = IN":
54673
+ functionName = "CONVERSION_EXIT_ALPHA_INPUT";
54674
+ break;
54675
+ case "ALPHA = OUT":
54676
+ functionName = "CONVERSION_EXIT_ALPHA_OUTPUT";
54677
+ break;
54678
+ default:
54679
+ return undefined;
54680
+ }
54681
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
54682
+ const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
54683
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
54663
54684
  const code = `DATA ${uniqueName} TYPE string.
54664
54685
  ${indentation}CALL FUNCTION '${functionName}'
54665
54686
  ${indentation} EXPORTING
@@ -54671,15 +54692,7 @@ ${indentation} output = ${uniqueName}.\n`;
54671
54692
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
54672
54693
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
54673
54694
  }
54674
- else {
54675
- const code = `CALL FUNCTION '${functionName}'
54676
- ${indentation} EXPORTING
54677
- ${indentation} input = ${source}
54678
- ${indentation} IMPORTING
54679
- ${indentation} output = ${topTarget}.`;
54680
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
54681
- return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
54682
- }
54695
+ return undefined;
54683
54696
  }
54684
54697
  outlineLoopInput(low, high, lowFile, highSyntax) {
54685
54698
  if (!(low.get() instanceof _statement_1.Unknown)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.20",
3
+ "version": "2.101.22",
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.101.20",
41
+ "@abaplint/core": "^2.101.22",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -47,7 +47,7 @@
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.7",
49
49
  "chalk": "^5.2.0",
50
- "eslint": "^8.42.0",
50
+ "eslint": "^8.43.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^3.5.3",
@@ -55,7 +55,7 @@
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.1.3",
58
- "webpack": "^5.86.0",
58
+ "webpack": "^5.87.0",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"
61
61
  },