@abaplint/cli 2.120.53 → 2.120.55

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 +158 -6
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -12387,7 +12387,7 @@ class CallTransaction {
12387
12387
  getMatcher() {
12388
12388
  const options = (0, combi_1.seq)("OPTIONS FROM", expressions_1.Source);
12389
12389
  const messages = (0, combi_1.seq)("MESSAGES INTO", expressions_1.Target);
12390
- const auth = (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "WITHOUT"), "AUTHORITY-CHECK");
12390
+ const auth = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "WITHOUT"), "AUTHORITY-CHECK"), { also: combi_1.AlsoIn.OpenABAP });
12391
12391
  const perm = (0, combi_1.per)((0, combi_1.seq)("UPDATE", expressions_1.Source), "AND SKIP FIRST SCREEN", options, messages, (0, combi_1.seq)("MODE", expressions_1.Source));
12392
12392
  const ret = (0, combi_1.seq)("CALL TRANSACTION", expressions_1.Source, (0, combi_1.optPrio)(auth), (0, combi_1.optPrio)((0, combi_1.seq)("USING", expressions_1.Source)), (0, combi_1.opt)(perm));
12393
12393
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
@@ -70644,7 +70644,7 @@ class Registry {
70644
70644
  }
70645
70645
  static abaplintVersion() {
70646
70646
  // magic, see build script "version.js"
70647
- return "2.120.53";
70647
+ return "2.120.55";
70648
70648
  }
70649
70649
  getDDICReferences() {
70650
70650
  return this.ddicReferences;
@@ -71583,7 +71583,7 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
71583
71583
  * CREATE OBJECT statements
71584
71584
  * RAISE EVENT statements
71585
71585
 
71586
- https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
71586
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#align-parameters
71587
71587
 
71588
71588
  Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
71589
71589
 
@@ -76417,7 +76417,7 @@ class ConstantClasses {
76417
76417
  key: "constant_classes",
76418
76418
  title: "Validate constant classes",
76419
76419
  shortDescription: `Checks that a class contains exactly the constants corresponding to a domain's fixed values.`,
76420
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-enumeration-classes-to-constants-interfaces`,
76420
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-enum-to-constants-interfaces`,
76421
76421
  tags: [_irule_1.RuleTag.Styleguide],
76422
76422
  };
76423
76423
  }
@@ -78104,7 +78104,11 @@ Make sure to test the downported code, it might not always be completely correct
78104
78104
  return found;
78105
78105
  }
78106
78106
  */
78107
- let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
78107
+ let found = this.stripCallTransactionAuthorityCheck(high, lowFile);
78108
+ if (found) {
78109
+ return found;
78110
+ }
78111
+ found = this.downportEnum(low, high, lowFile, highSyntax, highFile);
78108
78112
  if (found) {
78109
78113
  return found;
78110
78114
  }
@@ -80598,6 +80602,31 @@ ${indentation} output = ${uniqueName}.\n`;
80598
80602
  }
80599
80603
  return false;
80600
80604
  }
80605
+ /** WITH/WITHOUT AUTHORITY-CHECK on CALL TRANSACTION requires v740sp02, so the statement is
80606
+ * Unknown in the low version, note that only WITHOUT is handled here */
80607
+ stripCallTransactionAuthorityCheck(high, lowFile) {
80608
+ if (!(high.get() instanceof Statements.CallTransaction)) {
80609
+ return undefined;
80610
+ }
80611
+ else if (this.lowReg.getConfig().isOpenABAP()) {
80612
+ // open-abap supports the addition
80613
+ return undefined;
80614
+ }
80615
+ const tokens = high.getTokens();
80616
+ // the lexer splits "AUTHORITY-CHECK" into three tokens: AUTHORITY, -, CHECK
80617
+ for (let i = 1; i < tokens.length - 3; i++) {
80618
+ if (tokens[i].getStr().toUpperCase() === "WITHOUT"
80619
+ && tokens[i + 1].getStr().toUpperCase() === "AUTHORITY"
80620
+ && tokens[i + 2].getStr() === "-"
80621
+ && tokens[i + 3].getStr().toUpperCase() === "CHECK") {
80622
+ // also remove the preceding space so no double space is left behind
80623
+ const fix = edit_helper_1.EditHelper.deleteRange(lowFile, tokens[i - 1].getEnd(), tokens[i + 3].getEnd());
80624
+ const message = "Remove WITHOUT AUTHORITY-CHECK from CALL TRANSACTION";
80625
+ return issue_1.Issue.atToken(lowFile, tokens[i], message, this.getMetadata().key, this.conf.severity, fix);
80626
+ }
80627
+ }
80628
+ return undefined;
80629
+ }
80601
80630
  replaceXsdBool(node, lowFile, highSyntax) {
80602
80631
  if (this.lowReg.getConfig().isOpenABAP()) {
80603
80632
  return undefined;
@@ -85007,6 +85036,7 @@ __exportStar(__webpack_require__(/*! ./parser_missing_space */ "../core/build/sr
85007
85036
  __exportStar(__webpack_require__(/*! ./pragma_style */ "../core/build/src/rules/pragma_style.js"), exports);
85008
85037
  __exportStar(__webpack_require__(/*! ./prefer_corresponding */ "../core/build/src/rules/prefer_corresponding.js"), exports);
85009
85038
  __exportStar(__webpack_require__(/*! ./prefer_inline */ "../core/build/src/rules/prefer_inline.js"), exports);
85039
+ __exportStar(__webpack_require__(/*! ./prefer_insert_into_table */ "../core/build/src/rules/prefer_insert_into_table.js"), exports);
85010
85040
  __exportStar(__webpack_require__(/*! ./prefer_is_not */ "../core/build/src/rules/prefer_is_not.js"), exports);
85011
85041
  __exportStar(__webpack_require__(/*! ./prefer_pragmas */ "../core/build/src/rules/prefer_pragmas.js"), exports);
85012
85042
  __exportStar(__webpack_require__(/*! ./prefer_raise_exception_new */ "../core/build/src/rules/prefer_raise_exception_new.js"), exports);
@@ -85822,7 +85852,7 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
85822
85852
  key: "keyword_case",
85823
85853
  title: "Keyword case",
85824
85854
  shortDescription: `Checks that keywords have the same case. Non-keywords must be lower case.`,
85825
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-your-pretty-printer-team-settings`,
85855
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-your-teams-abap-formatter-settings`,
85826
85856
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
85827
85857
  badExample: `write 'hello world'.`,
85828
85858
  goodExample: `WRITE 'hello world'.`,
@@ -92686,6 +92716,126 @@ exports.PreferInline = PreferInline;
92686
92716
 
92687
92717
  /***/ },
92688
92718
 
92719
+ /***/ "../core/build/src/rules/prefer_insert_into_table.js"
92720
+ /*!***********************************************************!*\
92721
+ !*** ../core/build/src/rules/prefer_insert_into_table.js ***!
92722
+ \***********************************************************/
92723
+ (__unused_webpack_module, exports, __webpack_require__) {
92724
+
92725
+ "use strict";
92726
+
92727
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
92728
+ if (k2 === undefined) k2 = k;
92729
+ var desc = Object.getOwnPropertyDescriptor(m, k);
92730
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
92731
+ desc = { enumerable: true, get: function() { return m[k]; } };
92732
+ }
92733
+ Object.defineProperty(o, k2, desc);
92734
+ }) : (function(o, m, k, k2) {
92735
+ if (k2 === undefined) k2 = k;
92736
+ o[k2] = m[k];
92737
+ }));
92738
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
92739
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
92740
+ }) : function(o, v) {
92741
+ o["default"] = v;
92742
+ });
92743
+ var __importStar = (this && this.__importStar) || (function () {
92744
+ var ownKeys = function(o) {
92745
+ ownKeys = Object.getOwnPropertyNames || function (o) {
92746
+ var ar = [];
92747
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
92748
+ return ar;
92749
+ };
92750
+ return ownKeys(o);
92751
+ };
92752
+ return function (mod) {
92753
+ if (mod && mod.__esModule) return mod;
92754
+ var result = {};
92755
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
92756
+ __setModuleDefault(result, mod);
92757
+ return result;
92758
+ };
92759
+ })();
92760
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
92761
+ exports.PreferInsertIntoTable = exports.PreferInsertIntoTableConf = void 0;
92762
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
92763
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
92764
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
92765
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
92766
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
92767
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
92768
+ class PreferInsertIntoTableConf extends _basic_rule_config_1.BasicRuleConfig {
92769
+ }
92770
+ exports.PreferInsertIntoTableConf = PreferInsertIntoTableConf;
92771
+ class PreferInsertIntoTable extends _abap_rule_1.ABAPRule {
92772
+ constructor() {
92773
+ super(...arguments);
92774
+ this.conf = new PreferInsertIntoTableConf();
92775
+ }
92776
+ getMetadata() {
92777
+ return {
92778
+ key: "prefer_insert_into_table",
92779
+ title: "Prefer INSERT INTO TABLE over APPEND",
92780
+ shortDescription: `Prefer INSERT INTO TABLE over APPEND`,
92781
+ // eslint-disable-next-line max-len
92782
+ extendedInformation: `INSERT INTO TABLE respects the table type, while APPEND always tries to add to the end. This will dump if the sort order of a sorted table would change.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-insert-into-table-to-append-to`,
92783
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
92784
+ badExample: `APPEND row TO itab.`,
92785
+ goodExample: `INSERT row INTO TABLE itab.`,
92786
+ };
92787
+ }
92788
+ getConfig() { return this.conf; }
92789
+ setConfig(conf) { this.conf = conf; }
92790
+ runParsed(file) {
92791
+ const issues = [];
92792
+ for (const stat of file.getStatements()) {
92793
+ if (!(stat.get() instanceof Statements.Append)) {
92794
+ continue;
92795
+ }
92796
+ if (stat.concatTokens().toUpperCase().includes(" SORTED BY ")) {
92797
+ continue;
92798
+ }
92799
+ const fix = this.buildFix(file, stat);
92800
+ const message = "Prefer INSERT INTO TABLE over APPEND";
92801
+ issues.push(issue_1.Issue.atStatement(file, stat, message, this.getMetadata().key, this.conf.severity, fix));
92802
+ }
92803
+ return issues;
92804
+ }
92805
+ buildFix(file, stat) {
92806
+ const tokens = stat.getTokens();
92807
+ // Find the APPEND token (first token)
92808
+ const appendToken = tokens[0];
92809
+ if (appendToken.getStr().toUpperCase() !== "APPEND") {
92810
+ return undefined;
92811
+ }
92812
+ // Find the last "TO" token that precedes the table target.
92813
+ // In all fixable forms the table target follows the last standalone "TO":
92814
+ // APPEND row TO itab
92815
+ // APPEND LINES OF itab2 TO itab
92816
+ // APPEND LINES OF itab2 FROM 1 TO 3 TO itab <- last TO is the table
92817
+ // APPEND INITIAL LINE TO itab
92818
+ let lastToIndex = -1;
92819
+ for (let i = tokens.length - 1; i >= 0; i--) {
92820
+ if (tokens[i].getStr().toUpperCase() === "TO") {
92821
+ lastToIndex = i;
92822
+ break;
92823
+ }
92824
+ }
92825
+ if (lastToIndex < 0) {
92826
+ return undefined;
92827
+ }
92828
+ const toToken = tokens[lastToIndex];
92829
+ const fix1 = edit_helper_1.EditHelper.replaceToken(file, appendToken, "INSERT");
92830
+ const fix2 = edit_helper_1.EditHelper.replaceToken(file, toToken, "INTO TABLE");
92831
+ return edit_helper_1.EditHelper.merge(fix1, fix2);
92832
+ }
92833
+ }
92834
+ exports.PreferInsertIntoTable = PreferInsertIntoTable;
92835
+ //# sourceMappingURL=prefer_insert_into_table.js.map
92836
+
92837
+ /***/ },
92838
+
92689
92839
  /***/ "../core/build/src/rules/prefer_is_not.js"
92690
92840
  /*!************************************************!*\
92691
92841
  !*** ../core/build/src/rules/prefer_is_not.js ***!
@@ -95323,6 +95473,8 @@ class SequentialBlank extends _abap_rule_1.ABAPRule {
95323
95473
  key: "sequential_blank",
95324
95474
  title: "Sequential blank lines",
95325
95475
  shortDescription: `Checks that code does not contain more than the configured number of blank lines in a row.`,
95476
+ // eslint-disable-next-line max-len
95477
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#add-a-single-blank-line-to-separate-things-but-not-more`,
95326
95478
  tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
95327
95479
  };
95328
95480
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.53",
3
+ "version": "2.120.55",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.53",
42
+ "@abaplint/core": "^2.120.55",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",