@abaplint/core 2.97.2 → 2.97.4

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.
@@ -7,7 +7,7 @@ const version_1 = require("../../../version");
7
7
  class CallFunction {
8
8
  getMatcher() {
9
9
  const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
10
- const update = (0, combi_1.str)("IN UPDATE TASK");
10
+ const update = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.str)("IN UPDATE TASK"));
11
11
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
12
12
  const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
13
13
  const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.97.2";
66
+ return "2.97.4";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -51,7 +51,7 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
51
51
  || s.get() instanceof Statements.SelectLoop
52
52
  || s.get() instanceof Statements.InsertDatabase
53
53
  || s.get() instanceof Statements.DeleteDatabase) {
54
- for (const o of s.findAllExpressions(Expressions.SQLSource)) {
54
+ for (const o of s.findAllExpressionsMulti([Expressions.SQLSource, Expressions.SQLSourceSimple])) {
55
55
  const first = o.getFirstChild();
56
56
  if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
57
57
  || ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {
@@ -8,6 +8,7 @@ const _abap_rule_1 = require("./_abap_rule");
8
8
  const _basic_rule_config_1 = require("./_basic_rule_config");
9
9
  const version_1 = require("../version");
10
10
  const _irule_1 = require("./_irule");
11
+ const edit_helper_1 = require("../edit_helper");
11
12
  class StrictSQLConf extends _basic_rule_config_1.BasicRuleConfig {
12
13
  }
13
14
  exports.StrictSQLConf = StrictSQLConf;
@@ -25,8 +26,10 @@ class StrictSQL extends _abap_rule_1.ABAPRule {
25
26
 
26
27
  https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
27
28
 
28
- Also see separate rule sql_escape_host_variables`,
29
- tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax],
29
+ Also see separate rule sql_escape_host_variables
30
+
31
+ Activates from v750 and up`,
32
+ tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],
30
33
  };
31
34
  }
32
35
  getConfig() {
@@ -41,7 +44,7 @@ Also see separate rule sql_escape_host_variables`,
41
44
  if (type === "INTF" || type === "TYPE") {
42
45
  return [];
43
46
  }
44
- if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02
47
+ if (this.reg.getConfig().getVersion() < version_1.Version.v750
45
48
  && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {
46
49
  return [];
47
50
  }
@@ -50,16 +53,24 @@ Also see separate rule sql_escape_host_variables`,
50
53
  || s.get() instanceof Statements.SelectLoop) {
51
54
  const expr = s.findDirectExpression(Expressions.Select);
52
55
  const where = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLCond);
56
+ const order = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLOrderBy);
53
57
  const into = (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoStructure))
54
58
  || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoTable));
55
59
  if (into === undefined || where === undefined) {
56
60
  continue;
57
61
  }
58
- if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
62
+ else if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
59
63
  continue;
60
64
  }
65
+ const fix1 = edit_helper_1.EditHelper.deleteRange(file, into.getFirstToken().getStart(), into.getLastToken().getEnd());
66
+ let last = where.getLastToken();
67
+ if (order && order.getLastToken().getEnd().isAfter(last.getEnd())) {
68
+ last = order.getLastToken();
69
+ }
70
+ const fix2 = edit_helper_1.EditHelper.insertAt(file, last.getEnd(), " " + into.concatTokens());
71
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
61
72
  const message = "INTO/APPENDING must be last in strict SQL";
62
- const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
73
+ const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);
63
74
  issues.push(issue);
64
75
  break;
65
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.97.2",
3
+ "version": "2.97.4",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",