@abaplint/core 2.102.51 → 2.102.53

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.
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
6
  class SQLFields extends combi_1.Expression {
7
7
  getRunnable() {
8
- return (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
8
+ return (0, combi_1.seq)("FIELDS", (0, combi_1.opt)("DISTINCT"), _1.SQLFieldList);
9
9
  }
10
10
  }
11
11
  exports.SQLFields = SQLFields;
@@ -97,20 +97,23 @@ class Select {
97
97
  if (isDynamic) {
98
98
  throw new Error(`dynamic field list, inlining not possible`);
99
99
  }
100
- if (isSimple.test(field.code) && dbSources.length === 1 && dbSources[0] !== undefined) {
101
- const dbType = dbSources[0].parseType(scope.getRegistry());
102
- let type = new basic_1.VoidType("SELECT_todo");
103
- if (dbType instanceof basic_1.StructureType) {
104
- type = dbType.getComponentByName(field.code);
105
- if (type === undefined) {
106
- throw new Error(`handleInto, internal error, should be checked earlier`);
100
+ let type = new basic_1.VoidType("SELECT_todo");
101
+ if (isSimple.test(field.code)) {
102
+ for (const dbSource of dbSources) {
103
+ if (dbSource === undefined) {
104
+ continue;
105
+ }
106
+ const dbType = dbSource.parseType(scope.getRegistry());
107
+ if (dbType instanceof basic_1.StructureType) {
108
+ const found = dbType.getComponentByName(field.code);
109
+ if (found) {
110
+ type = found;
111
+ break;
112
+ }
107
113
  }
108
114
  }
109
- new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
110
- }
111
- else {
112
- new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.VoidType("SELECT_todo"));
113
115
  }
116
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
114
117
  }
115
118
  }
116
119
  }
@@ -19,7 +19,8 @@ class Message {
19
19
  return this.message;
20
20
  }
21
21
  getPlaceholderCount() {
22
- return (this.getMessage().match(/&/g) || []).length;
22
+ const escaped = (this.getMessage().match(/&&/g) || []).length;
23
+ return (this.getMessage().match(/&/g) || []).length - escaped * 2;
23
24
  }
24
25
  }
25
26
  exports.Message = Message;
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.102.51";
68
+ return "2.102.53";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -6,6 +6,11 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
6
6
  const objects_1 = require("../objects");
7
7
  const position_1 = require("../position");
8
8
  class MSAGConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
9
+ constructor() {
10
+ super(...arguments);
11
+ /** paramters must be numbered */
12
+ this.numericParamters = true;
13
+ }
9
14
  }
10
15
  exports.MSAGConsistencyConf = MSAGConsistencyConf;
11
16
  class MSAGConsistency {
@@ -39,7 +44,7 @@ class MSAGConsistency {
39
44
  }
40
45
  const numbers = new Set();
41
46
  for (const message of obj.getMessages()) {
42
- // todo, get the right positions in xml file
47
+ // todo, get the right positions in xml file, and report the issue there
43
48
  if (!message.getNumber().match(/\d\d\d/)) {
44
49
  const text = this.getDescription("Message number must be 3 digits: message " + message.getNumber());
45
50
  const position = new position_1.Position(1, 1);
@@ -62,6 +67,25 @@ class MSAGConsistency {
62
67
  else {
63
68
  numbers.add(num);
64
69
  }
70
+ if (this.getConfig().numericParamters === true) {
71
+ const placeholderCount = message.getPlaceholderCount();
72
+ if (placeholderCount > 4) {
73
+ const text = `More than 4 placeholders in mesasge ${message.getNumber()}`;
74
+ const position = new position_1.Position(1, 1);
75
+ const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
76
+ issues.push(issue);
77
+ }
78
+ for (let i = 1; i <= placeholderCount; i++) {
79
+ const placeholder = "&" + i;
80
+ if (message.getMessage().includes(placeholder) === false) {
81
+ const text = `Expected placeholder ${placeholder} in message ${message.getNumber()}`;
82
+ const position = new position_1.Position(1, 1);
83
+ const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
84
+ issues.push(issue);
85
+ break;
86
+ }
87
+ }
88
+ }
65
89
  }
66
90
  return issues;
67
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.102.51",
3
+ "version": "2.102.53",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,11 +50,11 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.37.1",
53
+ "@microsoft/api-extractor": "^7.38.0",
54
54
  "@types/chai": "^4.3.6",
55
55
  "@types/mocha": "^10.0.2",
56
- "@types/node": "^20.7.1",
57
- "chai": "^4.3.9",
56
+ "@types/node": "^20.8.0",
57
+ "chai": "^4.3.10",
58
58
  "eslint": "^8.50.0",
59
59
  "mocha": "^10.2.0",
60
60
  "c8": "^8.0.1",