@abaplint/core 2.105.1 → 2.105.3

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.
@@ -295,6 +295,9 @@ class TypeUtils {
295
295
  }
296
296
  return true;
297
297
  }
298
+ else if (target instanceof basic_1.CLikeType) {
299
+ return this.isCharLikeStrict(source);
300
+ }
298
301
  else if (target instanceof basic_1.VoidType || target instanceof basic_1.AnyType) {
299
302
  return true;
300
303
  }
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.105.1";
68
+ return "2.105.3";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -51,7 +51,9 @@ STATICS: use CLASS-DATA instead
51
51
 
52
52
  DESCRIBE TABLE LINES: use lines() instead (quickfix exists)
53
53
 
54
- TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround`,
54
+ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround
55
+
56
+ BREAK points`,
55
57
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
56
58
  };
57
59
  }
@@ -367,6 +367,10 @@ Make sure to test the downported code, it might not always be completely correct
367
367
  if (found) {
368
368
  return found;
369
369
  }
370
+ found = this.assignComponent(low, high, lowFile, highSyntax);
371
+ if (found) {
372
+ return found;
373
+ }
370
374
  found = this.downportRefSimple(high, lowFile, highSyntax);
371
375
  if (found) {
372
376
  return found;
@@ -1476,6 +1480,28 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
1476
1480
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
1477
1481
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
1478
1482
  }
1483
+ assignComponent(low, high, lowFile, highSyntax) {
1484
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1485
+ return undefined;
1486
+ }
1487
+ if (!(high.get() instanceof Statements.Assign)) {
1488
+ return undefined;
1489
+ }
1490
+ const assignSource = high.findDirectExpression(Expressions.AssignSource);
1491
+ if (assignSource === undefined || assignSource.getFirstToken().getStr().toUpperCase() !== "COMPONENT") {
1492
+ return undefined;
1493
+ }
1494
+ const componentSource = assignSource.findExpressionAfterToken("COMPONENT");
1495
+ if (componentSource === undefined || componentSource.get() instanceof Expressions.SimpleSource3) {
1496
+ return undefined;
1497
+ }
1498
+ const uniqueName = this.uniqueName(assignSource.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1499
+ const code = `DATA(${uniqueName}) = ${componentSource.concatTokens()}.\n`;
1500
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
1501
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, componentSource.getFirstToken().getStart(), componentSource.getLastToken().getEnd(), uniqueName);
1502
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1503
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN COMPONENT source", this.getMetadata().key, this.conf.severity, fix);
1504
+ }
1479
1505
  moveWithSimpleValue(low, high, lowFile) {
1480
1506
  if (!(low.get() instanceof _statement_1.Unknown)) {
1481
1507
  return undefined;
@@ -11,17 +11,17 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  /** DATA, CLASS-DATA, DATA BEGIN OF, CLASS-DATA BEGIN OF, FINAL(), DATA(), case insensitive regex */
14
- this.data = "^[lg]._";
14
+ this.data = "^[lg].?_";
15
15
  /** STATICS, STATICS BEGIN OF, case insensitive regex */
16
16
  this.statics = "";
17
17
  /** FIELD-SYMBOLS and inline FIELD-SYMBOLS(), case insensitive regex */
18
- this.fieldSymbols = "^<l._";
18
+ this.fieldSymbols = "^<l.?_";
19
19
  /** CONSTANTS, CONSTANTS BEGIN OF, case insensitive regex */
20
20
  this.constants = "^[lg]c_";
21
21
  /** TYPES, ENUM, MESH, case insensitive regex */
22
22
  this.types = "^ty_";
23
23
  /** importing, exporting, returning and changing parameters, case insensitive regex */
24
- this.methodParameters = "^[ierc]._";
24
+ this.methodParameters = "^[ierc].?_";
25
25
  // todo, public localClass: string = "";
26
26
  // todo, public localInterface: string = "";
27
27
  // todo, public functionModuleParameters: string = "";
@@ -43,6 +43,9 @@ class NoPrefixes extends _abap_rule_1.ABAPRule {
43
43
  title: "No Prefixes",
44
44
  shortDescription: `Dont use hungarian notation`,
45
45
  extendedInformation: `
46
+ Note: not prefixing TYPES will require changing the errorNamespace in the abaplint configuration,
47
+ allowing all types to become voided, abaplint will then provide less precise syntax errors.
48
+
46
49
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-encodings-esp-hungarian-notation-and-prefixes
47
50
 
48
51
  https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodings.md`,
@@ -6,6 +6,7 @@ const _abap_rule_1 = require("./_abap_rule");
6
6
  const _irule_1 = require("./_irule");
7
7
  const Statements = require("../abap/2_statements/statements");
8
8
  const issue_1 = require("../issue");
9
+ const _statement_1 = require("../abap/2_statements/statements/_statement");
9
10
  class ReduceProceduralCodeConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -25,7 +26,9 @@ class ReduceProceduralCode extends _abap_rule_1.ABAPRule {
25
26
  shortDescription: `Checks FORM and FUNCTION-MODULE have few statements`,
26
27
  extendedInformation: `Delegate logic to a class method instead of using FORM or FUNCTION-MODULE.
27
28
 
28
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-object-orientation-to-procedural-programming`,
29
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-object-orientation-to-procedural-programming
30
+
31
+ Comments are not counted as statements.`,
29
32
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
30
33
  badExample: `FORM foo.
31
34
  DATA lv_bar TYPE i.
@@ -71,6 +74,9 @@ ENDFORM.`,
71
74
  }
72
75
  doCount = undefined;
73
76
  }
77
+ else if (statement.get() instanceof _statement_1.Comment) {
78
+ continue;
79
+ }
74
80
  else if (doCount !== undefined) {
75
81
  count = count + 1;
76
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.105.1",
3
+ "version": "2.105.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",