@abaplint/core 2.119.12 → 2.119.14

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.
@@ -6,7 +6,7 @@ const version_1 = require("../../../version");
6
6
  const expressions_1 = require("../expressions");
7
7
  class Return {
8
8
  getMatcher() {
9
- return (0, combi_1.seq)((0, combi_1.str)("RETURN"), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v758, expressions_1.Source)));
9
+ return (0, combi_1.seq)((0, combi_1.str)("RETURN"), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v758, expressions_1.Source, version_1.Version.OpenABAP)));
10
10
  }
11
11
  }
12
12
  exports.Return = Return;
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.119.12";
77
+ return "2.119.14";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -4,9 +4,14 @@ exports.NoAliases = exports.NoAliasesConf = void 0;
4
4
  const issue_1 = require("../issue");
5
5
  const _basic_rule_config_1 = require("./_basic_rule_config");
6
6
  const _abap_rule_1 = require("./_abap_rule");
7
- const Statements = require("../abap/2_statements/statements");
8
7
  const _irule_1 = require("./_irule");
8
+ const visibility_1 = require("../abap/4_file_information/visibility");
9
9
  class NoAliasesConf extends _basic_rule_config_1.BasicRuleConfig {
10
+ constructor() {
11
+ super(...arguments);
12
+ /** Skip reporting aliases in private sections. */
13
+ this.ignorePrivate = false;
14
+ }
10
15
  }
11
16
  exports.NoAliasesConf = NoAliasesConf;
12
17
  class NoAliases extends _abap_rule_1.ABAPRule {
@@ -19,7 +24,6 @@ class NoAliases extends _abap_rule_1.ABAPRule {
19
24
  key: "no_aliases",
20
25
  title: "No ALIASES",
21
26
  shortDescription: `Detects use of the ALIAS statement`,
22
- extendedInformation: `Only one issue is reported for chained statements`,
23
27
  tags: [_irule_1.RuleTag.SingleFile],
24
28
  };
25
29
  }
@@ -32,18 +36,24 @@ class NoAliases extends _abap_rule_1.ABAPRule {
32
36
  runParsed(file) {
33
37
  const issues = [];
34
38
  const message = "Do not use ALIASES";
35
- let prev = undefined;
36
- for (const stat of file.getStatements()) {
37
- if (stat.get() instanceof Statements.Aliases) {
38
- if (prev && prev.getColon() === stat.getColon()) {
39
+ for (const classDef of file.getInfo().listClassDefinitions()) {
40
+ for (const alias of classDef.aliases) {
41
+ if (this.skipAlias(alias)) {
39
42
  continue;
40
43
  }
41
- issues.push(issue_1.Issue.atStatement(file, stat, message, this.getMetadata().key, this.conf.severity));
42
- prev = stat;
44
+ issues.push(issue_1.Issue.atIdentifier(alias.identifier, message, this.getMetadata().key, this.conf.severity));
45
+ }
46
+ }
47
+ for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {
48
+ for (const alias of interfaceDef.aliases) {
49
+ issues.push(issue_1.Issue.atIdentifier(alias.identifier, message, this.getMetadata().key, this.conf.severity));
43
50
  }
44
51
  }
45
52
  return issues;
46
53
  }
54
+ skipAlias(alias) {
55
+ return this.conf.ignorePrivate === true && alias.visibility === visibility_1.Visibility.Private;
56
+ }
47
57
  }
48
58
  exports.NoAliases = NoAliases;
49
59
  //# sourceMappingURL=no_aliases.js.map
@@ -7,10 +7,14 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
7
7
  const _irule_1 = require("./_irule");
8
8
  const edit_helper_1 = require("../edit_helper");
9
9
  const _statement_1 = require("../abap/2_statements/statements/_statement");
10
+ const objects_1 = require("../objects");
11
+ const ddic_1 = require("../ddic");
10
12
  class UnnecessaryChainingConf extends _basic_rule_config_1.BasicRuleConfig {
11
13
  constructor() {
12
14
  super(...arguments);
13
15
  this.maxIssuesPerFile = 10;
16
+ /** Ignore global exception classes */
17
+ this.ignoreExceptions = true;
14
18
  }
15
19
  }
16
20
  exports.UnnecessaryChainingConf = UnnecessaryChainingConf;
@@ -36,8 +40,15 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
36
40
  setConfig(conf) {
37
41
  this.conf = conf;
38
42
  }
39
- runParsed(file) {
43
+ runParsed(file, obj) {
40
44
  const issues = [];
45
+ if (obj instanceof objects_1.Class) {
46
+ const definition = obj.getClassDefinition();
47
+ const ddic = new ddic_1.DDIC(this.reg);
48
+ if (this.conf.ignoreExceptions === true && ddic.isException(definition, obj)) {
49
+ return issues;
50
+ }
51
+ }
41
52
  let max = this.getConfig().maxIssuesPerFile;
42
53
  if (max === undefined || max < 1) {
43
54
  max = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.12",
3
+ "version": "2.119.14",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",