@abaplint/core 2.82.13 → 2.82.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.
@@ -879,10 +879,7 @@ declare class ConcatenatedConstant extends Expression {
879
879
 
880
880
  declare class ConceptsOfPackage extends AbstractObject {
881
881
  getType(): string;
882
- getAllowedNaming(): {
883
- maxLength: number;
884
- allowNamespace: boolean;
885
- };
882
+ getAllowedNaming(): IAllowedNaming;
886
883
  getDescription(): string | undefined;
887
884
  }
888
885
 
@@ -2347,12 +2344,15 @@ declare interface IAliases {
2347
2344
  getAll(): readonly Alias[];
2348
2345
  }
2349
2346
 
2347
+ declare interface IAllowedNaming {
2348
+ maxLength: number;
2349
+ allowNamespace: boolean;
2350
+ customRegex?: RegExp;
2351
+ }
2352
+
2350
2353
  declare interface IArtifact {
2351
2354
  getType(): string;
2352
- getAllowedNaming(): {
2353
- maxLength: number;
2354
- allowNamespace: boolean;
2355
- };
2355
+ getAllowedNaming(): IAllowedNaming;
2356
2356
  }
2357
2357
 
2358
2358
  declare interface IAttributes {
@@ -3608,10 +3608,7 @@ declare class Multiply implements IStatement {
3608
3608
 
3609
3609
  declare class Namespace extends AbstractObject {
3610
3610
  getType(): string;
3611
- getAllowedNaming(): {
3612
- maxLength: number;
3613
- allowNamespace: boolean;
3614
- };
3611
+ getAllowedNaming(): IAllowedNaming;
3615
3612
  getDescription(): string | undefined;
3616
3613
  }
3617
3614
 
@@ -5911,10 +5908,7 @@ declare class WebDynproComponentConfiguration extends AbstractObject {
5911
5908
 
5912
5909
  declare class WebMIME extends AbstractObject {
5913
5910
  getType(): string;
5914
- getAllowedNaming(): {
5915
- maxLength: number;
5916
- allowNamespace: boolean;
5917
- };
5911
+ getAllowedNaming(): IAllowedNaming;
5918
5912
  getDescription(): string | undefined;
5919
5913
  }
5920
5914
 
@@ -7,7 +7,7 @@ const target_1 = require("../expressions/target");
7
7
  const dynamic_1 = require("../expressions/dynamic");
8
8
  class GetBadi {
9
9
  runSyntax(node, scope, filename) {
10
- for (const s of node.findDirectExpressions(Expressions.Source)) {
10
+ for (const s of node.findAllExpressions(Expressions.Source)) {
11
11
  new source_1.Source().runSyntax(s, scope, filename);
12
12
  }
13
13
  for (const t of node.findDirectExpressions(Expressions.Target)) {
@@ -10,6 +10,7 @@ class ConceptsOfPackage extends _abstract_object_1.AbstractObject {
10
10
  return {
11
11
  maxLength: 30,
12
12
  allowNamespace: true,
13
+ customRegex: new RegExp(/^(\/[A-Z_\d]{3,8}\/)?[A-Z_-\d<> ]+$/i),
13
14
  };
14
15
  }
15
16
  getDescription() {
@@ -10,6 +10,7 @@ class Namespace extends _abstract_object_1.AbstractObject {
10
10
  return {
11
11
  maxLength: 10,
12
12
  allowNamespace: true,
13
+ customRegex: new RegExp(/^\/[A-Z_\d]{3,8}\/$/i),
13
14
  };
14
15
  }
15
16
  getDescription() {
@@ -10,6 +10,7 @@ class WebMIME extends _abstract_object_1.AbstractObject {
10
10
  return {
11
11
  maxLength: 40,
12
12
  allowNamespace: true,
13
+ customRegex: new RegExp(/^[A-Z_-\d/<> ]+$/i),
13
14
  };
14
15
  }
15
16
  getDescription() {
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.82.13";
71
+ return "2.82.14";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -30,19 +30,20 @@ class AllowedObjectNaming {
30
30
  }
31
31
  run(obj) {
32
32
  const allowed = obj.getAllowedNaming();
33
+ const name = obj.getName();
33
34
  let message = "";
34
- if (obj.getName().length > allowed.maxLength) {
35
+ if (name.length > allowed.maxLength) {
35
36
  message = "Name exceeds max length";
36
37
  }
37
- else if (allowed.allowNamespace === false && obj.getName().indexOf("/") >= 0) {
38
+ else if (allowed.allowNamespace === false && name.indexOf("/") >= 0) {
38
39
  message = "Namespace not allowed for object type";
39
40
  }
40
- else if (obj.getType() === "NSPC") {
41
- if (obj.getName().match(/^\/[A-Z_\d]{3,8}\/$/i) === null) {
41
+ else if (allowed.customRegex !== undefined) {
42
+ if (name.match(allowed.customRegex) === null) {
42
43
  message = "Name not allowed";
43
44
  }
44
45
  }
45
- else if (obj.getName().match(/^(\/[A-Z_\d]{3,8}\/)?[A-Z_-\d<> ]+$/i) === null) {
46
+ else if (name.match(/^(\/[A-Z_\d]{3,8}\/)?[A-Z_\d<> ]+$/i) === null) {
46
47
  message = "Name not allowed";
47
48
  }
48
49
  if (message.length > 0) {
@@ -5,6 +5,7 @@ const issue_1 = require("../issue");
5
5
  const _abap_rule_1 = require("./_abap_rule");
6
6
  const _basic_rule_config_1 = require("./_basic_rule_config");
7
7
  const _irule_1 = require("./_irule");
8
+ const edit_helper_1 = require("../edit_helper");
8
9
  class UnnecessaryChainingConf extends _basic_rule_config_1.BasicRuleConfig {
9
10
  }
10
11
  exports.UnnecessaryChainingConf = UnnecessaryChainingConf;
@@ -19,7 +20,7 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
19
20
  title: "Unnecessary Chaining",
20
21
  shortDescription: `Find unnecessary chaining, all statements are checked`,
21
22
  extendedInformation: ``,
22
- tags: [_irule_1.RuleTag.SingleFile],
23
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
23
24
  badExample: `WRITE: bar.`,
24
25
  goodExample: `WRITE bar.`,
25
26
  };
@@ -47,8 +48,9 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
47
48
  else if (prev !== undefined && colon.getStart().equals(prev.getStart())) {
48
49
  continue;
49
50
  }
51
+ const fix = edit_helper_1.EditHelper.deleteRange(file, colon.getStart(), colon.getEnd());
50
52
  const message = "Unnecessary chaining";
51
- const issue = issue_1.Issue.atStatement(file, statements[i], message, this.getMetadata().key);
53
+ const issue = issue_1.Issue.atStatement(file, statements[i], message, this.getMetadata().key, this.conf.severity, fix);
52
54
  issues.push(issue);
53
55
  }
54
56
  return issues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.82.13",
3
+ "version": "2.82.14",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@types/mocha": "^9.0.0",
51
51
  "@types/node": "^16.11.11",
52
52
  "chai": "^4.3.4",
53
- "eslint": "^8.3.0",
53
+ "eslint": "^8.4.0",
54
54
  "mocha": "^9.1.3",
55
55
  "c8": "^7.10.0",
56
56
  "source-map-support": "^0.5.21",