@abaplint/cli 2.108.2 → 2.108.3

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 +58 -30
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -41422,8 +41422,8 @@ class Issue {
41422
41422
  severity,
41423
41423
  });
41424
41424
  }
41425
- static atStatement(file, statement, message, key, severity, fix) {
41426
- return this.atRange(file, statement.getStart(), statement.getEnd(), message, key, severity, fix);
41425
+ static atStatement(file, statement, message, key, severity, fix, alternativeFixes) {
41426
+ return this.atRange(file, statement.getStart(), statement.getEnd(), message, key, severity, fix, alternativeFixes);
41427
41427
  }
41428
41428
  static atPosition(file, start, message, key, severity, fix) {
41429
41429
  const row = start.getRow();
@@ -41453,7 +41453,7 @@ class Issue {
41453
41453
  severity,
41454
41454
  });
41455
41455
  }
41456
- static atRange(file, start, end, message, key, severity, fix) {
41456
+ static atRange(file, start, end, message, key, severity, fix, alternativeFixes) {
41457
41457
  severity = severity !== null && severity !== void 0 ? severity : severity_1.Severity.Error;
41458
41458
  return new Issue({
41459
41459
  filename: file.getFilename(),
@@ -41463,6 +41463,7 @@ class Issue {
41463
41463
  end,
41464
41464
  defaultFix: fix,
41465
41465
  severity,
41466
+ alternativeFixes,
41466
41467
  });
41467
41468
  }
41468
41469
  static atToken(file, token, message, key, severity, fix) {
@@ -42062,26 +42063,36 @@ class CodeActions {
42062
42063
  const ret = [];
42063
42064
  for (const i of issues) {
42064
42065
  const fix = i.getDefaultFix();
42065
- if (fix === undefined) {
42066
- continue;
42067
- }
42068
- if (totals[i.getKey()] === undefined) {
42069
- totals[i.getKey()] = 1;
42070
- }
42071
- else {
42072
- totals[i.getKey()]++;
42066
+ if (fix !== undefined) {
42067
+ if (totals[i.getKey()] === undefined) {
42068
+ totals[i.getKey()] = 1;
42069
+ }
42070
+ else {
42071
+ totals[i.getKey()]++;
42072
+ }
42073
+ if (this.inRange(i, params.range) === true) {
42074
+ ret.push({
42075
+ title: "Apply fix, " + i.getKey(),
42076
+ kind: LServer.CodeActionKind.QuickFix,
42077
+ diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
42078
+ isPreferred: true,
42079
+ edit: _edit_1.LSPEdit.mapEdit(fix),
42080
+ });
42081
+ shown.add(i.getKey());
42082
+ }
42073
42083
  }
42074
- if (this.inRange(i, params.range) === false) {
42075
- continue;
42084
+ for (const alternative of i.getAlternativeFixes() || []) {
42085
+ if (this.inRange(i, params.range) === true) {
42086
+ ret.push({
42087
+ title: alternative.description,
42088
+ kind: LServer.CodeActionKind.QuickFix,
42089
+ diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
42090
+ isPreferred: true,
42091
+ edit: _edit_1.LSPEdit.mapEdit(alternative.edit),
42092
+ });
42093
+ shown.add(i.getKey());
42094
+ }
42076
42095
  }
42077
- ret.push({
42078
- title: "Apply fix, " + i.getKey(),
42079
- kind: LServer.CodeActionKind.QuickFix,
42080
- diagnostics: [diagnostics_1.Diagnostics.mapDiagnostic(i)],
42081
- isPreferred: true,
42082
- edit: _edit_1.LSPEdit.mapEdit(fix),
42083
- });
42084
- shown.add(i.getKey());
42085
42096
  }
42086
42097
  for (const s of shown) {
42087
42098
  if (totals[s] > 1) {
@@ -51483,7 +51494,7 @@ class Registry {
51483
51494
  }
51484
51495
  static abaplintVersion() {
51485
51496
  // magic, see build script "version.sh"
51486
- return "2.108.2";
51497
+ return "2.108.3";
51487
51498
  }
51488
51499
  getDDICReferences() {
51489
51500
  return this.ddicReferences;
@@ -54312,6 +54323,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
54312
54323
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
54313
54324
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
54314
54325
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
54326
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
54315
54327
  class CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {
54316
54328
  constructor() {
54317
54329
  super(...arguments);
@@ -54358,6 +54370,12 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
54358
54370
  setConfig(conf) {
54359
54371
  this.conf = conf;
54360
54372
  }
54373
+ buildFix(file, statement) {
54374
+ return {
54375
+ description: "Add ##SUBRC_OK",
54376
+ edit: edit_helper_1.EditHelper.insertAt(file, statement.getLastToken().getEnd(), " ##SUBRC_OK"),
54377
+ };
54378
+ }
54361
54379
  runParsed(file) {
54362
54380
  const issues = [];
54363
54381
  const statements = file.getStatements();
@@ -54372,11 +54390,13 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
54372
54390
  if (config.openDataset === true
54373
54391
  && statement.get() instanceof Statements.OpenDataset
54374
54392
  && this.isChecked(i, statements) === false) {
54393
+ // it doesnt make sense to ignore the subrc for open dataset, so no quick fix
54375
54394
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54376
54395
  }
54377
54396
  else if (config.authorityCheck === true
54378
54397
  && statement.get() instanceof Statements.AuthorityCheck
54379
54398
  && this.isChecked(i, statements) === false) {
54399
+ // it doesnt make sense to ignore the subrc for authority checks, so no quick fix
54380
54400
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54381
54401
  }
54382
54402
  else if (config.selectSingle === true
@@ -54388,7 +54408,8 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
54388
54408
  if (concat.startsWith("SELECT SINGLE @ABAP_TRUE FROM ")) {
54389
54409
  continue;
54390
54410
  }
54391
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54411
+ const fix = this.buildFix(file, statement);
54412
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54392
54413
  }
54393
54414
  else if (config.selectTable === true
54394
54415
  && statement.get() instanceof Statements.Select
@@ -54397,42 +54418,49 @@ FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
54397
54418
  && statement.concatTokens().toUpperCase().startsWith("SELECT COUNT(*) ") === false
54398
54419
  && this.isChecked(i, statements) === false
54399
54420
  && this.checksDbcnt(i, statements) === false) {
54400
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54421
+ const fix = this.buildFix(file, statement);
54422
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54401
54423
  }
54402
54424
  else if (config.updateDatabase === true
54403
54425
  && statement.get() instanceof Statements.UpdateDatabase
54404
54426
  && this.isChecked(i, statements) === false
54405
54427
  && this.checksDbcnt(i, statements) === false) {
54406
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54428
+ const fix = this.buildFix(file, statement);
54429
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54407
54430
  }
54408
54431
  else if (config.insertDatabase === true
54409
54432
  && statement.get() instanceof Statements.InsertDatabase
54410
54433
  && this.isChecked(i, statements) === false
54411
54434
  && this.checksDbcnt(i, statements) === false) {
54412
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54435
+ const fix = this.buildFix(file, statement);
54436
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54413
54437
  }
54414
54438
  else if (config.modifyDatabase === true
54415
54439
  && statement.get() instanceof Statements.ModifyDatabase
54416
54440
  && this.isChecked(i, statements) === false
54417
54441
  && this.checksDbcnt(i, statements) === false) {
54418
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54442
+ const fix = this.buildFix(file, statement);
54443
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54419
54444
  }
54420
54445
  else if (config.readTable === true
54421
54446
  && statement.get() instanceof Statements.ReadTable
54422
54447
  && this.isChecked(i, statements) === false) {
54423
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54448
+ const fix = this.buildFix(file, statement);
54449
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54424
54450
  }
54425
54451
  else if (config.assign === true
54426
54452
  && statement.get() instanceof Statements.Assign
54427
54453
  && this.isSimpleAssign(statement) === false
54428
54454
  && this.isChecked(i, statements) === false) {
54429
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54455
+ const fix = this.buildFix(file, statement);
54456
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54430
54457
  }
54431
54458
  else if (config.find === true
54432
54459
  && statement.get() instanceof Statements.Find
54433
54460
  && this.isExemptedFind(statement) === false
54434
54461
  && this.isChecked(i, statements) === false) {
54435
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
54462
+ const fix = this.buildFix(file, statement);
54463
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, undefined, [fix]));
54436
54464
  }
54437
54465
  }
54438
54466
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.108.2",
3
+ "version": "2.108.3",
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.2",
41
+ "@abaplint/core": "^2.108.3",
42
42
  "@types/chai": "^4.3.16",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",