@abaplint/cli 2.107.0 → 2.107.1

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 +53 -25
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -51462,7 +51462,7 @@ class Registry {
51462
51462
  }
51463
51463
  static abaplintVersion() {
51464
51464
  // magic, see build script "version.sh"
51465
- return "2.107.0";
51465
+ return "2.107.1";
51466
51466
  }
51467
51467
  getDDICReferences() {
51468
51468
  return this.ddicReferences;
@@ -51784,6 +51784,8 @@ https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_gui
51784
51784
 
51785
51785
  Checkes files with extensions ".abap" and ".asddls"`,
51786
51786
  tags: [_irule_1.RuleTag.SingleFile],
51787
+ badExample: `WRITE '뽑'.`,
51788
+ goodExample: `WRITE cl_abap_conv_in_ce=>uccp( 'BF51' ).`,
51787
51789
  };
51788
51790
  }
51789
51791
  initialize(_reg) {
@@ -52490,17 +52492,23 @@ exports.AlignParameters = AlignParameters;
52490
52492
 
52491
52493
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52492
52494
  exports.AlignTypeExpressions = exports.AlignTypeExpressionsConf = void 0;
52493
- const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
52494
52495
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
52495
52496
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
52497
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
52498
+ const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
52496
52499
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52497
- const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
52498
- const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
52500
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
52501
+ const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
52499
52502
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
52500
- /*
52501
- import {EditHelper, IEdit} from "../edit_helper";
52502
- */
52503
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
52504
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
52505
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
52503
52506
  class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
52507
+ constructor() {
52508
+ super(...arguments);
52509
+ /** Ignore global exception classes */
52510
+ this.ignoreExceptions = true;
52511
+ }
52504
52512
  }
52505
52513
  exports.AlignTypeExpressionsConf = AlignTypeExpressionsConf;
52506
52514
  class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
@@ -52516,9 +52524,11 @@ class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
52516
52524
  extendedInformation: `
52517
52525
  Currently works for METHODS + BEGIN OF
52518
52526
 
52527
+ If BEGIN OF has an INCLUDE TYPE its ignored
52528
+
52519
52529
  Also note that clean ABAP does not recommend aligning TYPE clauses:
52520
52530
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-align-type-clauses`,
52521
- tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],
52531
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
52522
52532
  badExample: `
52523
52533
  TYPES: BEGIN OF foo,
52524
52534
  bar TYPE i,
@@ -52551,16 +52561,45 @@ ENDINTERFACE.`,
52551
52561
  setConfig(conf) {
52552
52562
  this.conf = conf;
52553
52563
  }
52554
- runParsed(file) {
52564
+ runParsed(file, obj) {
52555
52565
  const issues = [];
52556
52566
  const stru = file.getStructure();
52557
52567
  if (stru === undefined) {
52558
52568
  return issues; // parser error
52559
52569
  }
52570
+ const ddic = new ddic_1.DDIC(this.reg);
52571
+ if (obj instanceof objects_1.Class) {
52572
+ const definition = obj.getClassDefinition();
52573
+ if (definition === undefined) {
52574
+ return [];
52575
+ }
52576
+ else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {
52577
+ return [];
52578
+ }
52579
+ }
52560
52580
  issues.push(...this.checkTypes(stru, file));
52561
52581
  issues.push(...this.checkMethods(stru, file));
52562
52582
  return issues;
52563
52583
  }
52584
+ check(fields, column, file) {
52585
+ const issues = [];
52586
+ for (const f of fields) {
52587
+ if (f.after.getCol() === column) {
52588
+ continue;
52589
+ }
52590
+ let fix = undefined;
52591
+ if (f.after.getCol() < column) {
52592
+ fix = edit_helper_1.EditHelper.insertAt(file, f.after, " ".repeat(column - f.after.getCol()));
52593
+ }
52594
+ else {
52595
+ fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(f.after.getRow(), column), f.after);
52596
+ }
52597
+ const message = `Align TYPE expressions to column ${column}`;
52598
+ const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity, fix);
52599
+ issues.push(issue);
52600
+ }
52601
+ return issues;
52602
+ }
52564
52603
  checkMethods(stru, file) {
52565
52604
  const issues = [];
52566
52605
  const methods = stru.findAllStatements(Statements.MethodDef);
@@ -52587,14 +52626,7 @@ ENDINTERFACE.`,
52587
52626
  });
52588
52627
  column = Math.max(column, name.getLastToken().getEnd().getCol() + 1);
52589
52628
  }
52590
- for (const f of fields) {
52591
- if (f.after.getCol() !== column) {
52592
- // const fix = this.buildFix(f.name, column);
52593
- const message = `Align TYPE expressions to column ${column}`;
52594
- const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity);
52595
- issues.push(issue);
52596
- }
52597
- }
52629
+ issues.push(...this.check(fields, column, file));
52598
52630
  }
52599
52631
  return issues;
52600
52632
  }
@@ -52602,6 +52634,9 @@ ENDINTERFACE.`,
52602
52634
  const issues = [];
52603
52635
  const types = stru.findAllStructuresRecursive(Structures.Types);
52604
52636
  for (const t of types) {
52637
+ if (t.findDirectStatement(Statements.IncludeType)) {
52638
+ continue;
52639
+ }
52605
52640
  const fields = [];
52606
52641
  let column = 0;
52607
52642
  const st = t.findDirectStatements(Statements.Type);
@@ -52613,14 +52648,7 @@ ENDINTERFACE.`,
52613
52648
  });
52614
52649
  column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
52615
52650
  }
52616
- for (const f of fields) {
52617
- if (f.after.getCol() !== column) {
52618
- // const fix = this.buildFix(f.name, column);
52619
- const message = `Align TYPE expressions to column ${column}`;
52620
- const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity);
52621
- issues.push(issue);
52622
- }
52623
- }
52651
+ issues.push(...this.check(fields, column, file));
52624
52652
  }
52625
52653
  return issues;
52626
52654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.107.0",
3
+ "version": "2.107.1",
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.107.0",
41
+ "@abaplint/core": "^2.107.1",
42
42
  "@types/chai": "^4.3.14",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",