@abaplint/cli 2.119.21 → 2.119.23

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 +44 -16
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -47437,16 +47437,16 @@ class ABAPObject extends _abstract_object_1.AbstractObject {
47437
47437
  }
47438
47438
  }
47439
47439
  findTextsTranslations(parsed) {
47440
- var _a, _b, _c, _d, _e, _f;
47440
+ var _a, _b, _c, _d, _e, _f, _g;
47441
47441
  this.textsTranslations = [];
47442
- const values = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"].I18N_TPOOL) === null || _c === void 0 ? void 0 : _c.item;
47442
+ const values = (_d = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.I18N_TPOOL) === null || _d === void 0 ? void 0 : _d.item;
47443
47443
  if (values === undefined) {
47444
47444
  return;
47445
47445
  }
47446
47446
  for (const langItem of (0, xml_utils_1.xmlToArray)(values)) {
47447
47447
  const textElements = {};
47448
- for (const item of (0, xml_utils_1.xmlToArray)((_d = langItem.TEXTPOOL) === null || _d === void 0 ? void 0 : _d.item)) {
47449
- const key = (_f = ((_e = item.KEY) !== null && _e !== void 0 ? _e : item.ID)) === null || _f === void 0 ? void 0 : _f.toUpperCase();
47448
+ for (const item of (0, xml_utils_1.xmlToArray)((_e = langItem.TEXTPOOL) === null || _e === void 0 ? void 0 : _e.item)) {
47449
+ const key = (_g = ((_f = item.KEY) !== null && _f !== void 0 ? _f : item.ID)) === null || _g === void 0 ? void 0 : _g.toUpperCase();
47450
47450
  if (key !== undefined) {
47451
47451
  textElements[key] = { entry: (0, xml_utils_1.unescape)(item.ENTRY), maxLength: parseInt(item.LENGTH, 10) };
47452
47452
  }
@@ -55378,23 +55378,22 @@ class Transaction extends _abstract_object_1.AbstractObject {
55378
55378
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.textsTranslations;
55379
55379
  }
55380
55380
  parse() {
55381
- var _a, _b, _c, _d;
55381
+ var _a, _b, _c, _d, _e, _f;
55382
55382
  if (this.parsedXML) {
55383
55383
  return { updated: false, runtime: 0 };
55384
55384
  }
55385
55385
  const start = Date.now();
55386
55386
  this.parsedXML = {};
55387
55387
  const parsed = super.parseRaw2();
55388
- if (parsed === undefined
55389
- || parsed.abapGit === undefined
55390
- || parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
55388
+ const values = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"];
55389
+ if (values === undefined) {
55391
55390
  return { updated: false, runtime: 0 };
55392
55391
  }
55393
- this.parsedXML.description = (_a = parsed.abapGit["asx:abap"]["asx:values"].TSTCT) === null || _a === void 0 ? void 0 : _a.TTEXT;
55394
- this.parsedXML.programName = (_b = parsed.abapGit["asx:abap"]["asx:values"].TSTC) === null || _b === void 0 ? void 0 : _b.PGMNA;
55395
- this.parsedXML.cinfo = (_c = parsed.abapGit["asx:abap"]["asx:values"].TSTC) === null || _c === void 0 ? void 0 : _c.CINFO;
55392
+ this.parsedXML.description = (_c = values.TSTCT) === null || _c === void 0 ? void 0 : _c.TTEXT;
55393
+ this.parsedXML.programName = (_d = values.TSTC) === null || _d === void 0 ? void 0 : _d.PGMNA;
55394
+ this.parsedXML.cinfo = (_e = values.TSTC) === null || _e === void 0 ? void 0 : _e.CINFO;
55396
55395
  this.parsedXML.textsTranslations = [];
55397
- for (const item of (0, xml_utils_1.xmlToArray)((_d = parsed.abapGit["asx:abap"]["asx:values"].I18N_TPOOL) === null || _d === void 0 ? void 0 : _d.TSTCT)) {
55396
+ for (const item of (0, xml_utils_1.xmlToArray)((_f = values.I18N_TPOOL) === null || _f === void 0 ? void 0 : _f.TSTCT)) {
55398
55397
  this.parsedXML.textsTranslations.push({ language: item.SPRSL, description: item.TTEXT });
55399
55398
  }
55400
55399
  const end = Date.now();
@@ -56457,7 +56456,7 @@ class Registry {
56457
56456
  }
56458
56457
  static abaplintVersion() {
56459
56458
  // magic, see build script "version.sh"
56460
- return "2.119.21";
56459
+ return "2.119.23";
56461
56460
  }
56462
56461
  getDDICReferences() {
56463
56462
  return this.ddicReferences;
@@ -60338,11 +60337,12 @@ class CheckTextElements {
60338
60337
  }
60339
60338
  }
60340
60339
  for (const e of expressions) {
60340
+ const mainNameSuffix = mainName !== undefined && mainName.toLowerCase() !== file.getFilename().toLowerCase() ? ", " + mainName : "";
60341
60341
  if (e.get() instanceof Expressions.TextElement) {
60342
60342
  const token = e.findFirstExpression(Expressions.TextElementKey).getFirstToken();
60343
60343
  const key = token.getStr().toUpperCase();
60344
60344
  if (texts[key] === undefined) {
60345
- const message = `Text element "${key}" not found` + (mainName ? ", " + mainName : "");
60345
+ const message = `Text element "${key}" not found` + mainNameSuffix;
60346
60346
  output.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
60347
60347
  }
60348
60348
  }
@@ -60356,7 +60356,7 @@ class CheckTextElements {
60356
60356
  found = found.replace(/'/g, "''");
60357
60357
  }
60358
60358
  if (found === undefined) {
60359
- const message = `Text element "${key}" not found` + (mainName ? ", " + mainName : "");
60359
+ const message = `Text element "${key}" not found` + mainNameSuffix;
60360
60360
  output.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
60361
60361
  }
60362
60362
  else if (code !== "'" + found + "'"
@@ -78331,8 +78331,30 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
78331
78331
  this.check(name, n, file);
78332
78332
  }
78333
78333
  }
78334
+ else if (r.referenceType === _reference_1.ReferenceType.ConstructorReference
78335
+ && r.position.getStart().isAfter(start)
78336
+ && r.position.getEnd().isBefore(end)
78337
+ && r.resolved instanceof types_1.ClassDefinition) {
78338
+ const method = this.findConstructor(r.resolved, scope);
78339
+ for (const name of (method === null || method === void 0 ? void 0 : method.getRaising()) || []) {
78340
+ this.check(name, n, file);
78341
+ }
78342
+ }
78334
78343
  }
78335
78344
  }
78345
+ findConstructor(def, scope) {
78346
+ for (const method of def.getMethodDefinitions().getAll()) {
78347
+ if (method instanceof types_1.MethodDefinition && method.getName().toUpperCase() === "CONSTRUCTOR") {
78348
+ return method;
78349
+ }
78350
+ }
78351
+ const sup = def.getSuperClass();
78352
+ if (sup === undefined) {
78353
+ return undefined;
78354
+ }
78355
+ const superDefinition = scope === null || scope === void 0 ? void 0 : scope.findClassDefinition(sup);
78356
+ return superDefinition ? this.findConstructor(superDefinition, scope) : undefined;
78357
+ }
78336
78358
  addFromTryStructure(s) {
78337
78359
  if (this.sinked === undefined) {
78338
78360
  return;
@@ -80683,7 +80705,13 @@ const Objects = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/
80683
80705
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
80684
80706
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
80685
80707
  const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/lib/fxp.cjs");
80708
+ const severity_1 = __webpack_require__(/*! ../severity */ "./node_modules/@abaplint/core/build/src/severity.js");
80686
80709
  class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
80710
+ constructor() {
80711
+ super(...arguments);
80712
+ /** Problem severity for text and translation length checks */
80713
+ this.textAndTranslationLengthSeverity = severity_1.Severity.Error;
80714
+ }
80687
80715
  }
80688
80716
  exports.XMLConsistencyConf = XMLConsistencyConf;
80689
80717
  class XMLConsistency {
@@ -80806,7 +80834,7 @@ class XMLConsistency {
80806
80834
  const max = typeof maxLength === "number" ? maxLength : parseInt(maxLength, 10);
80807
80835
  if (text.length > max) {
80808
80836
  const prefix = lang ? `[${lang}] ` : "";
80809
- return issue_1.Issue.atRow(file, 1, `${prefix}${fieldName} "${text}" exceeds maximum length of ${max} characters (actual: ${text.length})`, this.getMetadata().key, this.conf.severity);
80837
+ return issue_1.Issue.atRow(file, 1, `${prefix}${fieldName} "${text}" exceeds maximum length of ${max} characters (actual: ${text.length})`, this.getMetadata().key, this.conf.textAndTranslationLengthSeverity);
80810
80838
  }
80811
80839
  return undefined;
80812
80840
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.21",
3
+ "version": "2.119.23",
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.119.21",
41
+ "@abaplint/core": "^2.119.23",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",