@abaplint/core 2.91.9 → 2.91.12

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 (86) hide show
  1. package/README.md +6 -6
  2. package/build/src/abap/2_statements/expressions/type_table.js +3 -1
  3. package/build/src/abap/2_statements/statement_parser.js +2 -1
  4. package/build/src/abap/2_statements/statements/method_def.js +4 -3
  5. package/build/src/abap/5_syntax/expressions/value_body.js +4 -3
  6. package/build/src/abap/flow/flow_graph.js +7 -7
  7. package/build/src/lsp/help.js +7 -7
  8. package/build/src/registry.js +1 -1
  9. package/build/src/rules/7bit_ascii.js +2 -2
  10. package/build/src/rules/abapdoc.js +1 -1
  11. package/build/src/rules/align_parameters.js +33 -33
  12. package/build/src/rules/ambiguous_statement.js +5 -5
  13. package/build/src/rules/avoid_use.js +8 -8
  14. package/build/src/rules/begin_end_names.js +4 -4
  15. package/build/src/rules/begin_single_include.js +12 -12
  16. package/build/src/rules/call_transaction_authority_check.js +3 -3
  17. package/build/src/rules/cds_legacy_view.js +4 -2
  18. package/build/src/rules/chain_mainly_declarations.js +4 -4
  19. package/build/src/rules/check_abstract.js +2 -2
  20. package/build/src/rules/check_comments.js +4 -4
  21. package/build/src/rules/check_include.js +3 -3
  22. package/build/src/rules/check_subrc.js +8 -8
  23. package/build/src/rules/classic_exceptions_overlap.js +8 -8
  24. package/build/src/rules/commented_code.js +1 -1
  25. package/build/src/rules/constructor_visibility_public.js +4 -4
  26. package/build/src/rules/contains_tab.js +2 -2
  27. package/build/src/rules/dangerous_statement.js +1 -1
  28. package/build/src/rules/downport.js +146 -70
  29. package/build/src/rules/exit_or_check.js +3 -3
  30. package/build/src/rules/exporting.js +1 -1
  31. package/build/src/rules/forbidden_identifier.js +1 -1
  32. package/build/src/rules/forbidden_void_type.js +2 -2
  33. package/build/src/rules/functional_writing.js +17 -17
  34. package/build/src/rules/global_class.js +8 -8
  35. package/build/src/rules/identical_conditions.js +2 -2
  36. package/build/src/rules/identical_contents.js +14 -14
  37. package/build/src/rules/identical_descriptions.js +4 -4
  38. package/build/src/rules/if_in_if.js +7 -7
  39. package/build/src/rules/implement_methods.js +3 -3
  40. package/build/src/rules/in_statement_indentation.js +11 -11
  41. package/build/src/rules/intf_referencing_clas.js +3 -3
  42. package/build/src/rules/line_break_style.js +2 -2
  43. package/build/src/rules/line_length.js +1 -1
  44. package/build/src/rules/line_only_punc.js +1 -1
  45. package/build/src/rules/local_variable_names.js +2 -2
  46. package/build/src/rules/many_parentheses.js +10 -10
  47. package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
  48. package/build/src/rules/max_one_statement.js +5 -5
  49. package/build/src/rules/method_overwrites_builtin.js +2 -2
  50. package/build/src/rules/nesting.js +1 -1
  51. package/build/src/rules/no_chained_assignment.js +1 -1
  52. package/build/src/rules/no_external_form_calls.js +2 -2
  53. package/build/src/rules/no_inline_in_optional_branches.js +11 -11
  54. package/build/src/rules/no_public_attributes.js +1 -1
  55. package/build/src/rules/no_yoda_conditions.js +4 -4
  56. package/build/src/rules/nrob_consistency.js +2 -2
  57. package/build/src/rules/obsolete_statement.js +42 -42
  58. package/build/src/rules/omit_parameter_name.js +3 -3
  59. package/build/src/rules/omit_receiving.js +13 -13
  60. package/build/src/rules/parser_702_chaining.js +2 -2
  61. package/build/src/rules/parser_error.js +2 -2
  62. package/build/src/rules/parser_missing_space.js +1 -1
  63. package/build/src/rules/prefer_inline.js +16 -16
  64. package/build/src/rules/prefer_is_not.js +7 -7
  65. package/build/src/rules/prefer_raise_exception_new.js +3 -3
  66. package/build/src/rules/prefer_returning_to_exporting.js +1 -1
  67. package/build/src/rules/prefer_xsdbool.js +2 -2
  68. package/build/src/rules/remove_descriptions.js +4 -4
  69. package/build/src/rules/rfc_error_handling.js +9 -9
  70. package/build/src/rules/select_add_order_by.js +5 -5
  71. package/build/src/rules/select_performance.js +5 -5
  72. package/build/src/rules/sicf_consistency.js +2 -2
  73. package/build/src/rules/space_before_dot.js +2 -2
  74. package/build/src/rules/start_at_tab.js +1 -1
  75. package/build/src/rules/sy_modification.js +2 -2
  76. package/build/src/rules/tabl_enhancement_category.js +2 -2
  77. package/build/src/rules/unknown_types.js +11 -3
  78. package/build/src/rules/unnecessary_pragma.js +22 -22
  79. package/build/src/rules/unused_methods.js +9 -9
  80. package/build/src/rules/unused_variables.js +6 -6
  81. package/build/src/rules/use_bool_expression.js +8 -8
  82. package/build/src/rules/use_line_exists.js +6 -6
  83. package/build/src/rules/use_new.js +4 -4
  84. package/build/src/rules/when_others_last.js +6 -6
  85. package/build/src/rules/xml_consistency.js +1 -2
  86. package/package.json +65 -65
@@ -99,7 +99,7 @@ class UnknownTypes {
99
99
  }
100
100
  }
101
101
  for (const v of nodeData.idefs) {
102
- const found = this.checkMethodParameters(v);
102
+ const found = this.checkParameters(v);
103
103
  if (found) {
104
104
  const message = "Contains unknown, " + found.found;
105
105
  ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
@@ -107,7 +107,7 @@ class UnknownTypes {
107
107
  }
108
108
  for (const name in nodeData.cdefs) {
109
109
  const v = nodeData.cdefs[name];
110
- const found = this.checkMethodParameters(v);
110
+ const found = this.checkParameters(v);
111
111
  if (found) {
112
112
  const message = "Contains unknown, " + found.found;
113
113
  ret.push(issue_1.Issue.atIdentifier(found.id, message, this.getMetadata().key, this.conf.severity));
@@ -118,7 +118,7 @@ class UnknownTypes {
118
118
  }
119
119
  return ret;
120
120
  }
121
- checkMethodParameters(idef) {
121
+ checkParameters(idef) {
122
122
  var _a;
123
123
  for (const m of ((_a = idef.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
124
124
  for (const p of m.getParameters().getAll()) {
@@ -128,6 +128,14 @@ class UnknownTypes {
128
128
  }
129
129
  }
130
130
  }
131
+ for (const e of idef.getEvents() || []) {
132
+ for (const p of e.getParameters()) {
133
+ const found = this.containsUnknown(p.getType());
134
+ if (found) {
135
+ return { id: p, found };
136
+ }
137
+ }
138
+ }
131
139
  return undefined;
132
140
  }
133
141
  containsUnknown(type) {
@@ -21,31 +21,31 @@ class UnnecessaryPragma extends _abap_rule_1.ABAPRule {
21
21
  key: "unnecessary_pragma",
22
22
  title: "Unnecessary Pragma",
23
23
  shortDescription: `Finds pragmas which can be removed`,
24
- extendedInformation: `* NO_HANDLER with handler
25
-
26
- * NEEDED without definition
27
-
28
- * NO_TEXT without texts
29
-
24
+ extendedInformation: `* NO_HANDLER with handler
25
+
26
+ * NEEDED without definition
27
+
28
+ * NO_TEXT without texts
29
+
30
30
  * SUBRC_OK where sy-subrc is checked`,
31
31
  tags: [_irule_1.RuleTag.SingleFile],
32
- badExample: `TRY.
33
- ...
34
- CATCH zcx_abapgit_exception ##NO_HANDLER.
35
- RETURN. " it has a handler
36
- ENDTRY.
37
- MESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.
38
- SELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.
39
- IF sy-subrc <> 0.
32
+ badExample: `TRY.
33
+ ...
34
+ CATCH zcx_abapgit_exception ##NO_HANDLER.
35
+ RETURN. " it has a handler
36
+ ENDTRY.
37
+ MESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.
38
+ SELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.
39
+ IF sy-subrc <> 0.
40
40
  ENDIF.`,
41
- goodExample: `TRY.
42
- ...
43
- CATCH zcx_abapgit_exception.
44
- RETURN.
45
- ENDTRY.
46
- MESSAGE w125(zbar) WITH c_foo INTO message.
47
- SELECT SINGLE * FROM tadir INTO @DATA(sdfs).
48
- IF sy-subrc <> 0.
41
+ goodExample: `TRY.
42
+ ...
43
+ CATCH zcx_abapgit_exception.
44
+ RETURN.
45
+ ENDTRY.
46
+ MESSAGE w125(zbar) WITH c_foo INTO message.
47
+ SELECT SINGLE * FROM tadir INTO @DATA(sdfs).
48
+ IF sy-subrc <> 0.
49
49
  ENDIF.`,
50
50
  };
51
51
  }
@@ -55,15 +55,15 @@ class UnusedMethods {
55
55
  key: "unused_methods",
56
56
  title: "Unused methods",
57
57
  shortDescription: `Checks for unused methods`,
58
- extendedInformation: `Checks private and protected methods.
59
-
60
- Skips:
61
- * methods FOR TESTING
62
- * methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses
63
- * class_constructor + constructor methods
64
- * event handlers
65
- * methods that are redefined
66
- * INCLUDEs
58
+ extendedInformation: `Checks private and protected methods.
59
+
60
+ Skips:
61
+ * methods FOR TESTING
62
+ * methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses
63
+ * class_constructor + constructor methods
64
+ * event handlers
65
+ * methods that are redefined
66
+ * INCLUDEs
67
67
  `,
68
68
  tags: [],
69
69
  pragma: "##CALLED",
@@ -64,12 +64,12 @@ class UnusedVariables {
64
64
  key: "unused_variables",
65
65
  title: "Unused variables",
66
66
  shortDescription: `Checks for unused variables and constants`,
67
- extendedInformation: `WARNING: slow
68
-
69
- Skips event parameters.
70
-
71
- Note that this currently does not work if the source code uses macros.
72
-
67
+ extendedInformation: `WARNING: slow
68
+
69
+ Skips event parameters.
70
+
71
+ Note that this currently does not work if the source code uses macros.
72
+
73
73
  Unused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,
74
74
  tags: [_irule_1.RuleTag.Quickfix],
75
75
  pragma: "##NEEDED",
@@ -27,15 +27,15 @@ class UseBoolExpression extends _abap_rule_1.ABAPRule {
27
27
  shortDescription: `Use boolean expression, xsdbool from 740sp08 and up, boolc from 702 and up`,
28
28
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,
29
29
  tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
30
- badExample: `IF line IS INITIAL.
31
- has_entries = abap_false.
32
- ELSE.
33
- has_entries = abap_true.
34
- ENDIF.
35
-
30
+ badExample: `IF line IS INITIAL.
31
+ has_entries = abap_false.
32
+ ELSE.
33
+ has_entries = abap_true.
34
+ ENDIF.
35
+
36
36
  DATA(fsdf) = COND #( WHEN foo <> bar THEN abap_true ELSE abap_false ).`,
37
- goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).
38
-
37
+ goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).
38
+
39
39
  DATA(fsdf) = xsdbool( foo <> bar ).`,
40
40
  };
41
41
  }
@@ -22,15 +22,15 @@ class UseLineExists extends _abap_rule_1.ABAPRule {
22
22
  key: "use_line_exists",
23
23
  title: "Use line_exists",
24
24
  shortDescription: `Use line_exists, from 740sp02 and up`,
25
- extendedInformation: `
26
- https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at
27
-
25
+ extendedInformation: `
26
+ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at
27
+
28
28
  Not reported if the READ TABLE statement contains BINARY SEARCH.`,
29
29
  tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
30
- badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.
31
- IF sy-subrc = 0.
30
+ badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.
31
+ IF sy-subrc = 0.
32
32
  ENDIF.`,
33
- goodExample: `IF line_exists( my_table[ key = 'A' ] ).
33
+ goodExample: `IF line_exists( my_table[ key = 'A' ] ).
34
34
  ENDIF.`,
35
35
  };
36
36
  }
@@ -23,10 +23,10 @@ class UseNew extends _abap_rule_1.ABAPRule {
23
23
  key: "use_new",
24
24
  title: "Use NEW",
25
25
  shortDescription: `Checks for deprecated CREATE OBJECT statements.`,
26
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object
27
-
28
- If the target variable is referenced in the CREATE OBJECT statement, no errors are issued
29
-
26
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object
27
+
28
+ If the target variable is referenced in the CREATE OBJECT statement, no errors are issued
29
+
30
30
  Applicable from v740sp02 and up`,
31
31
  badExample: `CREATE OBJECT ref.`,
32
32
  goodExample: `ref = NEW #( ).`,
@@ -21,13 +21,13 @@ class WhenOthersLast extends _abap_rule_1.ABAPRule {
21
21
  title: "WHEN OTHERS last",
22
22
  shortDescription: `Checks that WHEN OTHERS is placed the last within a CASE statement.`,
23
23
  tags: [_irule_1.RuleTag.SingleFile],
24
- badExample: `CASE bar.
25
- WHEN OTHERS.
26
- WHEN 2.
24
+ badExample: `CASE bar.
25
+ WHEN OTHERS.
26
+ WHEN 2.
27
27
  ENDCASE.`,
28
- goodExample: `CASE bar.
29
- WHEN 2.
30
- WHEN OTHERS.
28
+ goodExample: `CASE bar.
29
+ WHEN 2.
30
+ WHEN OTHERS.
31
31
  ENDCASE.`,
32
32
  };
33
33
  }
@@ -65,8 +65,7 @@ class XMLConsistency {
65
65
  else if (name !== obj.getName().toUpperCase()) {
66
66
  issues.push(issue_1.Issue.atRow(file, 1, "Name in XML does not match object", this.getMetadata().key, this.conf.severity));
67
67
  }
68
- else if (obj.getDefinition() === undefined
69
- || ((_b = obj.getDefinition()) === null || _b === void 0 ? void 0 : _b.getName().toUpperCase()) !== name.toUpperCase()) {
68
+ else if (obj.getDefinition() !== undefined && ((_b = obj.getDefinition()) === null || _b === void 0 ? void 0 : _b.getName().toUpperCase()) !== name.toUpperCase()) {
70
69
  issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
71
70
  }
72
71
  }
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "@abaplint/core",
3
- "version": "2.91.9",
4
- "description": "abaplint - Core API",
5
- "main": "build/src/index.js",
6
- "typings": "build/abaplint.d.ts",
7
- "scripts": {
8
- "lint": "eslint src/**/*.ts test/**/*.ts --format unix",
9
- "lint:fix": "eslint src/**/*.ts test/**/*.ts --format unix --fix",
10
- "compile": "tsc && sh scripts/version.sh",
11
- "test": "npm run compile && mocha --timeout 1000 && npm run lint && npm run schema && api-extractor run",
12
- "test:only": "npm run compile && mocha",
13
- "test:parallel": "npm run compile && mocha --timeout 1000 --parallel --reporter dot",
14
- "coverage": "npm run compile && c8 mocha && c8 report --reporter=html",
15
- "schema": "node scripts/schema.js > scripts/schema.ts && ts-json-schema-generator --tsconfig tsconfig_schema.json --jsDoc extended --path scripts/schema.ts > scripts/schema.json && node scripts/schema_post.js",
16
- "publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
17
- "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public"
18
- },
19
- "mocha": {
20
- "recursive": true,
21
- "reporter": "progress",
22
- "spec": "build/test/**/*.js",
23
- "require": "source-map-support/register"
24
- },
25
- "c8": {
26
- "include": [
27
- "build/src/**/*.js"
28
- ]
29
- },
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/abaplint/abaplint.git"
33
- },
34
- "engines": {
35
- "node": ">=12.0.0"
36
- },
37
- "keywords": [
38
- "ABAP",
39
- "lint"
40
- ],
41
- "author": "Lars Hvam Petersen",
42
- "license": "MIT",
43
- "bugs": {
44
- "url": "https://github.com/abaplint/abaplint/issues"
45
- },
46
- "homepage": "https://abaplint.org",
47
- "devDependencies": {
48
- "@microsoft/api-extractor": "^7.28.4",
49
- "@types/chai": "^4.3.1",
50
- "@types/mocha": "^9.1.1",
51
- "@types/node": "^18.0.3",
52
- "chai": "^4.3.6",
53
- "eslint": "^8.19.0",
54
- "mocha": "^10.0.0",
55
- "c8": "^7.11.3",
56
- "source-map-support": "^0.5.21",
57
- "ts-json-schema-generator": "^1.0.0",
58
- "typescript": "^4.7.4"
59
- },
60
- "dependencies": {
61
- "fast-xml-parser": "^4.0.9",
62
- "json5": "^2.2.1",
63
- "vscode-languageserver-types": "^3.17.1"
64
- }
65
- }
1
+ {
2
+ "name": "@abaplint/core",
3
+ "version": "2.91.12",
4
+ "description": "abaplint - Core API",
5
+ "main": "build/src/index.js",
6
+ "typings": "build/abaplint.d.ts",
7
+ "scripts": {
8
+ "lint": "eslint src/**/*.ts test/**/*.ts --format unix",
9
+ "lint:fix": "eslint src/**/*.ts test/**/*.ts --format unix --fix",
10
+ "compile": "tsc && sh scripts/version.sh",
11
+ "test": "npm run compile && mocha --timeout 1000 && npm run lint && npm run schema && api-extractor run",
12
+ "test:only": "npm run compile && mocha",
13
+ "test:parallel": "npm run compile && mocha --timeout 1000 --parallel --reporter dot",
14
+ "coverage": "npm run compile && c8 mocha && c8 report --reporter=html",
15
+ "schema": "node scripts/schema.js > scripts/schema.ts && ts-json-schema-generator --tsconfig tsconfig_schema.json --jsDoc extended --path scripts/schema.ts > scripts/schema.json && node scripts/schema_post.js",
16
+ "publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
17
+ "publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public"
18
+ },
19
+ "mocha": {
20
+ "recursive": true,
21
+ "reporter": "progress",
22
+ "spec": "build/test/**/*.js",
23
+ "require": "source-map-support/register"
24
+ },
25
+ "c8": {
26
+ "include": [
27
+ "build/src/**/*.js"
28
+ ]
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/abaplint/abaplint.git"
33
+ },
34
+ "engines": {
35
+ "node": ">=12.0.0"
36
+ },
37
+ "keywords": [
38
+ "ABAP",
39
+ "lint"
40
+ ],
41
+ "author": "Lars Hvam Petersen",
42
+ "license": "MIT",
43
+ "bugs": {
44
+ "url": "https://github.com/abaplint/abaplint/issues"
45
+ },
46
+ "homepage": "https://abaplint.org",
47
+ "devDependencies": {
48
+ "@microsoft/api-extractor": "^7.28.6",
49
+ "@types/chai": "^4.3.1",
50
+ "@types/mocha": "^9.1.1",
51
+ "@types/node": "^18.0.6",
52
+ "chai": "^4.3.6",
53
+ "eslint": "^8.20.0",
54
+ "mocha": "^10.0.0",
55
+ "c8": "^7.12.0",
56
+ "source-map-support": "^0.5.21",
57
+ "ts-json-schema-generator": "^1.0.0",
58
+ "typescript": "^4.7.4"
59
+ },
60
+ "dependencies": {
61
+ "fast-xml-parser": "^4.0.9",
62
+ "json5": "^2.2.1",
63
+ "vscode-languageserver-types": "^3.17.2"
64
+ }
65
+ }