@abaplint/core 2.89.13 → 2.90.0

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.
@@ -1786,6 +1786,7 @@ declare namespace Expressions {
1786
1786
  Color,
1787
1787
  CompareOperator,
1788
1788
  Compare,
1789
+ TestSeamName,
1789
1790
  ComponentChainSimple,
1790
1791
  ComponentChain,
1791
1792
  ComponentCompareSimple,
@@ -5674,6 +5675,10 @@ declare class TestSeam_2 implements IStatement {
5674
5675
  getMatcher(): IStatementRunnable;
5675
5676
  }
5676
5677
 
5678
+ declare class TestSeamName extends Expression {
5679
+ getRunnable(): IStatementRunnable;
5680
+ }
5681
+
5677
5682
  declare class TextElement extends Expression {
5678
5683
  getRunnable(): IStatementRunnable;
5679
5684
  }
@@ -33,6 +33,7 @@ __exportStar(require("./class_name"), exports);
33
33
  __exportStar(require("./color"), exports);
34
34
  __exportStar(require("./compare_operator"), exports);
35
35
  __exportStar(require("./compare"), exports);
36
+ __exportStar(require("./test_seam_name"), exports);
36
37
  __exportStar(require("./component_chain_simple"), exports);
37
38
  __exportStar(require("./component_chain"), exports);
38
39
  __exportStar(require("./component_compare_simple"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestSeamName = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ class TestSeamName extends combi_1.Expression {
7
+ getRunnable() {
8
+ const ret = (0, combi_1.seq)((0, combi_1.regex)(/^[\w%\$\*]+$/), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.regex)(/^[\w%\$\*]+$/))));
9
+ return ret;
10
+ }
11
+ }
12
+ exports.TestSeamName = TestSeamName;
13
+ //# sourceMappingURL=test_seam_name.js.map
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class TestInjection {
7
7
  getMatcher() {
8
- return (0, combi_1.seq)("TEST-INJECTION", expressions_1.Field);
8
+ return (0, combi_1.seq)("TEST-INJECTION", expressions_1.TestSeamName);
9
9
  }
10
10
  }
11
11
  exports.TestInjection = TestInjection;
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const expressions_1 = require("../expressions");
6
6
  class TestSeam {
7
7
  getMatcher() {
8
- return (0, combi_1.seq)("TEST-SEAM", expressions_1.Field);
8
+ return (0, combi_1.seq)("TEST-SEAM", expressions_1.TestSeamName);
9
9
  }
10
10
  }
11
11
  exports.TestSeam = TestSeam;
@@ -60,7 +60,8 @@ class Indent {
60
60
  || type instanceof Statements.EndCatch
61
61
  || (this.options.selectionScreenBlockIndentation === true
62
62
  && type instanceof Statements.SelectionScreen
63
- && statement.concatTokens().toUpperCase().includes("END OF BLOCK"))
63
+ && (statement.concatTokens().toUpperCase().includes("END OF BLOCK") ||
64
+ statement.concatTokens().toUpperCase().includes("END OF LINE")))
64
65
  || type instanceof Statements.ElseIf
65
66
  || type instanceof Statements.EndFunction
66
67
  || type instanceof Statements.EndInterface
@@ -149,7 +150,8 @@ class Indent {
149
150
  || type instanceof Statements.TestSeam
150
151
  || (this.options.selectionScreenBlockIndentation === true
151
152
  && type instanceof Statements.SelectionScreen
152
- && statement.concatTokens().toUpperCase().includes("BEGIN OF BLOCK"))
153
+ && (statement.concatTokens().toUpperCase().includes("BEGIN OF BLOCK") ||
154
+ statement.concatTokens().toUpperCase().includes("BEGIN OF LINE")))
153
155
  || type instanceof Statements.StartOfSelection
154
156
  || type instanceof Statements.AtSelectionScreen
155
157
  || type instanceof Statements.AtLineSelection
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.89.13";
71
+ return "2.90.0";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -20,6 +20,8 @@ class AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {
20
20
  this.defaultKey = true;
21
21
  /** Detects BREAK and BREAK-POINTS */
22
22
  this.break = true;
23
+ /** Detects TEST SEAMS */
24
+ this.testSeams = true;
23
25
  /** Detects DESCRIBE TABLE LINES, use lines() instead */
24
26
  this.describeLines = true;
25
27
  }
@@ -81,7 +83,7 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
81
83
  else if (this.conf.statics && statement instanceof Statements.StaticEnd) {
82
84
  isStaticsBlock = false;
83
85
  }
84
- else if (this.conf.statics && statement instanceof Statements.TestSeam) {
86
+ else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {
85
87
  message = "TEST-SEAM";
86
88
  }
87
89
  else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {
@@ -1139,8 +1139,16 @@ ${indentation} output = ${topTarget}.`;
1139
1139
  if (reduceBody === undefined) {
1140
1140
  continue;
1141
1141
  }
1142
+ const letNode = reduceBody.findDirectExpression(Expressions.Let);
1143
+ if (letNode) {
1144
+ body += this.outlineLet(letNode, indentation, highSyntax, lowFile);
1145
+ }
1146
+ let firstName = "";
1142
1147
  for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {
1143
1148
  name = init.getFirstToken().getStr();
1149
+ if (firstName === "") {
1150
+ firstName = name;
1151
+ }
1144
1152
  const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1145
1153
  const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
1146
1154
  if (s) {
@@ -1176,7 +1184,7 @@ ${indentation} output = ${topTarget}.`;
1176
1184
  }
1177
1185
  }
1178
1186
  body += indentation + end;
1179
- body += indentation + `${uniqueName} = ${name}.\n`;
1187
+ body += indentation + `${uniqueName} = ${firstName}.\n`;
1180
1188
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1181
1189
  body +
1182
1190
  indentation;
@@ -31,6 +31,7 @@ __exportStar(require("./check_comments"), exports);
31
31
  __exportStar(require("./check_ddic"), exports);
32
32
  __exportStar(require("./check_include"), exports);
33
33
  __exportStar(require("./check_subrc"), exports);
34
+ __exportStar(require("./no_external_form_calls"), exports);
34
35
  __exportStar(require("./check_syntax"), exports);
35
36
  __exportStar(require("./classic_exceptions_overlap"), exports);
36
37
  __exportStar(require("./check_text_elements"), exports);
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoExternalFormCalls = exports.NoExternalFormCallsConf = void 0;
4
+ const Statements = require("../abap/2_statements/statements");
5
+ const Expressions = require("../abap/2_statements/expressions");
6
+ const _abap_rule_1 = require("./_abap_rule");
7
+ const _basic_rule_config_1 = require("./_basic_rule_config");
8
+ const issue_1 = require("../issue");
9
+ const _irule_1 = require("./_irule");
10
+ class NoExternalFormCallsConf extends _basic_rule_config_1.BasicRuleConfig {
11
+ }
12
+ exports.NoExternalFormCallsConf = NoExternalFormCallsConf;
13
+ class NoExternalFormCalls extends _abap_rule_1.ABAPRule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.conf = new NoExternalFormCallsConf();
17
+ }
18
+ getMetadata() {
19
+ return {
20
+ key: "no_external_form_calls",
21
+ title: "No external FORM calls",
22
+ shortDescription: `Detect external form calls`,
23
+ badExample: `PERFORM foo IN PROGRAM bar.
24
+
25
+ PERFORM foo(bar).`,
26
+ tags: [_irule_1.RuleTag.SingleFile],
27
+ };
28
+ }
29
+ getConfig() {
30
+ return this.conf;
31
+ }
32
+ setConfig(conf) {
33
+ this.conf = conf;
34
+ }
35
+ runParsed(file) {
36
+ const issues = [];
37
+ const stru = file.getStructure();
38
+ if (stru === undefined) {
39
+ return issues; // parser error
40
+ }
41
+ for (const p of stru.findAllStatements(Statements.Perform)) {
42
+ if (p.findDirectExpression(Expressions.IncludeName) || p.findDirectTokenByText("PROGRAM")) {
43
+ const message = "No external FORM calls";
44
+ issues.push(issue_1.Issue.atStatement(file, p, message, this.getMetadata().key, this.conf.severity));
45
+ }
46
+ }
47
+ return issues;
48
+ }
49
+ }
50
+ exports.NoExternalFormCalls = NoExternalFormCalls;
51
+ //# sourceMappingURL=no_external_form_calls.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.89.13",
3
+ "version": "2.90.0",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "homepage": "https://abaplint.org",
47
47
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.23.0",
48
+ "@microsoft/api-extractor": "^7.23.1",
49
49
  "@types/chai": "^4.3.1",
50
50
  "@types/mocha": "^9.1.1",
51
- "@types/node": "^17.0.30",
51
+ "@types/node": "^17.0.31",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.14.0",
54
- "mocha": "^9.2.2",
54
+ "mocha": "^10.0.0",
55
55
  "c8": "^7.11.2",
56
56
  "source-map-support": "^0.5.21",
57
57
  "ts-json-schema-generator": "^1.0.0",