@abaplint/core 2.109.3 → 2.110.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.
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.109.3";
70
+ return "2.110.0";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -31,7 +31,6 @@ __exportStar(require("./cds_legacy_view"), exports);
31
31
  __exportStar(require("./cds_parser_error"), exports);
32
32
  __exportStar(require("./chain_mainly_declarations"), exports);
33
33
  __exportStar(require("./change_if_to_case"), exports);
34
- __exportStar(require("./unused_macros"), exports);
35
34
  __exportStar(require("./check_abstract"), exports);
36
35
  __exportStar(require("./check_comments"), exports);
37
36
  __exportStar(require("./check_ddic"), exports);
@@ -93,6 +92,7 @@ __exportStar(require("./line_only_punc"), exports);
93
92
  __exportStar(require("./local_class_naming"), exports);
94
93
  __exportStar(require("./local_testclass_consistency"), exports);
95
94
  __exportStar(require("./local_variable_names"), exports);
95
+ __exportStar(require("./macro_naming"), exports);
96
96
  __exportStar(require("./main_file_contents"), exports);
97
97
  __exportStar(require("./many_parentheses"), exports);
98
98
  __exportStar(require("./max_one_method_parameter_per_line"), exports);
@@ -170,6 +170,7 @@ __exportStar(require("./unnecessary_return"), exports);
170
170
  __exportStar(require("./unreachable_code"), exports);
171
171
  __exportStar(require("./unsecure_fae"), exports);
172
172
  __exportStar(require("./unused_ddic"), exports);
173
+ __exportStar(require("./unused_macros"), exports);
173
174
  __exportStar(require("./unused_methods"), exports);
174
175
  __exportStar(require("./unused_types"), exports);
175
176
  __exportStar(require("./unused_variables"), exports);
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MacroNaming = exports.MacroNamingConf = void 0;
4
+ const issue_1 = require("../issue");
5
+ const _abap_rule_1 = require("./_abap_rule");
6
+ const Statements = require("../abap/2_statements/statements");
7
+ const Expressions = require("../abap/2_statements/expressions");
8
+ const _basic_rule_config_1 = require("./_basic_rule_config");
9
+ const _irule_1 = require("./_irule");
10
+ const objects_1 = require("../objects");
11
+ class MacroNamingConf extends _basic_rule_config_1.BasicRuleConfig {
12
+ constructor() {
13
+ super(...arguments);
14
+ /** The pattern for macros, case insensitive */
15
+ this.pattern = "^_.+$";
16
+ }
17
+ }
18
+ exports.MacroNamingConf = MacroNamingConf;
19
+ class MacroNaming extends _abap_rule_1.ABAPRule {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.conf = new MacroNamingConf();
23
+ }
24
+ getMetadata() {
25
+ return {
26
+ key: "macro_naming",
27
+ title: "Macro naming conventions",
28
+ shortDescription: `Allows you to enforce a pattern for macro definitions`,
29
+ extendedInformation: `Use rule "avoid_use" to avoid macros alotogether.`,
30
+ tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],
31
+ };
32
+ }
33
+ getConfig() {
34
+ return this.conf;
35
+ }
36
+ setConfig(conf) {
37
+ this.conf = conf;
38
+ }
39
+ runParsed(file, obj) {
40
+ const issues = [];
41
+ const testRegex = new RegExp(this.conf.pattern, "i");
42
+ if (obj instanceof objects_1.TypePool) {
43
+ return [];
44
+ }
45
+ for (const stat of file.getStatements()) {
46
+ if (!(stat.get() instanceof Statements.Define)) {
47
+ continue;
48
+ }
49
+ const expr = stat.findDirectExpression(Expressions.MacroName);
50
+ if (expr === undefined) {
51
+ continue;
52
+ }
53
+ const token = expr.getFirstToken();
54
+ if (testRegex.exec(token.getStr())) {
55
+ continue;
56
+ }
57
+ else {
58
+ const message = "Bad macro name naming, expected \"" + this.conf.pattern + "\", got \"" + token.getStr() + "\"";
59
+ const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);
60
+ issues.push(issue);
61
+ }
62
+ }
63
+ return issues;
64
+ }
65
+ }
66
+ exports.MacroNaming = MacroNaming;
67
+ //# sourceMappingURL=macro_naming.js.map
@@ -22,11 +22,9 @@ class RFCErrorHandling extends _abap_rule_1.ABAPRule {
22
22
  tags: [_irule_1.RuleTag.SingleFile],
23
23
  shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,
24
24
  extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,
25
- badExample: `
26
- CALL FUNCTION 'ZRFC'
25
+ badExample: `CALL FUNCTION 'ZRFC'
27
26
  DESTINATION lv_rfc.`,
28
- goodExample: `
29
- CALL FUNCTION 'ZRFC'
27
+ goodExample: `CALL FUNCTION 'ZRFC'
30
28
  DESTINATION lv_rfc
31
29
  EXCEPTIONS
32
30
  system_failure = 1 MESSAGE msg
@@ -11,7 +11,7 @@ const objects_1 = require("../objects");
11
11
  class TypesNamingConf extends _basic_rule_config_1.BasicRuleConfig {
12
12
  constructor() {
13
13
  super(...arguments);
14
- /** The pattern for TYPES */
14
+ /** The pattern for TYPES, case insensitive */
15
15
  this.pattern = "^TY_.+$";
16
16
  }
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.109.3",
3
+ "version": "2.110.0",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -57,7 +57,7 @@
57
57
  "chai": "^4.4.1",
58
58
  "eslint": "^8.57.0",
59
59
  "mocha": "^10.4.0",
60
- "c8": "^9.1.0",
60
+ "c8": "^10.1.2",
61
61
  "source-map-support": "^0.5.21",
62
62
  "ts-json-schema-generator": "=2.0.1",
63
63
  "typescript": "^5.4.5"