@abaplint/core 2.93.14 → 2.93.16

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.
@@ -104,18 +104,21 @@ class StatementParser {
104
104
  const result = [];
105
105
  for (let statement of wa.statements) {
106
106
  // dont use CALL METHOD, when executing lazy, it easily gives a Move for the last statment if lazy logic is evaluated
107
- if (statement.get() instanceof _statement_1.Unknown
108
- && statement.concatTokens().toUpperCase().startsWith("CALL METHOD ") === false
109
- && statement.concatTokens().toUpperCase().startsWith("CALL FUNCTION ") === false) {
110
- for (const { first, second } of this.buildSplits(statement.getTokens())) {
111
- if (second.length === 1) {
112
- continue; // probably punctuation
113
- }
114
- const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
115
- if (!(s.get() instanceof _statement_1.Unknown)) {
116
- result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));
117
- statement = s;
118
- break;
107
+ if (statement.get() instanceof _statement_1.Unknown) {
108
+ const concat = statement.concatTokens().toUpperCase();
109
+ if (concat.startsWith("CALL METHOD ") === false
110
+ && concat.startsWith("RAISE EXCEPTION TYPE ") === false
111
+ && concat.startsWith("CALL FUNCTION ") === false) {
112
+ for (const { first, second } of this.buildSplits(statement.getTokens())) {
113
+ if (second.length === 1) {
114
+ continue; // probably punctuation
115
+ }
116
+ const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
117
+ if (!(s.get() instanceof _statement_1.Unknown)) {
118
+ result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));
119
+ statement = s;
120
+ break;
121
+ }
119
122
  }
120
123
  }
121
124
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.14";
66
+ return "2.93.16";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -9,6 +9,13 @@ const _abap_rule_1 = require("./_abap_rule");
9
9
  const _basic_rule_config_1 = require("./_basic_rule_config");
10
10
  const _irule_1 = require("./_irule");
11
11
  class ChangeIfToCaseConf extends _basic_rule_config_1.BasicRuleConfig {
12
+ constructor() {
13
+ super(...arguments);
14
+ /** skip specific names, case insensitive regular expression
15
+ * @uniqueItems true
16
+ */
17
+ this.skipNames = [];
18
+ }
12
19
  }
13
20
  exports.ChangeIfToCaseConf = ChangeIfToCaseConf;
14
21
  class ChangeIfToCase extends _abap_rule_1.ABAPRule {
@@ -113,6 +120,12 @@ ENDCASE.`,
113
120
  else {
114
121
  return false;
115
122
  }
123
+ for (const skip of this.getConfig().skipNames || []) {
124
+ const reg = new RegExp(skip, "i");
125
+ if (chain.match(reg)) {
126
+ return false;
127
+ }
128
+ }
116
129
  for (const t of tuples) {
117
130
  if (t.left !== chain && t.right !== chain) {
118
131
  return false;
@@ -139,6 +139,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
139
139
  const message = "Internal Error: Statement lengths does not match";
140
140
  ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));
141
141
  */
142
+ // hmm, add some way to disable lazyUnknown() in statement_parser.ts
142
143
  continue;
143
144
  }
144
145
  for (let i = 0; i < lowStatements.length; i++) {
@@ -1317,7 +1318,7 @@ ${indentation} output = ${topTarget}.`;
1317
1318
  return undefined;
1318
1319
  }
1319
1320
  outlineFor(forLoop, indentation, lowFile, highSyntax) {
1320
- var _a, _b, _c, _d, _e, _f, _g, _h;
1321
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1321
1322
  let body = "";
1322
1323
  let end = "";
1323
1324
  const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
@@ -1357,8 +1358,12 @@ ${indentation} output = ${topTarget}.`;
1357
1358
  end += indentation + "ENDWHILE";
1358
1359
  }
1359
1360
  else if (loopTargetField !== undefined) {
1361
+ let from = (_h = forLoop.findExpressionAfterToken("FROM")) === null || _h === void 0 ? void 0 : _h.concatTokens();
1362
+ from = from ? " FROM " + from : "";
1363
+ let to = (_j = forLoop.findExpressionAfterToken("TO")) === null || _j === void 0 ? void 0 : _j.concatTokens();
1364
+ to = to ? " TO " + to : "";
1360
1365
  // todo, also backup sy-index / sy-tabix here?
1361
- body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${cond}.\n`;
1366
+ body += indentation + `LOOP AT ${loopSource} INTO DATA(${loopTargetField})${from}${to}${cond}.\n`;
1362
1367
  if (indexInto) {
1363
1368
  body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
1364
1369
  }
@@ -1366,7 +1371,7 @@ ${indentation} output = ${topTarget}.`;
1366
1371
  }
1367
1372
  else if (loopTargetField === undefined) {
1368
1373
  // todo, also backup sy-index / sy-tabix here?
1369
- const loopTargetFieldSymbol = (_h = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _h === void 0 ? void 0 : _h.concatTokens();
1374
+ const loopTargetFieldSymbol = (_k = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _k === void 0 ? void 0 : _k.concatTokens();
1370
1375
  body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\n`;
1371
1376
  if (indexInto) {
1372
1377
  body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
@@ -38,20 +38,18 @@ https://docs.abapopenchecks.org/checks/04/`,
38
38
  const issues = [];
39
39
  // maximum line length in abap files
40
40
  const maxLineLength = 255;
41
- file.getRawRows().forEach((row, rowIndex) => {
42
- row = row.replace("\r", "");
43
- let message = "";
41
+ const array = file.getRawRows();
42
+ for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
43
+ const row = array[rowIndex].replace("\r", "");
44
44
  if (row.length > maxLineLength) {
45
- message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;
45
+ const message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;
46
+ issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
46
47
  }
47
48
  else if (row.length > this.conf.length) {
48
- message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;
49
+ const message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;
50
+ issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
49
51
  }
50
- else {
51
- return;
52
- }
53
- issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
54
- });
52
+ }
55
53
  return issues;
56
54
  }
57
55
  }
@@ -29,7 +29,7 @@ Activates if language version is v740sp02 or above.
29
29
 
30
30
  Variables must be local(METHOD or FORM).
31
31
 
32
- No generic or void typed variables.
32
+ No generic or void typed variables. No syntax errors.
33
33
 
34
34
  First position used must be a full/pure write.
35
35
 
@@ -65,7 +65,11 @@ DATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 10
65
65
  else if (!(obj instanceof _abap_object_1.ABAPObject)) {
66
66
  return [];
67
67
  }
68
- const scopes = this.findScopeCandidates(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());
68
+ const run = new syntax_1.SyntaxLogic(this.reg, obj).run();
69
+ if (run.issues.length > 0) {
70
+ return [];
71
+ }
72
+ const scopes = this.findScopeCandidates(run.spaghetti.getTop());
69
73
  const ret = [];
70
74
  for (const s of scopes) {
71
75
  ret.push(...this.analyzeScope(s, obj));
@@ -30,7 +30,7 @@ class PrefixIsCurrentClass extends _abap_rule_1.ABAPRule {
30
30
  title: "Prefix is current class",
31
31
  shortDescription: `Reports errors if the current class or interface references itself with "current_class=>"`,
32
32
  // eslint-disable-next-line max-len
33
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-self-reference-me-when-calling-an-instance-method`,
33
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-self-reference-me-when-calling-an-instance-attribute-or-method`,
34
34
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
35
35
  };
36
36
  }
@@ -8,7 +8,9 @@ const position_1 = require("../position");
8
8
  class SICFConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
9
9
  constructor() {
10
10
  super(...arguments);
11
- /** skip specific names, case insensitive */
11
+ /** skip specific names, case insensitive
12
+ * @uniqueItems true
13
+ */
12
14
  this.skipNames = [];
13
15
  }
14
16
  }
@@ -39,7 +39,9 @@ class WorkArea {
39
39
  class UnusedTypesConf extends _basic_rule_config_1.BasicRuleConfig {
40
40
  constructor() {
41
41
  super(...arguments);
42
- /** skip specific names, case insensitive */
42
+ /** skip specific names, case insensitive
43
+ * @uniqueItems true
44
+ */
43
45
  this.skipNames = [];
44
46
  }
45
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.14",
3
+ "version": "2.93.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "homepage": "https://abaplint.org",
48
48
  "devDependencies": {
49
- "@microsoft/api-extractor": "^7.31.0",
49
+ "@microsoft/api-extractor": "^7.31.1",
50
50
  "@types/chai": "^4.3.3",
51
51
  "@types/mocha": "^9.1.1",
52
- "@types/node": "^18.7.17",
52
+ "@types/node": "^18.7.18",
53
53
  "chai": "^4.3.6",
54
54
  "eslint": "^8.23.1",
55
55
  "mocha": "^10.0.0",
@@ -59,7 +59,7 @@
59
59
  "typescript": "^4.8.3"
60
60
  },
61
61
  "dependencies": {
62
- "fast-xml-parser": "^4.0.9",
62
+ "fast-xml-parser": "^4.0.10",
63
63
  "json5": "^2.2.1",
64
64
  "vscode-languageserver-types": "^3.17.2"
65
65
  }