@abaplint/cli 2.104.6 → 2.105.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 +192 -1
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -51042,7 +51042,7 @@ class Registry {
51042
51042
  }
51043
51043
  static abaplintVersion() {
51044
51044
  // magic, see build script "version.sh"
51045
- return "2.104.6";
51045
+ return "2.105.1";
51046
51046
  }
51047
51047
  getDDICReferences() {
51048
51048
  return this.ddicReferences;
@@ -61410,6 +61410,7 @@ __exportStar(__webpack_require__(/*! ./no_aliases */ "./node_modules/@abaplint/c
61410
61410
  __exportStar(__webpack_require__(/*! ./no_chained_assignment */ "./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js"), exports);
61411
61411
  __exportStar(__webpack_require__(/*! ./no_external_form_calls */ "./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js"), exports);
61412
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);
61413
61414
  __exportStar(__webpack_require__(/*! ./no_public_attributes */ "./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js"), exports);
61414
61415
  __exportStar(__webpack_require__(/*! ./no_yoda_conditions */ "./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js"), exports);
61415
61416
  __exportStar(__webpack_require__(/*! ./nrob_consistency */ "./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js"), exports);
@@ -64546,6 +64547,196 @@ exports.NoInlineInOptionalBranches = NoInlineInOptionalBranches;
64546
64547
 
64547
64548
  /***/ }),
64548
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
+ const ret = [];
64646
+ for (const data of topNode.findAllStatements(Statements.Data).concat(topNode.findAllStatements(Statements.DataBegin)).concat(topNode.findAllStatements(Statements.ClassDataBegin)).concat(topNode.findAllStatements(Statements.ClassData))) {
64647
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName)
64648
+ || data.findFirstExpression(Expressions.NamespaceSimpleName);
64649
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64650
+ if (name !== "" && nameExpression && name.match(regex)) {
64651
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64652
+ ret.push(issue);
64653
+ }
64654
+ }
64655
+ for (const data of topNode.findAllExpressions(Expressions.InlineData)) {
64656
+ const nameExpression = data.findFirstExpression(Expressions.TargetField);
64657
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64658
+ if (name !== "" && nameExpression && name.match(regex)) {
64659
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64660
+ ret.push(issue);
64661
+ }
64662
+ }
64663
+ return ret;
64664
+ }
64665
+ checkStatics(topNode, regex, file) {
64666
+ const ret = [];
64667
+ for (const data of topNode.findAllStatements(Statements.Static).concat(topNode.findAllStatements(Statements.StaticBegin))) {
64668
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
64669
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64670
+ if (name !== "" && nameExpression && name.match(regex)) {
64671
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64672
+ ret.push(issue);
64673
+ }
64674
+ }
64675
+ return ret;
64676
+ }
64677
+ checkFieldSymbols(topNode, regex, file) {
64678
+ const ret = [];
64679
+ for (const data of topNode.findAllStatements(Statements.FieldSymbol)) {
64680
+ const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
64681
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64682
+ if (name !== "" && nameExpression && name.match(regex)) {
64683
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64684
+ ret.push(issue);
64685
+ }
64686
+ }
64687
+ for (const data of topNode.findAllExpressions(Expressions.InlineFS)) {
64688
+ const nameExpression = data.findFirstExpression(Expressions.FieldSymbol);
64689
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64690
+ if (name !== "" && nameExpression && name.match(regex)) {
64691
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64692
+ ret.push(issue);
64693
+ }
64694
+ }
64695
+ return ret;
64696
+ }
64697
+ checkConstants(topNode, regex, file) {
64698
+ const ret = [];
64699
+ for (const data of topNode.findAllStatements(Statements.Constant).concat(topNode.findAllStatements(Statements.ConstantBegin))) {
64700
+ const nameExpression = data.findFirstExpression(Expressions.DefinitionName);
64701
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64702
+ if (name !== "" && nameExpression && name.match(regex)) {
64703
+ const issue = issue_1.Issue.atToken(file, nameExpression.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
64704
+ ret.push(issue);
64705
+ }
64706
+ }
64707
+ return ret;
64708
+ }
64709
+ checkTypes(topNode, regex, file) {
64710
+ const ret = [];
64711
+ 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))) {
64712
+ const nameExpression = data.findFirstExpression(Expressions.NamespaceSimpleName);
64713
+ const name = (nameExpression === null || nameExpression === void 0 ? void 0 : nameExpression.concatTokens()) || "";
64714
+ if (name !== "" && nameExpression && name.match(regex)) {
64715
+ const issue = issue_1.Issue.atToken(file, nameExpression.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, def.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
+
64549
64740
  /***/ "./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js":
64550
64741
  /*!*****************************************************************************!*\
64551
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.6",
3
+ "version": "2.105.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.104.6",
41
+ "@abaplint/core": "^2.105.1",
42
42
  "@types/chai": "^4.3.11",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.5",