@abaplint/core 2.83.20 → 2.83.24

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 (87) hide show
  1. package/README.md +6 -6
  2. package/build/abaplint.d.ts +10 -1
  3. package/build/src/abap/2_statements/expressions/compare.js +3 -2
  4. package/build/src/abap/5_syntax/_current_scope.js +8 -2
  5. package/build/src/abap/5_syntax/expressions/constant.js +2 -2
  6. package/build/src/abap/5_syntax/expressions/source.js +21 -2
  7. package/build/src/abap/5_syntax/spaghetti_scope.js +4 -5
  8. package/build/src/abap/5_syntax/statements/create_object.js +1 -0
  9. package/build/src/abap/flow/flow_graph.js +7 -7
  10. package/build/src/lsp/help.js +7 -7
  11. package/build/src/objects/_abstract_object.js +2 -2
  12. package/build/src/objects/function_group.js +2 -2
  13. package/build/src/objects/icf_service.js +26 -6
  14. package/build/src/registry.js +1 -1
  15. package/build/src/rules/7bit_ascii.js +2 -2
  16. package/build/src/rules/abapdoc.js +1 -1
  17. package/build/src/rules/align_parameters.js +33 -33
  18. package/build/src/rules/ambiguous_statement.js +5 -5
  19. package/build/src/rules/avoid_use.js +6 -6
  20. package/build/src/rules/begin_end_names.js +4 -4
  21. package/build/src/rules/begin_single_include.js +12 -12
  22. package/build/src/rules/call_transaction_authority_check.js +3 -3
  23. package/build/src/rules/chain_mainly_declarations.js +4 -4
  24. package/build/src/rules/check_abstract.js +2 -2
  25. package/build/src/rules/check_comments.js +4 -4
  26. package/build/src/rules/check_include.js +3 -3
  27. package/build/src/rules/check_no_handler_pragma.js +8 -8
  28. package/build/src/rules/check_subrc.js +8 -8
  29. package/build/src/rules/commented_code.js +1 -1
  30. package/build/src/rules/constructor_visibility_public.js +4 -4
  31. package/build/src/rules/contains_tab.js +2 -2
  32. package/build/src/rules/dangerous_statement.js +1 -1
  33. package/build/src/rules/definitions_top.js +3 -3
  34. package/build/src/rules/downport.js +50 -46
  35. package/build/src/rules/exit_or_check.js +3 -3
  36. package/build/src/rules/exporting.js +1 -1
  37. package/build/src/rules/forbidden_identifier.js +1 -1
  38. package/build/src/rules/forbidden_void_type.js +2 -2
  39. package/build/src/rules/functional_writing.js +17 -17
  40. package/build/src/rules/global_class.js +10 -10
  41. package/build/src/rules/identical_conditions.js +2 -2
  42. package/build/src/rules/identical_contents.js +15 -15
  43. package/build/src/rules/identical_descriptions.js +4 -4
  44. package/build/src/rules/if_in_if.js +7 -7
  45. package/build/src/rules/implement_methods.js +3 -3
  46. package/build/src/rules/in_statement_indentation.js +11 -11
  47. package/build/src/rules/intf_referencing_clas.js +3 -3
  48. package/build/src/rules/line_break_style.js +2 -2
  49. package/build/src/rules/line_length.js +1 -1
  50. package/build/src/rules/line_only_punc.js +1 -1
  51. package/build/src/rules/local_variable_names.js +2 -2
  52. package/build/src/rules/many_parentheses.js +10 -10
  53. package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
  54. package/build/src/rules/max_one_statement.js +3 -3
  55. package/build/src/rules/nesting.js +1 -1
  56. package/build/src/rules/no_chained_assignment.js +1 -1
  57. package/build/src/rules/no_public_attributes.js +1 -1
  58. package/build/src/rules/no_yoda_conditions.js +4 -4
  59. package/build/src/rules/obsolete_statement.js +40 -40
  60. package/build/src/rules/omit_parameter_name.js +3 -3
  61. package/build/src/rules/omit_receiving.js +13 -13
  62. package/build/src/rules/parser_702_chaining.js +2 -2
  63. package/build/src/rules/parser_error.js +2 -2
  64. package/build/src/rules/parser_missing_space.js +1 -1
  65. package/build/src/rules/prefer_inline.js +16 -16
  66. package/build/src/rules/prefer_is_not.js +7 -7
  67. package/build/src/rules/prefer_raise_exception_new.js +3 -3
  68. package/build/src/rules/prefer_returning_to_exporting.js +1 -1
  69. package/build/src/rules/prefer_xsdbool.js +2 -2
  70. package/build/src/rules/remove_descriptions.js +6 -6
  71. package/build/src/rules/rfc_error_handling.js +9 -9
  72. package/build/src/rules/select_add_order_by.js +5 -5
  73. package/build/src/rules/select_performance.js +2 -2
  74. package/build/src/rules/sicf_consistency.js +4 -4
  75. package/build/src/rules/space_before_dot.js +2 -2
  76. package/build/src/rules/start_at_tab.js +1 -1
  77. package/build/src/rules/sy_modification.js +2 -2
  78. package/build/src/rules/tabl_enhancement_category.js +2 -2
  79. package/build/src/rules/unknown_types.js +7 -5
  80. package/build/src/rules/unused_methods.js +9 -9
  81. package/build/src/rules/unused_variables.js +6 -6
  82. package/build/src/rules/use_bool_expression.js +8 -8
  83. package/build/src/rules/use_line_exists.js +6 -6
  84. package/build/src/rules/use_new.js +2 -2
  85. package/build/src/rules/when_others_last.js +6 -6
  86. package/build/src/rules/xml_consistency.js +2 -2
  87. package/package.json +66 -66
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # @abaplint/core
2
-
3
- [abaplint](https://abaplint.org/) core library
4
-
5
- Exposes functionallity like the parser and rules, which can be used in other projects.
6
-
1
+ # @abaplint/core
2
+
3
+ [abaplint](https://abaplint.org/) core library
4
+
5
+ Exposes functionallity like the parser and rules, which can be used in other projects.
6
+
7
7
  For more information see https://github.com/abaplint/abaplint
@@ -2529,13 +2529,20 @@ declare interface IBuiltinMethod {
2529
2529
  }
2530
2530
 
2531
2531
  declare class ICFService extends AbstractObject {
2532
+ private parsedXML;
2532
2533
  getType(): string;
2533
2534
  getAllowedNaming(): {
2534
2535
  maxLength: number;
2535
2536
  allowNamespace: boolean;
2536
2537
  };
2538
+ setDirty(): void;
2537
2539
  getDescription(): string | undefined;
2540
+ getURL(): string | undefined;
2538
2541
  getHandlerList(): string[] | undefined;
2542
+ parse(): {
2543
+ updated: boolean;
2544
+ runtime: number;
2545
+ };
2539
2546
  }
2540
2547
 
2541
2548
  export declare interface IClassDefinition extends IInterfaceDefinition {
@@ -3245,7 +3252,9 @@ declare interface IScopeData {
3245
3252
  [name: string]: TypedIdentifier;
3246
3253
  };
3247
3254
  deferred: Token[];
3248
- cdefs: IClassDefinition[];
3255
+ cdefs: {
3256
+ [name: string]: IClassDefinition;
3257
+ };
3249
3258
  idefs: IInterfaceDefinition[];
3250
3259
  forms: IFormDefinition[];
3251
3260
  references: IReference[];
@@ -10,11 +10,12 @@ class Compare extends combi_1.Expression {
10
10
  const val = (0, combi_1.altPrio)(_1.FieldSub, _1.Constant);
11
11
  const list = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeft), val, (0, combi_1.plus)((0, combi_1.seq)(",", val)), (0, combi_1.tok)(tokens_1.ParenRightW));
12
12
  const inn = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "IN", (0, combi_1.altPrio)(_1.Source, list));
13
- const sopt = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("INSTANCE OF", _1.ClassName)), "REQUESTED", "ASSIGNED", "INITIAL"));
13
+ const sopt = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("SUPPLIED", "BOUND", (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.seq)("INSTANCE OF", _1.ClassName)), "REQUESTED", "INITIAL"));
14
14
  const between = (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), "BETWEEN", _1.Source, "AND", _1.Source);
15
15
  const predicate = (0, combi_1.ver)(version_1.Version.v740sp08, _1.MethodCallChain);
16
16
  const rett = (0, combi_1.seq)(_1.Source, (0, combi_1.altPrio)((0, combi_1.seq)(_1.CompareOperator, _1.Source), inn, between, sopt));
17
- const ret = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.altPrio)(rett, predicate));
17
+ const fsassign = (0, combi_1.seq)(_1.SourceFieldSymbol, "IS", (0, combi_1.optPrio)("NOT"), "ASSIGNED");
18
+ const ret = (0, combi_1.seq)((0, combi_1.opt)("NOT"), (0, combi_1.altPrio)(rett, predicate, fsassign));
18
19
  return ret;
19
20
  }
20
21
  }
@@ -74,8 +74,14 @@ class CurrentScope {
74
74
  this.current.getData().extraLikeTypes[upper] = type;
75
75
  }
76
76
  addClassDefinition(c) {
77
- var _a;
78
- (_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().cdefs.push(c);
77
+ if (this.current === undefined) {
78
+ return;
79
+ }
80
+ const name = c.getName().toUpperCase();
81
+ if (this.current.getData().cdefs[name] !== undefined) {
82
+ throw new Error(`Class "${name}" already defined`);
83
+ }
84
+ this.current.getData().cdefs[name] = c;
79
85
  }
80
86
  addFormDefinitions(f) {
81
87
  if (this.current === undefined) {
@@ -6,10 +6,10 @@ const expressions_1 = require("../../2_statements/expressions");
6
6
  class Constant {
7
7
  runSyntax(node) {
8
8
  if (node.findDirectExpression(expressions_1.Integer)) {
9
- return new basic_1.IntegerType();
9
+ return new basic_1.IntegerType("I");
10
10
  }
11
11
  else {
12
- return new basic_1.StringType();
12
+ return new basic_1.StringType("STRING");
13
13
  }
14
14
  }
15
15
  }
@@ -58,12 +58,15 @@ class Source {
58
58
  const method = new _builtin_1.BuiltIn().searchBuiltin(tok);
59
59
  scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, filename);
60
60
  new cond_1.Cond().runSyntax(node.findDirectExpression(Expressions.Cond), scope, filename);
61
- return new basic_1.CharacterType(1);
61
+ return new basic_1.CharacterType(1, "ABAP_BOOL");
62
62
  }
63
63
  case "REDUCE":
64
64
  {
65
65
  const foundType = this.determineType(node, scope, filename, targetType);
66
66
  const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), scope, filename);
67
+ if (foundType === undefined) {
68
+ this.addIfInferred(node, scope, filename, bodyType);
69
+ }
67
70
  return foundType ? foundType : bodyType;
68
71
  }
69
72
  case "SWITCH":
@@ -75,7 +78,11 @@ class Source {
75
78
  case "COND":
76
79
  {
77
80
  const foundType = this.determineType(node, scope, filename, targetType);
78
- return new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), scope, filename, foundType);
81
+ const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), scope, filename, foundType);
82
+ if (foundType === undefined) {
83
+ this.addIfInferred(node, scope, filename, bodyType);
84
+ }
85
+ return foundType ? foundType : bodyType;
79
86
  }
80
87
  case "CONV":
81
88
  {
@@ -155,6 +162,18 @@ class Source {
155
162
  return context;
156
163
  }
157
164
  ////////////////////////////////
165
+ addIfInferred(node, scope, filename, inferredType) {
166
+ const basic = new basic_types_1.BasicTypes(filename, scope);
167
+ const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
168
+ const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
169
+ const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
170
+ if (typeName === "#" && inferredType) {
171
+ const found = basic.lookupQualifiedName(inferredType.getQualifiedName());
172
+ if (found) {
173
+ scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, filename);
174
+ }
175
+ }
176
+ }
158
177
  determineType(node, scope, filename, targetType) {
159
178
  const basic = new basic_types_1.BasicTypes(filename, scope);
160
179
  const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
@@ -8,7 +8,7 @@ class ScopeData {
8
8
  constructor() {
9
9
  this.data = {
10
10
  vars: {},
11
- cdefs: [],
11
+ cdefs: {},
12
12
  idefs: [],
13
13
  forms: [],
14
14
  types: {},
@@ -68,10 +68,9 @@ class SpaghettiScopeNode extends ScopeData {
68
68
  let search = this;
69
69
  const upper = name.toUpperCase();
70
70
  while (search !== undefined) {
71
- for (const cdef of search.getData().cdefs) {
72
- if (cdef.getName().toUpperCase() === upper) {
73
- return cdef;
74
- }
71
+ const c = search.getData().cdefs[upper];
72
+ if (c !== undefined) {
73
+ return c;
75
74
  }
76
75
  search = search.getParent();
77
76
  }
@@ -44,6 +44,7 @@ class CreateObject {
44
44
  continue;
45
45
  }
46
46
  else if (!(found instanceof basic_1.ObjectReferenceType)
47
+ && !(found instanceof basic_1.AnyType)
47
48
  && !(found instanceof basic_1.GenericObjectReferenceType)) {
48
49
  throw new Error("Target must be a object reference");
49
50
  }
@@ -72,13 +72,13 @@ class FlowGraph {
72
72
  this.label = label;
73
73
  }
74
74
  toDigraph() {
75
- return `digraph G {
76
- labelloc="t";
77
- label="${this.label}";
78
- graph [fontname = "helvetica"];
79
- node [fontname = "helvetica", shape="box"];
80
- edge [fontname = "helvetica"];
81
- ${this.toTextEdges()}
75
+ return `digraph G {
76
+ labelloc="t";
77
+ label="${this.label}";
78
+ graph [fontname = "helvetica"];
79
+ node [fontname = "helvetica", shape="box"];
80
+ edge [fontname = "helvetica"];
81
+ ${this.toTextEdges()}
82
82
  }`;
83
83
  }
84
84
  listSources(node) {
@@ -19,13 +19,13 @@ class Help {
19
19
  /////////////////////////////////////////////////
20
20
  static dumpABAP(file, reg, textDocument, position) {
21
21
  let content = "";
22
- content = `
23
- <a href="#_tokens" rel="no-refresh">Tokens</a> |
24
- <a href="#_statements" rel="no-refresh">Statements</a> |
25
- <a href="#_structure" rel="no-refresh">Structure</a> |
26
- <a href="#_files" rel="no-refresh">Files</a> |
27
- <a href="#_info" rel="no-refresh">Info Dump</a>
28
- <hr>
22
+ content = `
23
+ <a href="#_tokens" rel="no-refresh">Tokens</a> |
24
+ <a href="#_statements" rel="no-refresh">Statements</a> |
25
+ <a href="#_structure" rel="no-refresh">Structure</a> |
26
+ <a href="#_files" rel="no-refresh">Files</a> |
27
+ <a href="#_info" rel="no-refresh">Info Dump</a>
28
+ <hr>
29
29
  ` +
30
30
  "<tt>" + textDocument.uri + " (" +
31
31
  (position.line + 1) + ", " +
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractObject = void 0;
4
- const fastxmlparser = require("fast-xml-parser");
4
+ const fast_xml_parser_1 = require("fast-xml-parser");
5
5
  const _identifier_1 = require("../abap/4_file_information/_identifier");
6
6
  const identifier_1 = require("../abap/1_lexer/tokens/identifier");
7
7
  const position_1 = require("../position");
@@ -100,7 +100,7 @@ class AbstractObject {
100
100
  return undefined;
101
101
  }
102
102
  try {
103
- return fastxmlparser.parse(xml, { parseNodeValue: false, ignoreAttributes: true, trimValues: false });
103
+ return new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);
104
104
  }
105
105
  catch (_a) {
106
106
  return undefined;
@@ -4,7 +4,7 @@ exports.FunctionGroup = void 0;
4
4
  const _abap_object_1 = require("./_abap_object");
5
5
  const types_1 = require("../abap/types");
6
6
  const xml_utils_1 = require("../xml_utils");
7
- const fastxmlparser = require("fast-xml-parser");
7
+ const fast_xml_parser_1 = require("fast-xml-parser");
8
8
  class FunctionGroup extends _abap_object_1.ABAPObject {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -123,7 +123,7 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
123
123
  if (found === undefined) {
124
124
  return {};
125
125
  }
126
- const parsed = fastxmlparser.parse(found.getRaw(), { parseNodeValue: false, ignoreAttributes: true, trimValues: false });
126
+ const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(found.getRaw());
127
127
  this.findTexts(parsed);
128
128
  }
129
129
  return this.texts;
@@ -13,26 +13,46 @@ class ICFService extends _abstract_object_1.AbstractObject {
13
13
  allowNamespace: true,
14
14
  };
15
15
  }
16
+ setDirty() {
17
+ this.parsedXML = undefined;
18
+ super.setDirty();
19
+ }
16
20
  getDescription() {
17
21
  // todo
18
22
  return undefined;
19
23
  }
20
- // todo, cache parsed data
24
+ getURL() {
25
+ var _a;
26
+ this.parse();
27
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.url;
28
+ }
21
29
  getHandlerList() {
22
- const ret = [];
23
- const parsed = this.parseRaw2();
30
+ var _a;
31
+ this.parse();
32
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.handlers;
33
+ }
34
+ parse() {
35
+ if (this.parsedXML) {
36
+ return { updated: false, runtime: 0 };
37
+ }
38
+ const start = Date.now();
39
+ this.parsedXML = {};
40
+ const parsed = super.parseRaw2();
24
41
  if (parsed === undefined
25
42
  || parsed.abapGit === undefined
26
43
  || parsed.abapGit["asx:abap"]["asx:values"] === undefined) {
27
- return undefined;
44
+ return { updated: false, runtime: 0 };
28
45
  }
29
46
  const table = parsed.abapGit["asx:abap"]["asx:values"].ICFHANDLER_TABLE;
47
+ this.parsedXML.handlers = [];
30
48
  for (const h of (0, xml_utils_1.xmlToArray)(table)) {
31
49
  if (h.ICFHANDLER !== undefined) {
32
- ret.push(h.ICFHANDLER.ICFHANDLER);
50
+ this.parsedXML.handlers.push(h.ICFHANDLER.ICFHANDLER);
33
51
  }
34
52
  }
35
- return ret;
53
+ this.parsedXML.url = parsed.abapGit["asx:abap"]["asx:values"].URL;
54
+ const end = Date.now();
55
+ return { updated: true, runtime: end - start };
36
56
  }
37
57
  }
38
58
  exports.ICFService = ICFService;
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.83.20";
71
+ return "2.83.24";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -17,8 +17,8 @@ class SevenBitAscii {
17
17
  key: "7bit_ascii",
18
18
  title: "Check for 7bit ascii",
19
19
  shortDescription: `Only allow characters from the 7bit ASCII set.`,
20
- extendedInformation: `https://docs.abapopenchecks.org/checks/05/
21
-
20
+ extendedInformation: `https://docs.abapopenchecks.org/checks/05/
21
+
22
22
  Checkes files with extension ".abap" and ".asddls"`,
23
23
  tags: [_irule_1.RuleTag.SingleFile],
24
24
  };
@@ -23,7 +23,7 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
23
23
  return {
24
24
  key: "abapdoc",
25
25
  title: "Check abapdoc",
26
- shortDescription: `Various checks regarding abapdoc.
26
+ shortDescription: `Various checks regarding abapdoc.
27
27
  Base rule checks for existence of abapdoc for public class methods and all interface methods.`,
28
28
  tags: [_irule_1.RuleTag.SingleFile],
29
29
  };
@@ -20,42 +20,42 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
20
20
  key: "align_parameters",
21
21
  title: "Align Parameters",
22
22
  shortDescription: `Checks for vertially aligned parameters`,
23
- extendedInformation: `Checks:
24
- * function module calls
25
- * method calls
26
- * VALUE constructors
27
- * NEW constructors
28
- * RAISE EXCEPTION statements
29
- * CREATE OBJECT statements
30
- * RAISE EVENT statements
31
-
32
- https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
33
-
34
- Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
35
-
23
+ extendedInformation: `Checks:
24
+ * function module calls
25
+ * method calls
26
+ * VALUE constructors
27
+ * NEW constructors
28
+ * RAISE EXCEPTION statements
29
+ * CREATE OBJECT statements
30
+ * RAISE EVENT statements
31
+
32
+ https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
33
+
34
+ Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
35
+
36
36
  Also https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,
37
37
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
38
- badExample: `CALL FUNCTION 'FOOBAR'
39
- EXPORTING
40
- foo = 2
41
- parameter = 3.
42
-
43
- foobar( moo = 1
44
- param = 1 ).
45
-
46
- foo = VALUE #(
47
- foo = bar
38
+ badExample: `CALL FUNCTION 'FOOBAR'
39
+ EXPORTING
40
+ foo = 2
41
+ parameter = 3.
42
+
43
+ foobar( moo = 1
44
+ param = 1 ).
45
+
46
+ foo = VALUE #(
47
+ foo = bar
48
48
  moo = 2 ).`,
49
- goodExample: `CALL FUNCTION 'FOOBAR'
50
- EXPORTING
51
- foo = 2
52
- parameter = 3.
53
-
54
- foobar( moo = 1
55
- param = 1 ).
56
-
57
- foo = VALUE #(
58
- foo = bar
49
+ goodExample: `CALL FUNCTION 'FOOBAR'
50
+ EXPORTING
51
+ foo = 2
52
+ parameter = 3.
53
+
54
+ foobar( moo = 1
55
+ param = 1 ).
56
+
57
+ foo = VALUE #(
58
+ foo = bar
59
59
  moo = 2 ).`,
60
60
  };
61
61
  }
@@ -20,14 +20,14 @@ class AmbiguousStatement extends _abap_rule_1.ABAPRule {
20
20
  return {
21
21
  key: "ambiguous_statement",
22
22
  title: "Check for ambigious statements",
23
- shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
24
- Add "TABLE" keyword or "@" for escaping SQL variables
25
-
23
+ shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
24
+ Add "TABLE" keyword or "@" for escaping SQL variables
25
+
26
26
  Only works if the target version is 740sp05 or above`,
27
27
  tags: [_irule_1.RuleTag.SingleFile],
28
- badExample: `DELETE foo FROM bar.
28
+ badExample: `DELETE foo FROM bar.
29
29
  MODIFY foo FROM bar.`,
30
- goodExample: `DELETE foo FROM @bar.
30
+ goodExample: `DELETE foo FROM @bar.
31
31
  MODIFY TABLE foo FROM bar.`,
32
32
  };
33
33
  }
@@ -35,12 +35,12 @@ class AvoidUse extends _abap_rule_1.ABAPRule {
35
35
  key: "avoid_use",
36
36
  title: "Avoid use of certain statements",
37
37
  shortDescription: `Detects usage of certain statements.`,
38
- extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
39
-
40
- Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
41
-
42
- STATICS: use CLASS-DATA instead
43
-
38
+ extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
39
+
40
+ Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
41
+
42
+ STATICS: use CLASS-DATA instead
43
+
44
44
  DESCRIBE TABLE LINES: use lines() instead (quickfix exists)`,
45
45
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
46
46
  };
@@ -23,11 +23,11 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
23
23
  title: "Check BEGIN END names",
24
24
  shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,
25
25
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
26
- badExample: `DATA: BEGIN OF stru,
27
- field TYPE i,
26
+ badExample: `DATA: BEGIN OF stru,
27
+ field TYPE i,
28
28
  END OF structure_not_the_same.`,
29
- goodExample: `DATA: BEGIN OF stru,
30
- field TYPE i,
29
+ goodExample: `DATA: BEGIN OF stru,
30
+ field TYPE i,
31
31
  END OF stru.`,
32
32
  };
33
33
  }
@@ -21,19 +21,19 @@ class BeginSingleInclude extends _abap_rule_1.ABAPRule {
21
21
  title: "BEGIN contains single INCLUDE",
22
22
  shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,
23
23
  tags: [_irule_1.RuleTag.SingleFile],
24
- badExample: `TYPES: BEGIN OF dummy1.
25
- INCLUDE TYPE dselc.
26
- TYPES: END OF dummy1.
27
-
28
- DATA BEGIN OF foo.
29
- INCLUDE STRUCTURE syst.
30
- DATA END OF foo.
31
-
32
- STATICS BEGIN OF bar.
33
- INCLUDE STRUCTURE syst.
24
+ badExample: `TYPES: BEGIN OF dummy1.
25
+ INCLUDE TYPE dselc.
26
+ TYPES: END OF dummy1.
27
+
28
+ DATA BEGIN OF foo.
29
+ INCLUDE STRUCTURE syst.
30
+ DATA END OF foo.
31
+
32
+ STATICS BEGIN OF bar.
33
+ INCLUDE STRUCTURE syst.
34
34
  STATICS END OF bar.`,
35
- goodExample: `DATA BEGIN OF foo.
36
- INCLUDE STRUCTURE dselc.
35
+ goodExample: `DATA BEGIN OF foo.
36
+ INCLUDE STRUCTURE dselc.
37
37
  DATA END OF foo.`,
38
38
  };
39
39
  }
@@ -24,9 +24,9 @@ class CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {
24
24
  extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,
25
25
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
26
26
  badExample: `CALL TRANSACTION 'FOO'.`,
27
- goodExample: `TRY.
28
- CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
29
- CATCH cx_sy_authorization_error.
27
+ goodExample: `TRY.
28
+ CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
29
+ CATCH cx_sy_authorization_error.
30
30
  ENDTRY.`,
31
31
  };
32
32
  }
@@ -45,10 +45,10 @@ class ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {
45
45
  key: "chain_mainly_declarations",
46
46
  title: "Chain mainly declarations",
47
47
  shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,
48
- extendedInformation: `
49
- https://docs.abapopenchecks.org/checks/23/
50
-
51
- https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm
48
+ extendedInformation: `
49
+ https://docs.abapopenchecks.org/checks/23/
50
+
51
+ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm
52
52
  `,
53
53
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
54
54
  badExample: `CALL METHOD: bar.`,
@@ -23,8 +23,8 @@ class CheckAbstract extends _abap_rule_1.ABAPRule {
23
23
  return {
24
24
  key: "check_abstract",
25
25
  title: "Check abstract methods and classes",
26
- shortDescription: `Checks abstract methods and classes:
27
- - class defined as abstract and final,
26
+ shortDescription: `Checks abstract methods and classes:
27
+ - class defined as abstract and final,
28
28
  - non-abstract class contains abstract methods`,
29
29
  extendedInformation: `If a class defines only constants, use an interface instead`,
30
30
  tags: [_irule_1.RuleTag.SingleFile],
@@ -27,11 +27,11 @@ class CheckComments extends _abap_rule_1.ABAPRule {
27
27
  return {
28
28
  key: "check_comments",
29
29
  title: "Check Comments",
30
- shortDescription: `
30
+ shortDescription: `
31
31
  Various checks for comment usage.`,
32
- extendedInformation: `
33
- * End of line comments. Comments starting with "#EC" or "##" are ignored
34
-
32
+ extendedInformation: `
33
+ * End of line comments. Comments starting with "#EC" or "##" are ignored
34
+
35
35
  https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,
36
36
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
37
37
  };
@@ -17,9 +17,9 @@ class CheckInclude {
17
17
  key: "check_include",
18
18
  title: "Check INCLUDEs",
19
19
  shortDescription: `Checks INCLUDE statements`,
20
- extendedInformation: `
21
- * Reports unused includes
22
- * Errors if the includes are not found
20
+ extendedInformation: `
21
+ * Reports unused includes
22
+ * Errors if the includes are not found
23
23
  * Error if including a main program`,
24
24
  tags: [_irule_1.RuleTag.Syntax],
25
25
  };
@@ -21,15 +21,15 @@ class CheckNoHandlerPragma extends _abap_rule_1.ABAPRule {
21
21
  title: "Check if NO_HANDLER can be removed",
22
22
  shortDescription: `Checks NO_HANDLER pragmas that can be removed`,
23
23
  tags: [_irule_1.RuleTag.SingleFile],
24
- badExample: `TRY.
25
- ...
26
- CATCH zcx_abapgit_exception ##NO_HANDLER.
27
- RETURN. " it has a handler
24
+ badExample: `TRY.
25
+ ...
26
+ CATCH zcx_abapgit_exception ##NO_HANDLER.
27
+ RETURN. " it has a handler
28
28
  ENDTRY.`,
29
- goodExample: `TRY.
30
- ...
31
- CATCH zcx_abapgit_exception.
32
- RETURN.
29
+ goodExample: `TRY.
30
+ ...
31
+ CATCH zcx_abapgit_exception.
32
+ RETURN.
33
33
  ENDTRY.`,
34
34
  };
35
35
  }
@@ -34,14 +34,14 @@ class CheckSubrc extends _abap_rule_1.ABAPRule {
34
34
  key: "check_subrc",
35
35
  title: "Check sy-subrc",
36
36
  shortDescription: `Check sy-subrc`,
37
- extendedInformation: `Pseudo comment "#EC CI_SUBRC can be added to suppress findings
38
-
39
- If sy-dbcnt is checked after database statements, it is considered okay.
40
-
41
- "SELECT SINGLE @abap_true FROM " is considered as an existence check
42
-
43
- If IS ASSIGNED is checked after assigning, it is considered okay.
44
-
37
+ extendedInformation: `Pseudo comment "#EC CI_SUBRC can be added to suppress findings
38
+
39
+ If sy-dbcnt is checked after database statements, it is considered okay.
40
+
41
+ "SELECT SINGLE @abap_true FROM " is considered as an existence check
42
+
43
+ If IS ASSIGNED is checked after assigning, it is considered okay.
44
+
45
45
  FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
46
46
  tags: [_irule_1.RuleTag.SingleFile],
47
47
  pseudoComment: "EC CI_SUBRC",
@@ -30,7 +30,7 @@ class CommentedCode extends _abap_rule_1.ABAPRule {
30
30
  key: "commented_code",
31
31
  title: "Find commented code",
32
32
  shortDescription: `Detects usage of commented out code.`,
33
- extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it
33
+ extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it
34
34
  https://docs.abapopenchecks.org/checks/14/`,
35
35
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
36
36
  };