@abaplint/core 2.89.14 → 2.90.1

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);
@@ -8,7 +8,9 @@ const version_1 = require("../../../version");
8
8
  class SQLCompare extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const val = new _1.SQLSource();
11
- const list = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeft), (0, combi_1.tok)(tokens_1.WParenLeftW)), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), ")");
11
+ const listOld = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRight), (0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.WParenRightW)));
12
+ const listNew = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRight), (0, combi_1.tok)(tokens_1.WParenRightW)));
13
+ const list = (0, combi_1.alt)(listOld, (0, combi_1.ver)(version_1.Version.v740sp02, listNew)); // version is a guess, https://github.com/abaplint/abaplint/issues/2530
12
14
  const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
13
15
  const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
14
16
  const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
@@ -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
@@ -17,7 +17,7 @@ class InsertInternal {
17
17
  const fromTo = (0, combi_1.seq)((0, combi_1.opt)(from), (0, combi_1.opt)(to));
18
18
  const foo = (0, combi_1.per)(into, ref, index, assigning);
19
19
  const lines = (0, combi_1.seq)("LINES OF", target, (0, combi_1.opt)(fromTo));
20
- const src = (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource1);
20
+ const src = (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp02, expressions_1.Source), expressions_1.SimpleSource4);
21
21
  const tab = (0, combi_1.seq)("TABLE", expressions_1.Source);
22
22
  const ret = (0, combi_1.seq)("INSERT", (0, combi_1.altPrio)(tab, (0, combi_1.seq)((0, combi_1.altPrio)(initial, lines, src), foo)));
23
23
  return ret;
@@ -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;
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.89.14";
71
+ return "2.90.1";
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) {
@@ -114,7 +114,9 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
114
114
  const issueStartPos = new position_1.Position(prev.getRow(), prev.getCol() + 2);
115
115
  const issueEndPos = new position_1.Position(t.getRow(), t.getCol());
116
116
  const fix = edit_helper_1.EditHelper.deleteRange(file, issueStartPos, issueEndPos);
117
- issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
117
+ if (this.pragmaInRange(s.getPragmas(), issueStartPos, issueEndPos) === false) {
118
+ issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
119
+ }
118
120
  }
119
121
  if (this.getConfig().endParen === true
120
122
  && prev.getRow() === t.getRow()
@@ -124,12 +126,23 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
124
126
  const issueStartPos = new position_1.Position(prev.getEnd().getRow(), prev.getEnd().getCol() + 1);
125
127
  const issueEndPos = new position_1.Position(t.getRow(), t.getCol());
126
128
  const fix = edit_helper_1.EditHelper.deleteRange(file, issueStartPos, issueEndPos);
127
- issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
129
+ if (this.pragmaInRange(s.getPragmas(), issueStartPos, issueEndPos) === false) {
130
+ issues.push(issue_1.Issue.atRange(file, issueStartPos, issueEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix));
131
+ }
128
132
  }
129
133
  prev = t;
130
134
  }
131
135
  return issues;
132
136
  }
137
+ pragmaInRange(pragmas, start, end) {
138
+ let ret = false;
139
+ for (const p of pragmas) {
140
+ if (p.getStart().isBetween(start, end)) {
141
+ ret = true;
142
+ }
143
+ }
144
+ return ret;
145
+ }
133
146
  checkKeywords(s, file) {
134
147
  const issues = [];
135
148
  let prev = undefined;
@@ -1143,8 +1143,12 @@ ${indentation} output = ${topTarget}.`;
1143
1143
  if (letNode) {
1144
1144
  body += this.outlineLet(letNode, indentation, highSyntax, lowFile);
1145
1145
  }
1146
+ let firstName = "";
1146
1147
  for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {
1147
1148
  name = init.getFirstToken().getStr();
1149
+ if (firstName === "") {
1150
+ firstName = name;
1151
+ }
1148
1152
  const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1149
1153
  const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
1150
1154
  if (s) {
@@ -1180,7 +1184,7 @@ ${indentation} output = ${topTarget}.`;
1180
1184
  }
1181
1185
  }
1182
1186
  body += indentation + end;
1183
- body += indentation + `${uniqueName} = ${name}.\n`;
1187
+ body += indentation + `${uniqueName} = ${firstName}.\n`;
1184
1188
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1185
1189
  body +
1186
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.14",
3
+ "version": "2.90.1",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -45,12 +45,12 @@
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
- "eslint": "^8.14.0",
53
+ "eslint": "^8.15.0",
54
54
  "mocha": "^10.0.0",
55
55
  "c8": "^7.11.2",
56
56
  "source-map-support": "^0.5.21",