@abaplint/cli 2.106.9 → 2.107.0

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 +154 -1
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -49987,12 +49987,14 @@ class Table extends _abstract_object_1.AbstractObject {
49987
49987
  }
49988
49988
  getAllowedNaming() {
49989
49989
  let length = 30;
49990
+ const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3})\w+$/;
49990
49991
  if (this.getTableCategory() === TableCategory.Transparent) {
49991
49992
  length = 16;
49992
49993
  }
49993
49994
  return {
49994
49995
  maxLength: length,
49995
49996
  allowNamespace: true,
49997
+ customRegex: regex,
49996
49998
  };
49997
49999
  }
49998
50000
  setDirty() {
@@ -51460,7 +51462,7 @@ class Registry {
51460
51462
  }
51461
51463
  static abaplintVersion() {
51462
51464
  // magic, see build script "version.sh"
51463
- return "2.106.9";
51465
+ return "2.107.0";
51464
51466
  }
51465
51467
  getDDICReferences() {
51466
51468
  return this.ddicReferences;
@@ -52478,6 +52480,156 @@ exports.AlignParameters = AlignParameters;
52478
52480
 
52479
52481
  /***/ }),
52480
52482
 
52483
+ /***/ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js":
52484
+ /*!*******************************************************************************!*\
52485
+ !*** ./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js ***!
52486
+ \*******************************************************************************/
52487
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
52488
+
52489
+ "use strict";
52490
+
52491
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
52492
+ exports.AlignTypeExpressions = exports.AlignTypeExpressionsConf = void 0;
52493
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
52494
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
52495
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
52496
+ 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");
52499
+ 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
+ class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
52504
+ }
52505
+ exports.AlignTypeExpressionsConf = AlignTypeExpressionsConf;
52506
+ class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
52507
+ constructor() {
52508
+ super(...arguments);
52509
+ this.conf = new AlignTypeExpressionsConf();
52510
+ }
52511
+ getMetadata() {
52512
+ return {
52513
+ key: "align_type_expressions",
52514
+ title: "Align TYPE expressions",
52515
+ shortDescription: `Align TYPE expressions in statements`,
52516
+ extendedInformation: `
52517
+ Currently works for METHODS + BEGIN OF
52518
+
52519
+ Also note that clean ABAP does not recommend aligning TYPE clauses:
52520
+ 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],
52522
+ badExample: `
52523
+ TYPES: BEGIN OF foo,
52524
+ bar TYPE i,
52525
+ foobar TYPE i,
52526
+ END OF foo.
52527
+
52528
+ INTERFACE lif.
52529
+ METHODS bar
52530
+ IMPORTING
52531
+ foo TYPE i
52532
+ foobar TYPE i.
52533
+ ENDINTERFACE.`,
52534
+ goodExample: `
52535
+ TYPES: BEGIN OF foo,
52536
+ bar TYPE i,
52537
+ foobar TYPE i,
52538
+ END OF foo.
52539
+
52540
+ INTERFACE lif.
52541
+ METHODS bar
52542
+ IMPORTING
52543
+ foo TYPE i
52544
+ foobar TYPE i.
52545
+ ENDINTERFACE.`,
52546
+ };
52547
+ }
52548
+ getConfig() {
52549
+ return this.conf;
52550
+ }
52551
+ setConfig(conf) {
52552
+ this.conf = conf;
52553
+ }
52554
+ runParsed(file) {
52555
+ const issues = [];
52556
+ const stru = file.getStructure();
52557
+ if (stru === undefined) {
52558
+ return issues; // parser error
52559
+ }
52560
+ issues.push(...this.checkTypes(stru, file));
52561
+ issues.push(...this.checkMethods(stru, file));
52562
+ return issues;
52563
+ }
52564
+ checkMethods(stru, file) {
52565
+ const issues = [];
52566
+ const methods = stru.findAllStatements(Statements.MethodDef);
52567
+ for (const m of methods) {
52568
+ const fields = [];
52569
+ const params = m.findAllExpressions(Expressions.MethodParam);
52570
+ let column = 0;
52571
+ for (const p of params) {
52572
+ const children = p.getChildren();
52573
+ const name = children[children.length - 2];
52574
+ fields.push({
52575
+ nameEnd: name.getLastToken().getEnd(),
52576
+ after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
52577
+ });
52578
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
52579
+ }
52580
+ const ret = m.findFirstExpression(Expressions.MethodDefReturning);
52581
+ if (ret) {
52582
+ const children = ret.getChildren();
52583
+ const name = children[children.length - 2];
52584
+ fields.push({
52585
+ nameEnd: name.getLastToken().getEnd(),
52586
+ after: ret.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
52587
+ });
52588
+ column = Math.max(column, name.getLastToken().getEnd().getCol() + 1);
52589
+ }
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
+ }
52598
+ }
52599
+ return issues;
52600
+ }
52601
+ checkTypes(stru, file) {
52602
+ const issues = [];
52603
+ const types = stru.findAllStructuresRecursive(Structures.Types);
52604
+ for (const t of types) {
52605
+ const fields = [];
52606
+ let column = 0;
52607
+ const st = t.findDirectStatements(Statements.Type);
52608
+ for (const s of st) {
52609
+ const name = s.getChildren()[1];
52610
+ fields.push({
52611
+ nameEnd: name.getLastToken().getEnd(),
52612
+ after: s.getChildren()[2].getFirstToken().getStart()
52613
+ });
52614
+ column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
52615
+ }
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
+ }
52624
+ }
52625
+ return issues;
52626
+ }
52627
+ }
52628
+ exports.AlignTypeExpressions = AlignTypeExpressions;
52629
+ //# sourceMappingURL=align_type_expressions.js.map
52630
+
52631
+ /***/ }),
52632
+
52481
52633
  /***/ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js":
52482
52634
  /*!******************************************************************************!*\
52483
52635
  !*** ./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js ***!
@@ -61831,6 +61983,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
61831
61983
  __exportStar(__webpack_require__(/*! ./7bit_ascii */ "./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js"), exports);
61832
61984
  __exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core/build/src/rules/abapdoc.js"), exports);
61833
61985
  __exportStar(__webpack_require__(/*! ./align_parameters */ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js"), exports);
61986
+ __exportStar(__webpack_require__(/*! ./align_type_expressions */ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js"), exports);
61834
61987
  __exportStar(__webpack_require__(/*! ./allowed_object_naming */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js"), exports);
61835
61988
  __exportStar(__webpack_require__(/*! ./allowed_object_types */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js"), exports);
61836
61989
  __exportStar(__webpack_require__(/*! ./ambiguous_statement */ "./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.106.9",
3
+ "version": "2.107.0",
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.106.9",
41
+ "@abaplint/core": "^2.107.0",
42
42
  "@types/chai": "^4.3.14",
43
43
  "@types/glob": "^8.1.0",
44
44
  "@types/minimist": "^1.2.5",