@abaplint/cli 2.104.5 → 2.105.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 +199 -3
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -28216,7 +28216,7 @@ const dynamic_1 = __webpack_require__(/*! ../expressions/dynamic */ "./node_modu
28216
28216
  const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_type_utils.js");
28217
28217
  class Assign {
28218
28218
  runSyntax(node, scope, filename) {
28219
- var _a;
28219
+ var _a, _b;
28220
28220
  const assignSource = node.findDirectExpression(Expressions.AssignSource);
28221
28221
  const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource3])) || [];
28222
28222
  const theSource = sources[sources.length - 1];
@@ -28251,7 +28251,12 @@ class Assign {
28251
28251
  }
28252
28252
  const target = node.findDirectExpression(Expressions.FSTarget);
28253
28253
  if (target) {
28254
- new fstarget_1.FSTarget().runSyntax(target, scope, filename, sourceType);
28254
+ if (((_b = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getFirstChild()) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) === "COMPONENT") {
28255
+ new fstarget_1.FSTarget().runSyntax(target, scope, filename, new basic_1.AnyType());
28256
+ }
28257
+ else {
28258
+ new fstarget_1.FSTarget().runSyntax(target, scope, filename, sourceType);
28259
+ }
28255
28260
  }
28256
28261
  for (const s of node.findAllExpressions(Expressions.Source)) {
28257
28262
  if (s === theSource) {
@@ -51037,7 +51042,7 @@ class Registry {
51037
51042
  }
51038
51043
  static abaplintVersion() {
51039
51044
  // magic, see build script "version.sh"
51040
- return "2.104.5";
51045
+ return "2.105.0";
51041
51046
  }
51042
51047
  getDDICReferences() {
51043
51048
  return this.ddicReferences;
@@ -61405,6 +61410,7 @@ __exportStar(__webpack_require__(/*! ./no_aliases */ "./node_modules/@abaplint/c
61405
61410
  __exportStar(__webpack_require__(/*! ./no_chained_assignment */ "./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js"), exports);
61406
61411
  __exportStar(__webpack_require__(/*! ./no_external_form_calls */ "./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js"), exports);
61407
61412
  __exportStar(__webpack_require__(/*! ./no_inline_in_optional_branches */ "./node_modules/@abaplint/core/build/src/rules/no_inline_in_optional_branches.js"), exports);
61413
+ __exportStar(__webpack_require__(/*! ./no_prefixes */ "./node_modules/@abaplint/core/build/src/rules/no_prefixes.js"), exports);
61408
61414
  __exportStar(__webpack_require__(/*! ./no_public_attributes */ "./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js"), exports);
61409
61415
  __exportStar(__webpack_require__(/*! ./no_yoda_conditions */ "./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js"), exports);
61410
61416
  __exportStar(__webpack_require__(/*! ./nrob_consistency */ "./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js"), exports);
@@ -64541,6 +64547,196 @@ exports.NoInlineInOptionalBranches = NoInlineInOptionalBranches;
64541
64547
 
64542
64548
  /***/ }),
64543
64549
 
64550
+ /***/ "./node_modules/@abaplint/core/build/src/rules/no_prefixes.js":
64551
+ /*!********************************************************************!*\
64552
+ !*** ./node_modules/@abaplint/core/build/src/rules/no_prefixes.js ***!
64553
+ \********************************************************************/
64554
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
64555
+
64556
+ "use strict";
64557
+
64558
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
64559
+ exports.NoPrefixes = exports.NoPrefixesConf = void 0;
64560
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
64561
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
64562
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
64563
+ const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
64564
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
64565
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
64566
+ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
64567
+ constructor() {
64568
+ super(...arguments);
64569
+ /** DATA, CLASS-DATA, DATA BEGIN OF, CLASS-DATA BEGIN OF, FINAL(), DATA(), case insensitive regex */
64570
+ this.data = "^[lg]._";
64571
+ /** STATICS, STATICS BEGIN OF, case insensitive regex */
64572
+ this.statics = "";
64573
+ /** FIELD-SYMBOLS and inline FIELD-SYMBOLS(), case insensitive regex */
64574
+ this.fieldSymbols = "^<l._";
64575
+ /** CONSTANTS, CONSTANTS BEGIN OF, case insensitive regex */
64576
+ this.constants = "^[lg]c_";
64577
+ /** TYPES, ENUM, MESH, case insensitive regex */
64578
+ this.types = "^ty_";
64579
+ /** importing, exporting, returning and changing parameters, case insensitive regex */
64580
+ this.methodParameters = "^[ierc]._";
64581
+ // todo, public localClass: string = "";
64582
+ // todo, public localInterface: string = "";
64583
+ // todo, public functionModuleParameters: string = "";
64584
+ // todo, public parameters: string = "";
64585
+ // todo, public selectOptions: string = "";
64586
+ // todo, public formParameters: string = "";
64587
+ }
64588
+ }
64589
+ exports.NoPrefixesConf = NoPrefixesConf;
64590
+ const MESSAGE = "Avoid hungarian notation";
64591
+ class NoPrefixes extends _abap_rule_1.ABAPRule {
64592
+ constructor() {
64593
+ super(...arguments);
64594
+ this.conf = new NoPrefixesConf();
64595
+ }
64596
+ getMetadata() {
64597
+ return {
64598
+ key: "no_prefixes",
64599
+ title: "No Prefixes",
64600
+ shortDescription: `Dont use hungarian notation`,
64601
+ extendedInformation: `
64602
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-encodings-esp-hungarian-notation-and-prefixes
64603
+
64604
+ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodings.md`,
64605
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
64606
+ badExample: `DATA lv_foo TYPE i.`,
64607
+ goodExample: `DATA foo TYPE i.`,
64608
+ };
64609
+ }
64610
+ getConfig() {
64611
+ return this.conf;
64612
+ }
64613
+ setConfig(conf) {
64614
+ this.conf = conf;
64615
+ }
64616
+ runParsed(file) {
64617
+ const ret = [];
64618
+ const config = this.getConfig();
64619
+ const structure = file.getStructure();
64620
+ if (structure === undefined) {
64621
+ // syntax error, skip
64622
+ return [];
64623
+ }
64624
+ if (config.data !== undefined && config.data !== "") {
64625
+ ret.push(...this.checkData(structure, new RegExp(config.data, "i"), file));
64626
+ }
64627
+ if (config.statics !== undefined && config.statics !== "") {
64628
+ ret.push(...this.checkStatics(structure, new RegExp(config.statics, "i"), file));
64629
+ }
64630
+ if (config.fieldSymbols !== undefined && config.fieldSymbols !== "") {
64631
+ ret.push(...this.checkFieldSymbols(structure, new RegExp(config.fieldSymbols, "i"), file));
64632
+ }
64633
+ if (config.constants !== undefined && config.constants !== "") {
64634
+ ret.push(...this.checkConstants(structure, new RegExp(config.constants, "i"), file));
64635
+ }
64636
+ if (config.types !== undefined && config.types !== "") {
64637
+ ret.push(...this.checkTypes(structure, new RegExp(config.types, "i"), file));
64638
+ }
64639
+ if (config.methodParameters !== undefined && config.methodParameters !== "") {
64640
+ ret.push(...this.checkMethodParameters(structure, new RegExp(config.methodParameters, "i"), file));
64641
+ }
64642
+ return ret;
64643
+ }
64644
+ checkData(topNode, regex, file) {
64645
+ var _a, _b, _c;
64646
+ const ret = [];
64647
+ for (const data of topNode.findAllStatements(Statements.Data).concat(topNode.findAllStatements(Statements.DataBegin)).concat(topNode.findAllStatements(Statements.ClassDataBegin)).concat(topNode.findAllStatements(Statements.ClassData))) {
64648
+ let name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64649
+ if (name === "") {
64650
+ name = ((_b = data.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
64651
+ }
64652
+ if (name !== "" && name.match(regex)) {
64653
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64654
+ ret.push(issue);
64655
+ }
64656
+ }
64657
+ for (const data of topNode.findAllExpressions(Expressions.InlineData)) {
64658
+ const name = ((_c = data.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "";
64659
+ if (name !== "" && name.match(regex)) {
64660
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64661
+ ret.push(issue);
64662
+ }
64663
+ }
64664
+ return ret;
64665
+ }
64666
+ checkStatics(topNode, regex, file) {
64667
+ var _a;
64668
+ const ret = [];
64669
+ for (const data of topNode.findAllStatements(Statements.Static).concat(topNode.findAllStatements(Statements.StaticBegin))) {
64670
+ const name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64671
+ if (name !== "" && name.match(regex)) {
64672
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64673
+ ret.push(issue);
64674
+ }
64675
+ }
64676
+ return ret;
64677
+ }
64678
+ checkFieldSymbols(topNode, regex, file) {
64679
+ var _a, _b;
64680
+ const ret = [];
64681
+ for (const data of topNode.findAllStatements(Statements.FieldSymbol)) {
64682
+ const name = ((_a = data.findFirstExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64683
+ if (name !== "" && name.match(regex)) {
64684
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64685
+ ret.push(issue);
64686
+ }
64687
+ }
64688
+ for (const data of topNode.findAllExpressions(Expressions.InlineFS)) {
64689
+ const name = ((_b = data.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
64690
+ if (name !== "" && name.match(regex)) {
64691
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64692
+ ret.push(issue);
64693
+ }
64694
+ }
64695
+ return ret;
64696
+ }
64697
+ checkConstants(topNode, regex, file) {
64698
+ var _a;
64699
+ const ret = [];
64700
+ for (const data of topNode.findAllStatements(Statements.Constant).concat(topNode.findAllStatements(Statements.ConstantBegin))) {
64701
+ const name = ((_a = data.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64702
+ if (name !== "" && name.match(regex)) {
64703
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64704
+ ret.push(issue);
64705
+ }
64706
+ }
64707
+ return ret;
64708
+ }
64709
+ checkTypes(topNode, regex, file) {
64710
+ var _a;
64711
+ const ret = [];
64712
+ for (const data of topNode.findAllStatements(Statements.Type).concat(topNode.findAllStatements(Statements.TypeEnum)).concat(topNode.findAllStatements(Statements.TypeEnumBegin)).concat(topNode.findAllStatements(Statements.TypeMesh)).concat(topNode.findAllStatements(Statements.TypeMeshBegin)).concat(topNode.findAllStatements(Statements.TypeBegin))) {
64713
+ const name = ((_a = data.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.concatTokens()) || "";
64714
+ if (name !== "" && name.match(regex)) {
64715
+ const issue = issue_1.Issue.atToken(file, data.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64716
+ ret.push(issue);
64717
+ }
64718
+ }
64719
+ return ret;
64720
+ }
64721
+ checkMethodParameters(topNode, regex, file) {
64722
+ const ret = [];
64723
+ for (const method of topNode.findAllStatements(Statements.MethodDef)) {
64724
+ for (const def of method.findAllExpressions(Expressions.MethodParamName)) {
64725
+ const name = def.concatTokens();
64726
+ if (name !== "" && name.match(regex)) {
64727
+ const issue = issue_1.Issue.atToken(file, method.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64728
+ ret.push(issue);
64729
+ }
64730
+ }
64731
+ }
64732
+ return ret;
64733
+ }
64734
+ }
64735
+ exports.NoPrefixes = NoPrefixes;
64736
+ //# sourceMappingURL=no_prefixes.js.map
64737
+
64738
+ /***/ }),
64739
+
64544
64740
  /***/ "./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js":
64545
64741
  /*!*****************************************************************************!*\
64546
64742
  !*** ./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.104.5",
3
+ "version": "2.105.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.104.5",
41
+ "@abaplint/core": "^2.105.0",
42
42
  "@types/chai": "^4.3.11",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.5",