@abaplint/cli 2.113.136 → 2.113.138

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 -35
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -6460,7 +6460,7 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
6460
6460
  class MessageClass extends combi_1.Expression {
6461
6461
  getRunnable() {
6462
6462
  // "&1" can be used for almost anything(field names, method names etc.) in macros
6463
- return (0, combi_1.seq)((0, combi_1.regex)(/^>?[\w\/]+#?@?\/?!?&?>?\$?\??<?$/), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.Plus)), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.PlusW)), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.optPrio)((0, combi_1.regex)(/^\w+$/)))), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.DashW)));
6463
+ return (0, combi_1.seq)((0, combi_1.regex)(/^>?[\w\/]+#?@?\/?!?&?>?\$?\??<?§?~?$/), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.Plus)), (0, combi_1.starPrio)((0, combi_1.tok)(tokens_1.PlusW)), (0, combi_1.starPrio)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.Dash), (0, combi_1.optPrio)((0, combi_1.regex)(/^\w+$/)))), (0, combi_1.optPrio)((0, combi_1.tok)(tokens_1.DashW)));
6464
6464
  }
6465
6465
  }
6466
6466
  exports.MessageClass = MessageClass;
@@ -16101,7 +16101,7 @@ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@a
16101
16101
  const transporting_fields_1 = __webpack_require__(/*! ../expressions/transporting_fields */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/transporting_fields.js");
16102
16102
  class ReadTable {
16103
16103
  getMatcher() {
16104
- const comparing = (0, combi_1.seq)("COMPARING", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), expressions_1.Dynamic));
16104
+ const comparing = (0, combi_1.seq)("COMPARING", (0, combi_1.alt)((0, combi_1.plus)(expressions_1.FieldSub), (0, combi_1.plus)(expressions_1.Dynamic)));
16105
16105
  const index = (0, combi_1.seq)("INDEX", expressions_1.Source);
16106
16106
  const components = (0, combi_1.seq)((0, combi_1.alt)(expressions_1.Field, expressions_1.Dynamic), "COMPONENTS", expressions_1.ComponentCompareSimple);
16107
16107
  const key = (0, combi_1.seq)((0, combi_1.altPrio)("WITH KEY", "WITH TABLE KEY"), (0, combi_1.alt)(expressions_1.ComponentCompareSimple, components, (0, combi_1.seq)((0, combi_1.optPrio)("="), expressions_1.Source)));
@@ -54566,14 +54566,14 @@ class Registry {
54566
54566
  this.objects = {};
54567
54567
  this.objectsByType = {};
54568
54568
  this.dependencies = {};
54569
- this.conf = conf ? conf : config_1.Config.getDefault();
54569
+ this.setConfig(conf ? conf : config_1.Config.getDefault());
54570
54570
  this.ddicReferences = new ddic_references_1.DDICReferences();
54571
54571
  this.msagReferences = new msag_references_1.MSAGReferences();
54572
54572
  this.macroReferences = new macro_references_1.MacroReferences();
54573
54573
  }
54574
54574
  static abaplintVersion() {
54575
54575
  // magic, see build script "version.sh"
54576
- return "2.113.136";
54576
+ return "2.113.138";
54577
54577
  }
54578
54578
  getDDICReferences() {
54579
54579
  return this.ddicReferences;
@@ -54651,12 +54651,11 @@ class Registry {
54651
54651
  obj.setDirty();
54652
54652
  }
54653
54653
  this.conf = conf;
54654
+ this.errorNamespace = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, "i");
54654
54655
  return this;
54655
54656
  }
54656
54657
  inErrorNamespace(name) {
54657
- // todo: performance? cache regexp?
54658
- const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, "i");
54659
- return reg.test(name);
54658
+ return this.errorNamespace.test(name);
54660
54659
  }
54661
54660
  addFile(file) {
54662
54661
  return this.addFiles([file]);
@@ -77346,9 +77345,35 @@ const artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ "./node_m
77346
77345
  const _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
77347
77346
  const skip_logic_1 = __webpack_require__(/*! ./skip_logic */ "./node_modules/@abaplint/core/build/src/skip_logic.js");
77348
77347
  const excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ "./node_modules/@abaplint/core/build/src/utils/excludeHelper.js");
77348
+ class SyntaxPerformance {
77349
+ constructor() {
77350
+ this.results = [];
77351
+ }
77352
+ push(obj, runtime) {
77353
+ if (runtime < 100) {
77354
+ return;
77355
+ }
77356
+ this.results.push({
77357
+ runtime: runtime,
77358
+ name: obj.getType() + " " + obj.getName(),
77359
+ });
77360
+ }
77361
+ output() {
77362
+ const MAX = 10;
77363
+ this.results.sort((a, b) => { return b.runtime - a.runtime; });
77364
+ for (let i = 0; i < MAX; i++) {
77365
+ const row = this.results[i];
77366
+ if (row === undefined) {
77367
+ break;
77368
+ }
77369
+ process.stderr.write(`\t${row.runtime}ms\t${row.name}\n`);
77370
+ }
77371
+ }
77372
+ }
77349
77373
  class RulesRunner {
77350
77374
  constructor(reg) {
77351
77375
  this.reg = reg;
77376
+ this.syntaxPerformance = new SyntaxPerformance();
77352
77377
  }
77353
77378
  objectsToCheck(objects) {
77354
77379
  const check = [];
@@ -77373,12 +77398,25 @@ class RulesRunner {
77373
77398
  for (const obj of check) {
77374
77399
  (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick("Run Syntax - " + obj.getName());
77375
77400
  if (obj instanceof _abap_object_1.ABAPObject) {
77401
+ const start = Date.now();
77376
77402
  new syntax_1.SyntaxLogic(this.reg, obj).run();
77403
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
77404
+ this.syntaxPerformance.push(obj, Date.now() - start);
77405
+ }
77377
77406
  }
77378
77407
  }
77408
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
77409
+ process.stderr.write("Syntax Performance:\n");
77410
+ this.syntaxPerformance.output();
77411
+ }
77379
77412
  (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, "Initialize Rules");
77380
77413
  for (const rule of rules) {
77381
- (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick("Initialize Rules - " + rule.getMetadata().key);
77414
+ if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
77415
+ process.stderr.write("Initializing rule " + rule.getMetadata().key + "\n");
77416
+ }
77417
+ else {
77418
+ (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick("Initialize Rules - " + rule.getMetadata().key);
77419
+ }
77382
77420
  if (rule.initialize === undefined) {
77383
77421
  throw new Error(rule.getMetadata().key + " missing initialize method");
77384
77422
  }
@@ -77798,6 +77836,7 @@ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./nod
77798
77836
  const severity_1 = __webpack_require__(/*! ../severity */ "./node_modules/@abaplint/core/build/src/severity.js");
77799
77837
  // todo, check for cycles/circular dependencies, method findTop
77800
77838
  // todo, add configurable error for multiple use includes
77839
+ const FMXXINCLUDE = /^(\/\w+\/)?L.+XX$/;
77801
77840
  function getABAPObjects(reg) {
77802
77841
  const ret = [];
77803
77842
  for (const o of reg.getObjects()) {
@@ -77809,40 +77848,33 @@ function getABAPObjects(reg) {
77809
77848
  }
77810
77849
  class Graph {
77811
77850
  constructor() {
77812
- this.vertices = [];
77813
- this.edges = [];
77851
+ this.verticesIncludenameIndex = {};
77852
+ this.verticesFilenameIndex = {};
77853
+ this.edges = {};
77814
77854
  }
77815
77855
  addVertex(vertex) {
77816
- this.vertices.push(vertex);
77856
+ this.verticesIncludenameIndex[vertex.includeName.toUpperCase()] = vertex;
77857
+ this.verticesFilenameIndex[vertex.filename.toUpperCase()] = vertex;
77817
77858
  }
77818
- findInclude(includeName) {
77819
- for (const v of this.vertices) {
77820
- if (v.includeName.toUpperCase() === includeName.toUpperCase()) {
77821
- return v;
77822
- }
77823
- }
77824
- return undefined;
77859
+ findVertexViaIncludename(includeName) {
77860
+ return this.verticesIncludenameIndex[includeName.toUpperCase()];
77825
77861
  }
77826
- findVertex(filename) {
77827
- for (const v of this.vertices) {
77828
- if (v.filename.toUpperCase() === filename.toUpperCase()) {
77829
- return v;
77830
- }
77831
- }
77832
- return undefined;
77862
+ findVertexByFilename(filename) {
77863
+ return this.verticesFilenameIndex[filename.toUpperCase()];
77833
77864
  }
77834
77865
  addEdge(from, toFilename) {
77835
- this.edges.push({ from: from.filename, to: toFilename });
77866
+ if (this.edges[from.filename] === undefined) {
77867
+ this.edges[from.filename] = [];
77868
+ }
77869
+ this.edges[from.filename].push(toFilename);
77836
77870
  }
77837
77871
  findTop(filename) {
77838
77872
  const ret = [];
77839
- for (const e of this.edges) {
77840
- if (e.from === filename) {
77841
- ret.push(...this.findTop(e.to));
77842
- }
77873
+ for (const to of this.edges[filename] || []) {
77874
+ ret.push(...this.findTop(to));
77843
77875
  }
77844
77876
  if (ret.length === 0) {
77845
- const found = this.findVertex(filename);
77877
+ const found = this.findVertexByFilename(filename);
77846
77878
  if (found !== undefined) {
77847
77879
  ret.push(found);
77848
77880
  }
@@ -77886,19 +77918,23 @@ class IncludeGraph {
77886
77918
  this.addVertices();
77887
77919
  for (const o of getABAPObjects(this.reg)) {
77888
77920
  for (const f of o.getABAPFiles()) {
77921
+ if (f.getFilename().includes(".prog.screen_") || f.getFilename().includes(".fugr.screen_")) {
77922
+ // skip dynpro files
77923
+ continue;
77924
+ }
77889
77925
  for (const s of f.getStatements()) {
77890
77926
  if (s.get() instanceof statements_1.Include) {
77891
- const ifFound = s.concatTokens().toUpperCase().includes("IF FOUND");
77892
77927
  const iexp = s.findFirstExpression(expressions_1.IncludeName);
77893
77928
  if (iexp === undefined) {
77894
77929
  throw new Error("unexpected Include node");
77895
77930
  }
77896
77931
  const name = iexp.getFirstToken().getStr().toUpperCase();
77897
- if (name.match(/^(\/\w+\/)?L.+XX$/)) { // function module XX includes, possibily namespaced
77932
+ if (name.match(FMXXINCLUDE)) { // function module XX includes, possibily namespaced
77898
77933
  continue;
77899
77934
  }
77900
- const found = this.graph.findInclude(name);
77935
+ const found = this.graph.findVertexViaIncludename(name);
77901
77936
  if (found === undefined) {
77937
+ const ifFound = s.concatTokens().toUpperCase().includes("IF FOUND");
77902
77938
  if (ifFound === false) {
77903
77939
  const issue = issue_1.Issue.atStatement(f, s, "Include " + name + " not found", new check_include_1.CheckInclude().getMetadata().key, severity_1.Severity.Error);
77904
77940
  this.issues.push(issue);
@@ -77918,7 +77954,7 @@ class IncludeGraph {
77918
77954
  this.findUnusedIncludes();
77919
77955
  }
77920
77956
  findUnusedIncludes() {
77921
- for (const v of this.graph.vertices) {
77957
+ for (const v of Object.values(this.graph.verticesFilenameIndex)) {
77922
77958
  if (v.include === true) {
77923
77959
  if (this.listMainForInclude(v.filename).length === 0) {
77924
77960
  const f = this.reg.getFileByName(v.filename);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.113.136",
3
+ "version": "2.113.138",
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.113.136",
41
+ "@abaplint/core": "^2.113.138",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",