@abaplint/cli 2.108.8 → 2.108.10

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 +64 -11
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -17959,7 +17959,7 @@ class Sequence {
17959
17959
  }
17960
17960
  run(statements, parent) {
17961
17961
  let inn = statements;
17962
- const out = [];
17962
+ let out = [];
17963
17963
  for (const i of this.list) {
17964
17964
  const match = i.run(inn, parent);
17965
17965
  if (match.error) {
@@ -17971,7 +17971,14 @@ class Sequence {
17971
17971
  errorMatched: out.length,
17972
17972
  };
17973
17973
  }
17974
- out.push(...match.matched);
17974
+ if (match.matched.length < 100) {
17975
+ out.push(...match.matched);
17976
+ }
17977
+ else {
17978
+ // avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
17979
+ // when the number of matched elements is very large
17980
+ out = out.concat(match.matched);
17981
+ }
17975
17982
  inn = match.unmatched;
17976
17983
  }
17977
17984
  return {
@@ -18103,7 +18110,7 @@ class Star {
18103
18110
  }
18104
18111
  run(statements, parent) {
18105
18112
  let inn = statements;
18106
- const out = [];
18113
+ let out = [];
18107
18114
  while (true) {
18108
18115
  if (inn.length === 0) {
18109
18116
  return {
@@ -18135,7 +18142,14 @@ class Star {
18135
18142
  };
18136
18143
  }
18137
18144
  }
18138
- out.push(...match.matched);
18145
+ if (match.matched.length < 100) {
18146
+ out.push(...match.matched);
18147
+ }
18148
+ else {
18149
+ // avoid using the spread operator, it might trigger "Maximum call stack size exceeded"
18150
+ // when the number of matched elements is very large
18151
+ out = out.concat(match.matched);
18152
+ }
18139
18153
  inn = match.unmatched;
18140
18154
  }
18141
18155
  }
@@ -51592,7 +51606,7 @@ class Registry {
51592
51606
  }
51593
51607
  static abaplintVersion() {
51594
51608
  // magic, see build script "version.sh"
51595
- return "2.108.8";
51609
+ return "2.108.10";
51596
51610
  }
51597
51611
  getDDICReferences() {
51598
51612
  return this.ddicReferences;
@@ -54457,7 +54471,7 @@ If sy-dbcnt is checked after database statements, it is considered okay.
54457
54471
  If IS ASSIGNED is checked after assigning, it is considered okay.
54458
54472
 
54459
54473
  FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
54460
- tags: [_irule_1.RuleTag.SingleFile],
54474
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
54461
54475
  pseudoComment: "EC CI_SUBRC",
54462
54476
  pragma: "##SUBRC_OK",
54463
54477
  };
@@ -69284,7 +69298,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
69284
69298
  exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
69285
69299
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
69286
69300
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
69301
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
69287
69302
  const __1 = __webpack_require__(/*! .. */ "./node_modules/@abaplint/core/build/src/index.js");
69303
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
69288
69304
  class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
69289
69305
  constructor() {
69290
69306
  super(...arguments);
@@ -69305,7 +69321,7 @@ class SelectSingleFullKey {
69305
69321
 
69306
69322
  If the statement contains a JOIN it is not checked`,
69307
69323
  pseudoComment: "EC CI_NOORDER",
69308
- tags: [],
69324
+ tags: [_irule_1.RuleTag.Quickfix],
69309
69325
  };
69310
69326
  }
69311
69327
  initialize(reg) {
@@ -69326,6 +69342,12 @@ If the statement contains a JOIN it is not checked`,
69326
69342
  setConfig(conf) {
69327
69343
  this.conf = conf;
69328
69344
  }
69345
+ buildFix(file, statement) {
69346
+ return {
69347
+ description: `Add "#EC CI_NOORDER`,
69348
+ edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getStart(), ` "#EC CI_NOORDER`),
69349
+ };
69350
+ }
69329
69351
  run(obj) {
69330
69352
  var _a, _b;
69331
69353
  if (!(obj instanceof __1.ABAPObject)) {
@@ -69387,7 +69409,8 @@ If the statement contains a JOIN it is not checked`,
69387
69409
  }
69388
69410
  }
69389
69411
  if (set.size > 0) {
69390
- issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity));
69412
+ const fix = this.buildFix(file, s);
69413
+ issues.push(issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity, undefined, [fix]));
69391
69414
  }
69392
69415
  }
69393
69416
  }
@@ -71852,7 +71875,13 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
71852
71875
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
71853
71876
  const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
71854
71877
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
71878
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
71855
71879
  class UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {
71880
+ constructor() {
71881
+ super(...arguments);
71882
+ /** Allow empty METHODs + FORMs + FUNCTION-MODULEs */
71883
+ this.allowEmpty = false;
71884
+ }
71856
71885
  }
71857
71886
  exports.UnnecessaryReturnConf = UnnecessaryReturnConf;
71858
71887
  class UnnecessaryReturn extends _abap_rule_1.ABAPRule {
@@ -71896,15 +71925,29 @@ ENDFORM.`,
71896
71925
  }
71897
71926
  const message = "Unnecessary RETURN";
71898
71927
  const statements = file.getStatements();
71928
+ let statementCounter = 0;
71899
71929
  for (let i = 0; i < statements.length; i++) {
71900
71930
  const node = statements[i];
71901
- if (!(node.get() instanceof Statements.EndMethod
71902
- || node.get() instanceof Statements.EndForm
71903
- || node.get() instanceof Statements.EndFunction)) {
71931
+ const nodeType = node.get();
71932
+ if ((nodeType instanceof Statements.MethodImplementation
71933
+ || nodeType instanceof Statements.Form
71934
+ || nodeType instanceof Statements.FunctionModule)) {
71935
+ statementCounter = 0;
71936
+ continue;
71937
+ }
71938
+ if (!(nodeType instanceof _statement_1.Comment)) {
71939
+ statementCounter++;
71940
+ }
71941
+ if (!(nodeType instanceof Statements.EndMethod
71942
+ || nodeType instanceof Statements.EndForm
71943
+ || nodeType instanceof Statements.EndFunction)) {
71904
71944
  continue;
71905
71945
  }
71906
71946
  const prev = statements[i - 1];
71907
71947
  if (prev && prev.get() instanceof Statements.Return) {
71948
+ if (this.conf.allowEmpty === true && statementCounter === 2) {
71949
+ continue;
71950
+ }
71908
71951
  const fix = edit_helper_1.EditHelper.deleteStatement(file, prev);
71909
71952
  issues.push(issue_1.Issue.atStatement(file, prev, message, this.getMetadata().key, this.getConfig().severity, fix));
71910
71953
  }
@@ -74946,6 +74989,8 @@ exports.validate = function (xmlData, options) {
74946
74989
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
74947
74990
  } else if (attrStr.trim().length > 0) {
74948
74991
  return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
74992
+ } else if (tags.length === 0) {
74993
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
74949
74994
  } else {
74950
74995
  const otg = tags.pop();
74951
74996
  if (tagName !== otg.tagName) {
@@ -76233,10 +76278,18 @@ const parseXml = function(xmlData) {
76233
76278
  let tagContent = "";
76234
76279
  //self-closing tag
76235
76280
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
76281
+ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
76282
+ tagName = tagName.substr(0, tagName.length - 1);
76283
+ jPath = jPath.substr(0, jPath.length - 1);
76284
+ tagExp = tagName;
76285
+ }else{
76286
+ tagExp = tagExp.substr(0, tagExp.length - 1);
76287
+ }
76236
76288
  i = result.closeIndex;
76237
76289
  }
76238
76290
  //unpaired tag
76239
76291
  else if(this.options.unpairedTags.indexOf(tagName) !== -1){
76292
+
76240
76293
  i = result.closeIndex;
76241
76294
  }
76242
76295
  //normal tag
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.108.8",
3
+ "version": "2.108.10",
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.108.8",
41
+ "@abaplint/core": "^2.108.10",
42
42
  "@types/chai": "^4.3.16",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",