@abaplint/cli 2.120.58 → 2.120.59

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 +250 -1
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -34781,6 +34781,11 @@ class Source {
34781
34781
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
34782
34782
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
34783
34783
  }
34784
+ if ((foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) && bodyType !== undefined) {
34785
+ this.addIfInferred(node, input, bodyType);
34786
+ this.traverseRemainingChildren(children, input);
34787
+ return bodyType;
34788
+ }
34784
34789
  this.addIfInferred(node, input, foundType);
34785
34790
  this.traverseRemainingChildren(children, input);
34786
34791
  return foundType;
@@ -70685,7 +70690,7 @@ class Registry {
70685
70690
  }
70686
70691
  static abaplintVersion() {
70687
70692
  // magic, see build script "version.js"
70688
- return "2.120.58";
70693
+ return "2.120.59";
70689
70694
  }
70690
70695
  getDDICReferences() {
70691
70696
  return this.ddicReferences;
@@ -85123,6 +85128,7 @@ __exportStar(__webpack_require__(/*! ./types_naming */ "../core/build/src/rules/
85123
85128
  __exportStar(__webpack_require__(/*! ./uncaught_exception */ "../core/build/src/rules/uncaught_exception.js"), exports);
85124
85129
  __exportStar(__webpack_require__(/*! ./unknown_types */ "../core/build/src/rules/unknown_types.js"), exports);
85125
85130
  __exportStar(__webpack_require__(/*! ./unnecessary_chaining */ "../core/build/src/rules/unnecessary_chaining.js"), exports);
85131
+ __exportStar(__webpack_require__(/*! ./unnecessary_loop_guard */ "../core/build/src/rules/unnecessary_loop_guard.js"), exports);
85126
85132
  __exportStar(__webpack_require__(/*! ./unnecessary_pragma */ "../core/build/src/rules/unnecessary_pragma.js"), exports);
85127
85133
  __exportStar(__webpack_require__(/*! ./unnecessary_return */ "../core/build/src/rules/unnecessary_return.js"), exports);
85128
85134
  __exportStar(__webpack_require__(/*! ./unreachable_code */ "../core/build/src/rules/unreachable_code.js"), exports);
@@ -85135,6 +85141,7 @@ __exportStar(__webpack_require__(/*! ./unused_variables */ "../core/build/src/ru
85135
85141
  __exportStar(__webpack_require__(/*! ./use_bool_expression */ "../core/build/src/rules/use_bool_expression.js"), exports);
85136
85142
  __exportStar(__webpack_require__(/*! ./use_class_based_exceptions */ "../core/build/src/rules/use_class_based_exceptions.js"), exports);
85137
85143
  __exportStar(__webpack_require__(/*! ./use_line_exists */ "../core/build/src/rules/use_line_exists.js"), exports);
85144
+ __exportStar(__webpack_require__(/*! ./use_message_class */ "../core/build/src/rules/use_message_class.js"), exports);
85138
85145
  __exportStar(__webpack_require__(/*! ./use_new */ "../core/build/src/rules/use_new.js"), exports);
85139
85146
  __exportStar(__webpack_require__(/*! ./when_others_last */ "../core/build/src/rules/when_others_last.js"), exports);
85140
85147
  __exportStar(__webpack_require__(/*! ./whitespace_end */ "../core/build/src/rules/whitespace_end.js"), exports);
@@ -98871,6 +98878,151 @@ exports.UnnecessaryChaining = UnnecessaryChaining;
98871
98878
 
98872
98879
  /***/ },
98873
98880
 
98881
+ /***/ "../core/build/src/rules/unnecessary_loop_guard.js"
98882
+ /*!*********************************************************!*\
98883
+ !*** ../core/build/src/rules/unnecessary_loop_guard.js ***!
98884
+ \*********************************************************/
98885
+ (__unused_webpack_module, exports, __webpack_require__) {
98886
+
98887
+ "use strict";
98888
+
98889
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
98890
+ if (k2 === undefined) k2 = k;
98891
+ var desc = Object.getOwnPropertyDescriptor(m, k);
98892
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
98893
+ desc = { enumerable: true, get: function() { return m[k]; } };
98894
+ }
98895
+ Object.defineProperty(o, k2, desc);
98896
+ }) : (function(o, m, k, k2) {
98897
+ if (k2 === undefined) k2 = k;
98898
+ o[k2] = m[k];
98899
+ }));
98900
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
98901
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
98902
+ }) : function(o, v) {
98903
+ o["default"] = v;
98904
+ });
98905
+ var __importStar = (this && this.__importStar) || (function () {
98906
+ var ownKeys = function(o) {
98907
+ ownKeys = Object.getOwnPropertyNames || function (o) {
98908
+ var ar = [];
98909
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
98910
+ return ar;
98911
+ };
98912
+ return ownKeys(o);
98913
+ };
98914
+ return function (mod) {
98915
+ if (mod && mod.__esModule) return mod;
98916
+ var result = {};
98917
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
98918
+ __setModuleDefault(result, mod);
98919
+ return result;
98920
+ };
98921
+ })();
98922
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
98923
+ exports.UnnecessaryLoopGuard = exports.UnnecessaryLoopGuardConf = void 0;
98924
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
98925
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
98926
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
98927
+ const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
98928
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
98929
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
98930
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
98931
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
98932
+ class UnnecessaryLoopGuardConf extends _basic_rule_config_1.BasicRuleConfig {
98933
+ }
98934
+ exports.UnnecessaryLoopGuardConf = UnnecessaryLoopGuardConf;
98935
+ class UnnecessaryLoopGuard extends _abap_rule_1.ABAPRule {
98936
+ constructor() {
98937
+ super(...arguments);
98938
+ this.conf = new UnnecessaryLoopGuardConf();
98939
+ }
98940
+ getMetadata() {
98941
+ return {
98942
+ key: "unnecessary_loop_guard",
98943
+ title: "Unnecessary loop guard",
98944
+ shortDescription: `Detects unnecessary IS [NOT] INITIAL check before LOOP AT`,
98945
+ extendedInformation: `LOOP AT iterates zero times on an empty table, so an IS [NOT] INITIAL guard is redundant.`,
98946
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
98947
+ badExample: `IF lt_data IS NOT INITIAL.
98948
+ LOOP AT lt_data INTO DATA(ls_item).
98949
+ WRITE ls_item-name.
98950
+ ENDLOOP.
98951
+ ENDIF.`,
98952
+ goodExample: `LOOP AT lt_data INTO DATA(ls_item).
98953
+ WRITE ls_item-name.
98954
+ ENDLOOP.`,
98955
+ };
98956
+ }
98957
+ getConfig() {
98958
+ return this.conf;
98959
+ }
98960
+ setConfig(conf) {
98961
+ this.conf = conf;
98962
+ }
98963
+ runParsed(file) {
98964
+ const issues = [];
98965
+ const stru = file.getStructure();
98966
+ if (stru === undefined) {
98967
+ return issues;
98968
+ }
98969
+ for (const ifStru of stru.findAllStructuresRecursive(Structures.If)) {
98970
+ if (ifStru.findDirectStructures(Structures.ElseIf).length > 0
98971
+ || ifStru.findDirectStructures(Structures.Else).length > 0) {
98972
+ continue;
98973
+ }
98974
+ const ifStatement = ifStru.findDirectStatement(Statements.If);
98975
+ if (ifStatement === undefined) {
98976
+ continue;
98977
+ }
98978
+ const cond = ifStatement.findDirectExpression(Expressions.Cond);
98979
+ if (cond === undefined) {
98980
+ continue;
98981
+ }
98982
+ const compareNodes = cond.findDirectExpressions(Expressions.Compare);
98983
+ if (compareNodes.length !== 1) {
98984
+ continue;
98985
+ }
98986
+ const m = compareNodes[0].concatTokens().toUpperCase().match(/^(.+?)\s+IS\s+(?:NOT\s+)?INITIAL\s*$/);
98987
+ if (!m) {
98988
+ continue;
98989
+ }
98990
+ const tableName = m[1];
98991
+ const bodyStructures = ifStru.findDirectStructures(Structures.Body);
98992
+ if (bodyStructures.length !== 1) {
98993
+ continue;
98994
+ }
98995
+ const normalStructures = bodyStructures[0].findDirectStructures(Structures.Normal);
98996
+ if (normalStructures.length !== 1) {
98997
+ continue;
98998
+ }
98999
+ const loopStructures = normalStructures[0].findDirectStructures(Structures.Loop);
99000
+ if (loopStructures.length !== 1) {
99001
+ continue;
99002
+ }
99003
+ const loopStatement = loopStructures[0].findDirectStatement(Statements.Loop);
99004
+ if (loopStatement === undefined) {
99005
+ continue;
99006
+ }
99007
+ const loopSource = loopStatement.findFirstExpression(Expressions.LoopSource);
99008
+ if (loopSource === undefined) {
99009
+ continue;
99010
+ }
99011
+ if (loopSource.concatTokens().toUpperCase() !== tableName) {
99012
+ continue;
99013
+ }
99014
+ const endifStatement = ifStru.findDirectStatement(Statements.EndIf);
99015
+ const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.deleteStatement(file, ifStatement), edit_helper_1.EditHelper.deleteStatement(file, endifStatement));
99016
+ issues.push(issue_1.Issue.atStatement(file, ifStatement, "Unnecessary IS [NOT] INITIAL check before LOOP AT", this.getMetadata().key, this.conf.severity, fix));
99017
+ }
99018
+ return issues;
99019
+ }
99020
+ }
99021
+ exports.UnnecessaryLoopGuard = UnnecessaryLoopGuard;
99022
+ //# sourceMappingURL=unnecessary_loop_guard.js.map
99023
+
99024
+ /***/ },
99025
+
98874
99026
  /***/ "../core/build/src/rules/unnecessary_pragma.js"
98875
99027
  /*!*****************************************************!*\
98876
99028
  !*** ../core/build/src/rules/unnecessary_pragma.js ***!
@@ -100945,6 +101097,103 @@ exports.UseLineExists = UseLineExists;
100945
101097
 
100946
101098
  /***/ },
100947
101099
 
101100
+ /***/ "../core/build/src/rules/use_message_class.js"
101101
+ /*!****************************************************!*\
101102
+ !*** ../core/build/src/rules/use_message_class.js ***!
101103
+ \****************************************************/
101104
+ (__unused_webpack_module, exports, __webpack_require__) {
101105
+
101106
+ "use strict";
101107
+
101108
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
101109
+ if (k2 === undefined) k2 = k;
101110
+ var desc = Object.getOwnPropertyDescriptor(m, k);
101111
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
101112
+ desc = { enumerable: true, get: function() { return m[k]; } };
101113
+ }
101114
+ Object.defineProperty(o, k2, desc);
101115
+ }) : (function(o, m, k, k2) {
101116
+ if (k2 === undefined) k2 = k;
101117
+ o[k2] = m[k];
101118
+ }));
101119
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
101120
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
101121
+ }) : function(o, v) {
101122
+ o["default"] = v;
101123
+ });
101124
+ var __importStar = (this && this.__importStar) || (function () {
101125
+ var ownKeys = function(o) {
101126
+ ownKeys = Object.getOwnPropertyNames || function (o) {
101127
+ var ar = [];
101128
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
101129
+ return ar;
101130
+ };
101131
+ return ownKeys(o);
101132
+ };
101133
+ return function (mod) {
101134
+ if (mod && mod.__esModule) return mod;
101135
+ var result = {};
101136
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
101137
+ __setModuleDefault(result, mod);
101138
+ return result;
101139
+ };
101140
+ })();
101141
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
101142
+ exports.UseMessageClass = exports.UseMessageClassConf = void 0;
101143
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
101144
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
101145
+ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
101146
+ const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
101147
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
101148
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
101149
+ class UseMessageClassConf extends _basic_rule_config_1.BasicRuleConfig {
101150
+ }
101151
+ exports.UseMessageClassConf = UseMessageClassConf;
101152
+ class UseMessageClass extends _abap_rule_1.ABAPRule {
101153
+ constructor() {
101154
+ super(...arguments);
101155
+ this.conf = new UseMessageClassConf();
101156
+ }
101157
+ getMetadata() {
101158
+ return {
101159
+ key: "use_message_class",
101160
+ title: "Use message class",
101161
+ shortDescription: `Define messages in SE91 instead of using inline text or variables`,
101162
+ tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
101163
+ badExample: `MESSAGE 'Something went wrong' TYPE 'E'.`,
101164
+ goodExample: `MESSAGE e001(bc_msg).`,
101165
+ };
101166
+ }
101167
+ getConfig() {
101168
+ return this.conf;
101169
+ }
101170
+ setConfig(conf) {
101171
+ this.conf = conf;
101172
+ }
101173
+ runParsed(file, _obj) {
101174
+ const structure = file.getStructure();
101175
+ if (structure === undefined) {
101176
+ return [];
101177
+ }
101178
+ const issues = [];
101179
+ const key = this.getMetadata().key;
101180
+ for (const statement of structure.findAllStatements(Statements.Message)) {
101181
+ // The parser populates MessageSource only for the class-based forms (e001(bc_msg) or ID/TYPE/NUMBER).
101182
+ // The text form (MESSAGE <source> TYPE <source>) uses MessageSourceSource directly with no MessageSource child.
101183
+ // Absence of MessageSource is therefore a reliable discriminator between the two forms.
101184
+ if (statement.findDirectExpression(Expressions.MessageSource) !== undefined) {
101185
+ continue;
101186
+ }
101187
+ issues.push(issue_1.Issue.atStatement(file, statement, "Use a message class (SE91) instead of inline text or variable", key, this.conf.severity));
101188
+ }
101189
+ return issues;
101190
+ }
101191
+ }
101192
+ exports.UseMessageClass = UseMessageClass;
101193
+ //# sourceMappingURL=use_message_class.js.map
101194
+
101195
+ /***/ },
101196
+
100948
101197
  /***/ "../core/build/src/rules/use_new.js"
100949
101198
  /*!******************************************!*\
100950
101199
  !*** ../core/build/src/rules/use_new.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.58",
3
+ "version": "2.120.59",
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.58",
42
+ "@abaplint/core": "^2.120.59",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",