@abaplint/cli 2.105.26 → 2.106.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.
Files changed (2) hide show
  1. package/build/cli.js +163 -14
  2. package/package.json +4 -4
package/build/cli.js CHANGED
@@ -11104,9 +11104,9 @@ class Concatenate {
11104
11104
  getMatcher() {
11105
11105
  const mode = (0, combi_1.seq)("IN", (0, combi_1.altPrio)("BYTE", "CHARACTER"), "MODE");
11106
11106
  const blanks = (0, combi_1.str)("RESPECTING BLANKS");
11107
- const sep = (0, combi_1.seq)("SEPARATED BY", expressions_1.Source);
11107
+ const sep = (0, combi_1.seq)("SEPARATED BY", expressions_1.SimpleSource3);
11108
11108
  const options = (0, combi_1.per)(mode, blanks, sep);
11109
- const sourc = (0, combi_1.seq)(expressions_1.Source, (0, combi_1.plus)(expressions_1.Source));
11109
+ const sourc = (0, combi_1.seq)(expressions_1.SimpleSource3, (0, combi_1.plus)(expressions_1.SimpleSource3));
11110
11110
  const lines = (0, combi_1.seq)("LINES OF", expressions_1.Source);
11111
11111
  return (0, combi_1.seq)("CONCATENATE", (0, combi_1.altPrio)(lines, sourc), "INTO", expressions_1.Target, (0, combi_1.optPrio)(options));
11112
11112
  }
@@ -22136,6 +22136,7 @@ class Procedural {
22136
22136
  throw new Error("Function module definition \"" + name + "\" not found");
22137
22137
  }
22138
22138
  const ddic = new ddic_1.DDIC(this.reg);
22139
+ const allNames = new Set();
22139
22140
  for (const param of definition.getParameters()) {
22140
22141
  let found = undefined;
22141
22142
  if (param.type === undefined || param.type === "") {
@@ -22212,8 +22213,16 @@ class Procedural {
22212
22213
  if (found instanceof basic_1.UnknownType && new ddic_1.DDIC(this.reg).inErrorNamespace(param.type) === false) {
22213
22214
  found = new basic_1.VoidType(param.type);
22214
22215
  }
22215
- const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);
22216
- this.scope.addNamedIdentifier(param.name, type);
22216
+ if (allNames.has(param.name.toUpperCase())) {
22217
+ // yea, IMPORTING and EXPORTING can have the same name
22218
+ // workaround to avoid false postivies, can be improved
22219
+ continue;
22220
+ }
22221
+ else {
22222
+ const type = new _typed_identifier_1.TypedIdentifier(nameToken, filename, found);
22223
+ this.scope.addNamedIdentifier(param.name, type);
22224
+ allNames.add(param.name.toUpperCase());
22225
+ }
22217
22226
  }
22218
22227
  }
22219
22228
  }
@@ -26867,6 +26876,8 @@ class Source {
26867
26876
  if (writeReference) {
26868
26877
  type.push(_reference_1.ReferenceType.DataWriteReference);
26869
26878
  }
26879
+ let hexExpected = false;
26880
+ let hexNext = false;
26870
26881
  while (children.length >= 0) {
26871
26882
  if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.MethodCallChain) {
26872
26883
  context = new method_call_chain_1.MethodCallChain().runSyntax(first, scope, filename, targetType);
@@ -26898,10 +26909,29 @@ class Source {
26898
26909
  if (first.concatTokens() === "**") {
26899
26910
  context = new basic_1.FloatType();
26900
26911
  }
26912
+ const operator = first.concatTokens().toUpperCase();
26913
+ if (operator === "BIT-OR" || operator === "BIT-AND" || operator === "BIT-XOR") {
26914
+ hexExpected = true;
26915
+ hexNext = true;
26916
+ }
26901
26917
  }
26902
26918
  else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
26903
26919
  context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, type);
26904
26920
  }
26921
+ if (hexExpected === true) {
26922
+ if (!(context instanceof basic_1.VoidType)
26923
+ && !(context instanceof basic_1.XStringType)
26924
+ && !(context instanceof basic_1.HexType)
26925
+ && !(context instanceof basic_1.XGenericType)
26926
+ && !(context instanceof basic_1.XSequenceType)
26927
+ && !(context instanceof unknown_type_1.UnknownType)) {
26928
+ throw new Error("Operator only valid for XSTRING or HEX");
26929
+ }
26930
+ if (hexNext === false) {
26931
+ hexExpected = false;
26932
+ }
26933
+ hexNext = false;
26934
+ }
26905
26935
  first = children.shift();
26906
26936
  if (first === undefined) {
26907
26937
  break;
@@ -29104,7 +29134,7 @@ const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/
29104
29134
  class Concatenate {
29105
29135
  runSyntax(node, scope, filename) {
29106
29136
  const byteMode = node.findDirectTokenByText("BYTE") !== undefined;
29107
- let linesMode = node.findDirectTokenByText("LINES") !== undefined;
29137
+ const linesMode = node.findDirectTokenByText("LINES") !== undefined;
29108
29138
  const target = node.findFirstExpression(Expressions.Target);
29109
29139
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
29110
29140
  if (inline) {
@@ -29122,18 +29152,21 @@ class Concatenate {
29122
29152
  throw new Error("Target type not compatible");
29123
29153
  }
29124
29154
  }
29125
- for (const s of node.findDirectExpressions(Expressions.Source)) {
29126
- const type = new source_1.Source().runSyntax(s, scope, filename);
29127
- if (linesMode) {
29155
+ if (linesMode) {
29156
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
29157
+ const type = new source_1.Source().runSyntax(s, scope, filename);
29128
29158
  if (!(type instanceof basic_1.UnknownType) && !(type instanceof basic_1.VoidType) && !(type instanceof basic_1.TableType)) {
29129
29159
  throw new Error("Source must be an internal table");
29130
29160
  }
29131
- linesMode = false;
29132
- continue;
29133
29161
  }
29134
- const compatible = byteMode ? new _type_utils_1.TypeUtils(scope).isHexLike(type) : new _type_utils_1.TypeUtils(scope).isCharLikeStrict(type);
29135
- if (compatible === false) {
29136
- throw new Error("Source type not compatible");
29162
+ }
29163
+ else {
29164
+ for (const s of node.findDirectExpressions(Expressions.SimpleSource3)) {
29165
+ const type = new source_1.Source().runSyntax(s, scope, filename);
29166
+ const compatible = byteMode ? new _type_utils_1.TypeUtils(scope).isHexLike(type) : new _type_utils_1.TypeUtils(scope).isCharLikeStrict(type);
29167
+ if (compatible === false) {
29168
+ throw new Error("Source type not compatible");
29169
+ }
29137
29170
  }
29138
29171
  }
29139
29172
  }
@@ -51336,7 +51369,7 @@ class Registry {
51336
51369
  }
51337
51370
  static abaplintVersion() {
51338
51371
  // magic, see build script "version.sh"
51339
- return "2.105.26";
51372
+ return "2.106.0";
51340
51373
  }
51341
51374
  getDDICReferences() {
51342
51375
  return this.ddicReferences;
@@ -60598,6 +60631,18 @@ class IdenticalConditions extends _abap_rule_1.ABAPRule {
60598
60631
 
60599
60632
  Prerequsites: code is pretty printed with identical cAsE`,
60600
60633
  tags: [_irule_1.RuleTag.SingleFile],
60634
+ badExample: `IF foo = bar OR 1 = a OR foo = bar.
60635
+ ENDIF.
60636
+ CASE bar.
60637
+ WHEN '1'.
60638
+ WHEN 'A' OR '1'.
60639
+ ENDCASE.`,
60640
+ goodExample: `IF foo = bar OR 1 = a.
60641
+ ENDIF.
60642
+ CASE bar.
60643
+ WHEN '1'.
60644
+ WHEN 'A'.
60645
+ ENDCASE.`,
60601
60646
  };
60602
60647
  }
60603
60648
  getConfig() {
@@ -61753,6 +61798,7 @@ __exportStar(__webpack_require__(/*! ./in_statement_indentation */ "./node_modul
61753
61798
  __exportStar(__webpack_require__(/*! ./indentation */ "./node_modules/@abaplint/core/build/src/rules/indentation.js"), exports);
61754
61799
  __exportStar(__webpack_require__(/*! ./inline_data_old_versions */ "./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js"), exports);
61755
61800
  __exportStar(__webpack_require__(/*! ./intf_referencing_clas */ "./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js"), exports);
61801
+ __exportStar(__webpack_require__(/*! ./invalid_table_index */ "./node_modules/@abaplint/core/build/src/rules/invalid_table_index.js"), exports);
61756
61802
  __exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ "./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js"), exports);
61757
61803
  __exportStar(__webpack_require__(/*! ./keyword_case */ "./node_modules/@abaplint/core/build/src/rules/keyword_case.js"), exports);
61758
61804
  __exportStar(__webpack_require__(/*! ./line_break_multiple_parameters */ "./node_modules/@abaplint/core/build/src/rules/line_break_multiple_parameters.js"), exports);
@@ -62017,6 +62063,89 @@ exports.IntfReferencingClas = IntfReferencingClas;
62017
62063
 
62018
62064
  /***/ }),
62019
62065
 
62066
+ /***/ "./node_modules/@abaplint/core/build/src/rules/invalid_table_index.js":
62067
+ /*!****************************************************************************!*\
62068
+ !*** ./node_modules/@abaplint/core/build/src/rules/invalid_table_index.js ***!
62069
+ \****************************************************************************/
62070
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
62071
+
62072
+ "use strict";
62073
+
62074
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
62075
+ exports.InvalidTableIndex = exports.InvalidTableIndexConf = void 0;
62076
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
62077
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
62078
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
62079
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
62080
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
62081
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
62082
+ const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
62083
+ class InvalidTableIndexConf extends _basic_rule_config_1.BasicRuleConfig {
62084
+ }
62085
+ exports.InvalidTableIndexConf = InvalidTableIndexConf;
62086
+ class InvalidTableIndex extends _abap_rule_1.ABAPRule {
62087
+ constructor() {
62088
+ super(...arguments);
62089
+ this.conf = new InvalidTableIndexConf();
62090
+ }
62091
+ getMetadata() {
62092
+ return {
62093
+ key: "invalid_table_index",
62094
+ title: "Invalid Table Index",
62095
+ shortDescription: `Issues error for constant table index zero, as ABAP starts from 1`,
62096
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
62097
+ badExample: `DATA(first) = table[ 0 ].
62098
+ READ TABLE gt_stack ASSIGNING <ls_stack> INDEX 0.`,
62099
+ goodExample: `DATA(first) = table[ 1 ].
62100
+ READ TABLE gt_stack ASSIGNING <ls_stack> INDEX 1.`,
62101
+ };
62102
+ }
62103
+ getConfig() {
62104
+ return this.conf;
62105
+ }
62106
+ setConfig(conf) {
62107
+ this.conf = conf;
62108
+ }
62109
+ runParsed(file) {
62110
+ var _a, _b, _c, _d, _e, _f;
62111
+ const issues = [];
62112
+ const stru = file.getStructure();
62113
+ if (stru === undefined) {
62114
+ return issues; // parser error
62115
+ }
62116
+ const expr = stru.findAllExpressionsRecursive(Expressions.TableExpression);
62117
+ for (const e of expr) {
62118
+ const token = (_c = (_b = (_a = e.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Constant)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(Expressions.Integer)) === null || _c === void 0 ? void 0 : _c.getFirstToken();
62119
+ if (token === undefined) {
62120
+ continue;
62121
+ }
62122
+ if (token.getStr() === "0") {
62123
+ const message = "Table index starts from 1";
62124
+ const fix = edit_helper_1.EditHelper.replaceToken(file, token, "1");
62125
+ const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix);
62126
+ issues.push(issue);
62127
+ }
62128
+ }
62129
+ for (const rt of stru.findAllStatements(statements_1.ReadTable)) {
62130
+ const token = (_f = (_e = (_d = rt.findExpressionAfterToken("INDEX")) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.Constant)) === null || _e === void 0 ? void 0 : _e.findFirstExpression(Expressions.Integer)) === null || _f === void 0 ? void 0 : _f.getFirstToken();
62131
+ if (token === undefined) {
62132
+ continue;
62133
+ }
62134
+ if (token.getStr() === "0") {
62135
+ const message = "Table index starts from 1";
62136
+ const fix = edit_helper_1.EditHelper.replaceToken(file, token, "1");
62137
+ const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix);
62138
+ issues.push(issue);
62139
+ }
62140
+ }
62141
+ return issues;
62142
+ }
62143
+ }
62144
+ exports.InvalidTableIndex = InvalidTableIndex;
62145
+ //# sourceMappingURL=invalid_table_index.js.map
62146
+
62147
+ /***/ }),
62148
+
62020
62149
  /***/ "./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js":
62021
62150
  /*!******************************************************************************************!*\
62022
62151
  !*** ./node_modules/@abaplint/core/build/src/rules/keep_single_parameter_on_one_line.js ***!
@@ -69075,6 +69204,24 @@ class SlowParameterPassing {
69075
69204
  shortDescription: `Detects slow pass by value passing for methods where parameter is not changed`,
69076
69205
  extendedInformation: `Method parameters defined in interfaces is not checked`,
69077
69206
  tags: [_irule_1.RuleTag.Performance],
69207
+ badExample: `CLASS lcl DEFINITION.
69208
+ PUBLIC SECTION.
69209
+ METHODS bar IMPORTING VALUE(sdf) TYPE string.
69210
+ ENDCLASS.
69211
+ CLASS lcl IMPLEMENTATION.
69212
+ METHOD bar.
69213
+ WRITE sdf.
69214
+ ENDMETHOD.
69215
+ ENDCLASS.`,
69216
+ goodExample: `CLASS lcl DEFINITION.
69217
+ PUBLIC SECTION.
69218
+ METHODS bar IMPORTING sdf TYPE string.
69219
+ ENDCLASS.
69220
+ CLASS lcl IMPLEMENTATION.
69221
+ METHOD bar.
69222
+ WRITE sdf.
69223
+ ENDMETHOD.
69224
+ ENDCLASS.`,
69078
69225
  };
69079
69226
  }
69080
69227
  getConfig() {
@@ -69779,6 +69926,8 @@ Also see separate rule sql_escape_host_variables
69779
69926
 
69780
69927
  Activates from v750 and up`,
69781
69928
  tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix],
69929
+ badExample: `SELECT * FROM ztabl INTO TABLE @rt_content WHERE type = @iv_type ORDER BY PRIMARY KEY.`,
69930
+ goodExample: `SELECT * FROM ztabl WHERE type = @iv_type ORDER BY PRIMARY KEY INTO TABLE @rt_content.`,
69782
69931
  };
69783
69932
  }
69784
69933
  getConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.105.26",
3
+ "version": "2.106.0",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.105.26",
41
+ "@abaplint/core": "^2.106.0",
42
42
  "@types/chai": "^4.3.12",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.6",
46
- "@types/node": "^20.11.22",
46
+ "@types/node": "^20.11.25",
47
47
  "@types/progress": "^2.0.7",
48
48
  "chai": "^4.4.1",
49
49
  "chalk": "^5.3.0",
@@ -54,7 +54,7 @@
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^10.3.0",
56
56
  "progress": "^2.0.3",
57
- "typescript": "^5.3.3",
57
+ "typescript": "^5.4.2",
58
58
  "webpack": "^5.90.3",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"