@abaplint/cli 2.106.7 → 2.106.9

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 +71 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -26492,6 +26492,7 @@ const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/
26492
26492
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
26493
26493
  const sql_compare_1 = __webpack_require__(/*! ./sql_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_compare.js");
26494
26494
  const sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_order_by.js");
26495
+ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
26495
26496
  const isSimple = /^\w+$/;
26496
26497
  class Select {
26497
26498
  runSyntax(node, scope, filename, skipImplicitInto = false) {
@@ -26502,7 +26503,7 @@ class Select {
26502
26503
  if (from === undefined) {
26503
26504
  throw new Error(`Missing FROM`);
26504
26505
  }
26505
- const fields = this.findFields(node);
26506
+ const fields = this.findFields(node, scope, filename);
26506
26507
  if (fields.length === 0
26507
26508
  && node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
26508
26509
  throw new Error(`fields missing`);
@@ -26660,17 +26661,20 @@ class Select {
26660
26661
  }
26661
26662
  return new basic_1.VoidType("SELECT_todo");
26662
26663
  }
26663
- findFields(node) {
26664
- var _a;
26664
+ findFields(node, scope, filename) {
26665
+ var _a, _b;
26665
26666
  let expr = undefined;
26666
26667
  const ret = [];
26667
26668
  expr = node.findFirstExpression(Expressions.SQLFieldList);
26668
26669
  if (expr === undefined) {
26669
26670
  expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
26670
26671
  }
26672
+ if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
26673
+ new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), scope, filename);
26674
+ }
26671
26675
  for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
26672
26676
  let code = field.concatTokens().toUpperCase();
26673
- const as = ((_a = field.findDirectExpression(Expressions.SQLAsName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
26677
+ const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
26674
26678
  if (as !== "") {
26675
26679
  code = code.replace(" AS " + as, "");
26676
26680
  }
@@ -27112,13 +27116,18 @@ exports.SQLCompare = void 0;
27112
27116
  const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
27113
27117
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
27114
27118
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
27119
+ const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
27115
27120
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
27116
27121
  const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
27117
27122
  class SQLCompare {
27118
27123
  runSyntax(node, scope, filename, tables) {
27119
- var _a;
27124
+ var _a, _b;
27120
27125
  let sourceType;
27121
27126
  let token;
27127
+ if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
27128
+ new dynamic_1.Dynamic().runSyntax(node.getFirstChild(), scope, filename);
27129
+ return;
27130
+ }
27122
27131
  for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
27123
27132
  new source_1.Source().runSyntax(s, scope, filename);
27124
27133
  }
@@ -27144,7 +27153,7 @@ class SQLCompare {
27144
27153
  }
27145
27154
  }
27146
27155
  }
27147
- const fieldName = (_a = node.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
27156
+ const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
27148
27157
  if (fieldName && sourceType && token) {
27149
27158
  // check compatibility for rule sql_value_conversion
27150
27159
  const targetType = this.findType(fieldName, tables, scope);
@@ -51451,7 +51460,7 @@ class Registry {
51451
51460
  }
51452
51461
  static abaplintVersion() {
51453
51462
  // magic, see build script "version.sh"
51454
- return "2.106.7";
51463
+ return "2.106.9";
51455
51464
  }
51456
51465
  getDDICReferences() {
51457
51466
  return this.ddicReferences;
@@ -65177,6 +65186,7 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
65177
65186
  this.types = "^TY_";
65178
65187
  /** importing, exporting, returning and changing parameters, case insensitive regex */
65179
65188
  this.methodParameters = "^[ICER].?_";
65189
+ this.allowIsPrefixBoolean = true;
65180
65190
  // todo, public localClass: string = "";
65181
65191
  // todo, public localInterface: string = "";
65182
65192
  // todo, public functionModuleParameters: string = "";
@@ -65321,12 +65331,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
65321
65331
  return ret;
65322
65332
  }
65323
65333
  checkMethodParameters(topNode, regex, file) {
65334
+ var _a, _b;
65324
65335
  const ret = [];
65325
65336
  for (const method of topNode.findAllStatements(Statements.MethodDef)) {
65326
- for (const def of method.findAllExpressions(Expressions.MethodParamName)) {
65327
- const name = def.concatTokens();
65328
- if (name !== "" && name.match(regex)) {
65329
- const issue = issue_1.Issue.atToken(file, def.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
65337
+ for (const param of method.findAllExpressionsMulti([Expressions.MethodDefReturning, Expressions.MethodParam])) {
65338
+ const nameToken = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.MethodParamName);
65339
+ const type = (_b = (_a = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.TypeParam)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
65340
+ if (this.getConfig().allowIsPrefixBoolean === true && (type === null || type === void 0 ? void 0 : type.endsWith("TYPE ABAP_BOOL"))) {
65341
+ continue;
65342
+ }
65343
+ const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.concatTokens();
65344
+ if (nameToken && name && name !== "" && name.match(regex)) {
65345
+ const issue = issue_1.Issue.atToken(file, nameToken.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
65330
65346
  ret.push(issue);
65331
65347
  }
65332
65348
  }
@@ -71716,6 +71732,7 @@ Skips:
71716
71732
  `,
71717
71733
  tags: [],
71718
71734
  pragma: "##CALLED",
71735
+ pseudoComment: "EC CALLED",
71719
71736
  };
71720
71737
  }
71721
71738
  getConfig() {
@@ -71792,11 +71809,32 @@ Skips:
71792
71809
  if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {
71793
71810
  continue;
71794
71811
  }
71812
+ else if (this.suppressedbyPseudo(statement, file)) {
71813
+ continue;
71814
+ }
71795
71815
  const message = "Method \"" + i.identifier.getName() + "\" not used";
71796
71816
  issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));
71797
71817
  }
71798
71818
  return issues;
71799
71819
  }
71820
+ suppressedbyPseudo(statement, file) {
71821
+ if (statement === undefined) {
71822
+ return false;
71823
+ }
71824
+ if (file === undefined) {
71825
+ return false;
71826
+ }
71827
+ let next = false;
71828
+ for (const s of file.getStatements()) {
71829
+ if (next === true && s.get() instanceof _statement_1.Comment) {
71830
+ return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
71831
+ }
71832
+ if (s === statement) {
71833
+ next = true;
71834
+ }
71835
+ }
71836
+ return false;
71837
+ }
71800
71838
  searchGlobalSubclasses(obj) {
71801
71839
  var _a, _b;
71802
71840
  if (this.wa.getLength() === 0
@@ -71907,6 +71945,7 @@ class UnusedTypes {
71907
71945
  extendedInformation: `Unused types are not reported if the object contains parser or syntax errors.`,
71908
71946
  tags: [_irule_1.RuleTag.Quickfix],
71909
71947
  pragma: "##NEEDED",
71948
+ pseudoComment: "EC NEEDED",
71910
71949
  };
71911
71950
  }
71912
71951
  getConfig() {
@@ -71974,11 +72013,32 @@ class UnusedTypes {
71974
72013
  if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {
71975
72014
  continue;
71976
72015
  }
72016
+ else if (this.suppressedbyPseudo(statement, file)) {
72017
+ continue;
72018
+ }
71977
72019
  const fix = this.buildFix(file, statement);
71978
72020
  ret.push(issue_1.Issue.atIdentifier(t, message, this.getMetadata().key, this.conf.severity, fix));
71979
72021
  }
71980
72022
  return ret;
71981
72023
  }
72024
+ suppressedbyPseudo(statement, file) {
72025
+ if (statement === undefined) {
72026
+ return false;
72027
+ }
72028
+ if (file === undefined) {
72029
+ return false;
72030
+ }
72031
+ let next = false;
72032
+ for (const s of file.getStatements()) {
72033
+ if (next === true && s.get() instanceof _statement_1.Comment) {
72034
+ return s.concatTokens().includes(this.getMetadata().pseudoComment + "");
72035
+ }
72036
+ if (s === statement) {
72037
+ next = true;
72038
+ }
72039
+ }
72040
+ return false;
72041
+ }
71982
72042
  ////////////////////////////
71983
72043
  traverse(node, obj, add) {
71984
72044
  if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.106.7",
3
+ "version": "2.106.9",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.106.7",
41
+ "@abaplint/core": "^2.106.9",
42
42
  "@types/chai": "^4.3.14",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",