@abaplint/core 2.119.24 → 2.119.26
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.
- package/README.md +6 -6
- package/build/abaplint.d.ts +5 -0
- package/build/src/abap/2_statements/expressions/index.js +2 -0
- package/build/src/abap/2_statements/expressions/sql_aggregation.js +23 -11
- package/build/src/abap/2_statements/expressions/sql_compare.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_field.js +10 -3
- package/build/src/abap/2_statements/expressions/sql_function.js +2 -1
- package/build/src/abap/2_statements/expressions/sql_function_input.js +5 -3
- package/build/src/abap/2_statements/expressions/sql_over.js +25 -0
- package/build/src/abap/5_syntax/expressions/method_call_param.js +5 -1
- package/build/src/abap/5_syntax/expressions/source.js +1 -1
- package/build/src/lsp/help.js +10 -10
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +4 -4
- package/build/src/rules/abapdoc.js +4 -4
- package/build/src/rules/add_test_attributes.js +20 -20
- package/build/src/rules/align_parameters.js +40 -40
- package/build/src/rules/align_type_expressions.js +28 -28
- package/build/src/rules/ambiguous_statement.js +7 -7
- package/build/src/rules/avoid_use.js +10 -10
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +13 -13
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/cds_association_name.js +6 -6
- package/build/src/rules/cds_comment_style.js +4 -4
- package/build/src/rules/cds_field_order.js +12 -12
- package/build/src/rules/cds_legacy_view.js +4 -4
- package/build/src/rules/cds_naming.js +7 -7
- package/build/src/rules/chain_mainly_declarations.js +4 -4
- package/build/src/rules/change_if_to_case.js +8 -8
- package/build/src/rules/check_abstract.js +2 -2
- package/build/src/rules/check_comments.js +4 -4
- package/build/src/rules/check_include.js +4 -4
- package/build/src/rules/check_subrc.js +8 -8
- package/build/src/rules/classic_exceptions_overlap.js +10 -10
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +4 -4
- package/build/src/rules/contains_tab.js +2 -2
- package/build/src/rules/cyclic_oo.js +4 -4
- package/build/src/rules/dangerous_statement.js +1 -1
- package/build/src/rules/definitions_top.js +6 -6
- package/build/src/rules/downport.js +83 -83
- package/build/src/rules/easy_to_find_messages.js +6 -6
- package/build/src/rules/empty_event.js +6 -6
- package/build/src/rules/empty_line_in_statement.js +2 -2
- package/build/src/rules/empty_structure.js +6 -6
- package/build/src/rules/exit_or_check.js +3 -3
- package/build/src/rules/expand_macros.js +5 -5
- package/build/src/rules/exporting.js +1 -1
- package/build/src/rules/forbidden_identifier.js +1 -1
- package/build/src/rules/forbidden_void_type.js +2 -2
- package/build/src/rules/fully_type_itabs.js +2 -2
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +10 -10
- package/build/src/rules/identical_conditions.js +12 -12
- package/build/src/rules/identical_contents.js +14 -14
- package/build/src/rules/identical_descriptions.js +6 -6
- package/build/src/rules/identical_move.js +2 -2
- package/build/src/rules/if_in_if.js +35 -35
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/implicit_start_of_selection.js +4 -4
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/indentation.js +16 -16
- package/build/src/rules/intf_referencing_clas.js +3 -3
- package/build/src/rules/invalid_table_index.js +2 -2
- package/build/src/rules/line_break_style.js +2 -2
- package/build/src/rules/line_length.js +1 -1
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_variable_names.js +6 -6
- package/build/src/rules/macro_naming.js +2 -2
- package/build/src/rules/main_file_contents.js +4 -4
- package/build/src/rules/many_parentheses.js +10 -10
- package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
- package/build/src/rules/max_one_statement.js +5 -5
- package/build/src/rules/method_length.js +2 -2
- package/build/src/rules/method_overwrites_builtin.js +12 -12
- package/build/src/rules/mix_returning.js +8 -8
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_external_form_calls.js +2 -2
- package/build/src/rules/no_inline_in_optional_branches.js +11 -11
- package/build/src/rules/no_prefixes.js +6 -6
- package/build/src/rules/no_public_attributes.js +1 -1
- package/build/src/rules/no_yoda_conditions.js +4 -4
- package/build/src/rules/nrob_consistency.js +2 -2
- package/build/src/rules/obsolete_statement.js +51 -51
- package/build/src/rules/omit_parameter_name.js +3 -3
- package/build/src/rules/omit_receiving.js +13 -13
- package/build/src/rules/parser_702_chaining.js +2 -2
- package/build/src/rules/parser_error.js +2 -2
- package/build/src/rules/parser_missing_space.js +1 -1
- package/build/src/rules/prefer_inline.js +16 -16
- package/build/src/rules/prefer_is_not.js +9 -9
- package/build/src/rules/prefer_raise_exception_new.js +5 -5
- package/build/src/rules/prefer_returning_to_exporting.js +4 -4
- package/build/src/rules/prefer_xsdbool.js +2 -2
- package/build/src/rules/preferred_compare_operator.js +2 -2
- package/build/src/rules/reduce_procedural_code.js +17 -17
- package/build/src/rules/remove_descriptions.js +4 -4
- package/build/src/rules/rfc_error_handling.js +7 -7
- package/build/src/rules/select_add_order_by.js +5 -5
- package/build/src/rules/select_performance.js +5 -5
- package/build/src/rules/select_single_full_key.js +2 -2
- package/build/src/rules/sicf_consistency.js +2 -2
- package/build/src/rules/slow_parameter_passing.js +16 -16
- package/build/src/rules/space_before_dot.js +2 -2
- package/build/src/rules/sql_value_conversion.js +6 -6
- package/build/src/rules/start_at_tab.js +1 -1
- package/build/src/rules/strict_sql.js +6 -6
- package/build/src/rules/sy_modification.js +6 -6
- package/build/src/rules/tabl_enhancement_category.js +2 -2
- package/build/src/rules/tables_declared_locally.js +2 -2
- package/build/src/rules/type_form_parameters.js +2 -2
- package/build/src/rules/unnecessary_pragma.js +29 -29
- package/build/src/rules/unnecessary_return.js +11 -11
- package/build/src/rules/unused_macros.js +6 -6
- package/build/src/rules/unused_methods.js +12 -12
- package/build/src/rules/unused_variables.js +12 -12
- package/build/src/rules/use_bool_expression.js +8 -8
- package/build/src/rules/use_class_based_exceptions.js +8 -8
- package/build/src/rules/use_line_exists.js +6 -6
- package/build/src/rules/use_new.js +4 -4
- package/build/src/rules/when_others_last.js +6 -6
- package/build/src/rules/xml_consistency.js +3 -3
- package/package.json +70 -70
|
@@ -18,15 +18,15 @@ class CDSAssociationName {
|
|
|
18
18
|
key: "cds_association_name",
|
|
19
19
|
title: "CDS Association Name",
|
|
20
20
|
shortDescription: `CDS association names should start with an underscore`,
|
|
21
|
-
extendedInformation: `By convention, CDS association names must start with an underscore character.
|
|
22
|
-
|
|
21
|
+
extendedInformation: `By convention, CDS association names must start with an underscore character.
|
|
22
|
+
|
|
23
23
|
https://help.sap.com/docs/abap-cloud/abap-data-models/cds-associations`,
|
|
24
24
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Naming],
|
|
25
|
-
badExample: `define view entity test as select from source
|
|
26
|
-
association [1..1] to target as Assoc on Assoc.id = source.id
|
|
25
|
+
badExample: `define view entity test as select from source
|
|
26
|
+
association [1..1] to target as Assoc on Assoc.id = source.id
|
|
27
27
|
{ key id }`,
|
|
28
|
-
goodExample: `define view entity test as select from source
|
|
29
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
28
|
+
goodExample: `define view entity test as select from source
|
|
29
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
30
30
|
{ key id }`,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -19,10 +19,10 @@ class CDSCommentStyle {
|
|
|
19
19
|
key: "cds_comment_style",
|
|
20
20
|
title: "CDS Comment Style",
|
|
21
21
|
shortDescription: `Check for obsolete comment style`,
|
|
22
|
-
extendedInformation: `Check for obsolete comment style
|
|
23
|
-
|
|
24
|
-
Comments starting with "--" are considered obsolete
|
|
25
|
-
|
|
22
|
+
extendedInformation: `Check for obsolete comment style
|
|
23
|
+
|
|
24
|
+
Comments starting with "--" are considered obsolete
|
|
25
|
+
|
|
26
26
|
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_general_syntax_rules.htm`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
28
28
|
badExample: "-- this is a comment",
|
|
@@ -19,19 +19,19 @@ class CDSFieldOrder {
|
|
|
19
19
|
title: "CDS Field Order",
|
|
20
20
|
shortDescription: `Checks that CDS key fields are listed first and associations last in the field list`,
|
|
21
21
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
22
|
-
badExample: `define view entity test as select from source
|
|
23
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
24
|
-
{
|
|
25
|
-
field1,
|
|
26
|
-
key id,
|
|
27
|
-
_Assoc
|
|
22
|
+
badExample: `define view entity test as select from source
|
|
23
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
24
|
+
{
|
|
25
|
+
field1,
|
|
26
|
+
key id,
|
|
27
|
+
_Assoc
|
|
28
28
|
}`,
|
|
29
|
-
goodExample: `define view entity test as select from source
|
|
30
|
-
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
31
|
-
{
|
|
32
|
-
key id,
|
|
33
|
-
field1,
|
|
34
|
-
_Assoc
|
|
29
|
+
goodExample: `define view entity test as select from source
|
|
30
|
+
association [1..1] to target as _Assoc on _Assoc.id = source.id
|
|
31
|
+
{
|
|
32
|
+
key id,
|
|
33
|
+
field1,
|
|
34
|
+
_Assoc
|
|
35
35
|
}`,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -19,10 +19,10 @@ class CDSLegacyView {
|
|
|
19
19
|
key: "cds_legacy_view",
|
|
20
20
|
title: "CDS Legacy View",
|
|
21
21
|
shortDescription: `Identify CDS Legacy Views`,
|
|
22
|
-
extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW
|
|
23
|
-
|
|
24
|
-
https://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/
|
|
25
|
-
|
|
22
|
+
extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW
|
|
23
|
+
|
|
24
|
+
https://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/
|
|
25
|
+
|
|
26
26
|
v755 and up`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport],
|
|
28
28
|
};
|
|
@@ -44,13 +44,13 @@ class CDSNaming {
|
|
|
44
44
|
key: "cds_naming",
|
|
45
45
|
title: "CDS Naming",
|
|
46
46
|
shortDescription: `Checks CDS naming conventions based on the VDM prefix rules`,
|
|
47
|
-
extendedInformation: `Validates that CDS entity names follow the expected prefix conventions:
|
|
48
|
-
I_ for interface views, C_ for consumption views, R_ for restricted reuse views,
|
|
49
|
-
P_ for private views, A_ for remote API views, X_ for view extends,
|
|
50
|
-
E_ for extension include views, F_ for derivation functions, D_ for abstract entities.
|
|
51
|
-
|
|
52
|
-
Names must also start with Z after the prefix (custom namespace).
|
|
53
|
-
|
|
47
|
+
extendedInformation: `Validates that CDS entity names follow the expected prefix conventions:
|
|
48
|
+
I_ for interface views, C_ for consumption views, R_ for restricted reuse views,
|
|
49
|
+
P_ for private views, A_ for remote API views, X_ for view extends,
|
|
50
|
+
E_ for extension include views, F_ for derivation functions, D_ for abstract entities.
|
|
51
|
+
|
|
52
|
+
Names must also start with Z after the prefix (custom namespace).
|
|
53
|
+
|
|
54
54
|
https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8/8a8cee943ef944fe8936f4cc60ba9bc1.html`,
|
|
55
55
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Naming],
|
|
56
56
|
badExample: `define view entity ZMY_VIEW as select from source { key id }`,
|
|
@@ -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.`,
|
|
@@ -29,17 +29,17 @@ class ChangeIfToCase extends _abap_rule_1.ABAPRule {
|
|
|
29
29
|
title: "Change IF to CASE",
|
|
30
30
|
shortDescription: `Finds IF constructs that can be changed to CASE`,
|
|
31
31
|
// eslint-disable-next-line max-len
|
|
32
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions
|
|
33
|
-
|
|
32
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions
|
|
33
|
+
|
|
34
34
|
If the first comparison is a boolean compare, no issue is reported.`,
|
|
35
35
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
36
|
-
badExample: `IF l_fcat-fieldname EQ 'FOO'.
|
|
37
|
-
ELSEIF l_fcat-fieldname = 'BAR'
|
|
38
|
-
OR l_fcat-fieldname = 'MOO'.
|
|
36
|
+
badExample: `IF l_fcat-fieldname EQ 'FOO'.
|
|
37
|
+
ELSEIF l_fcat-fieldname = 'BAR'
|
|
38
|
+
OR l_fcat-fieldname = 'MOO'.
|
|
39
39
|
ENDIF.`,
|
|
40
|
-
goodExample: `CASE l_fcat-fieldname.
|
|
41
|
-
WHEN 'FOO'.
|
|
42
|
-
WHEN 'BAR' OR 'MOO'.
|
|
40
|
+
goodExample: `CASE l_fcat-fieldname.
|
|
41
|
+
WHEN 'FOO'.
|
|
42
|
+
WHEN 'BAR' OR 'MOO'.
|
|
43
43
|
ENDCASE.`,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -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],
|
|
@@ -28,11 +28,11 @@ class CheckComments extends _abap_rule_1.ABAPRule {
|
|
|
28
28
|
return {
|
|
29
29
|
key: "check_comments",
|
|
30
30
|
title: "Check Comments",
|
|
31
|
-
shortDescription: `
|
|
31
|
+
shortDescription: `
|
|
32
32
|
Various checks for comment usage.`,
|
|
33
|
-
extendedInformation: `
|
|
34
|
-
Detects end of line comments. Comments starting with "#EC" or "##" are ignored
|
|
35
|
-
|
|
33
|
+
extendedInformation: `
|
|
34
|
+
Detects end of line comments. Comments starting with "#EC" or "##" are ignored
|
|
35
|
+
|
|
36
36
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,
|
|
37
37
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
38
38
|
badExample: `WRITE 2. " descriptive comment`,
|
|
@@ -23,10 +23,10 @@ class CheckInclude {
|
|
|
23
23
|
key: "check_include",
|
|
24
24
|
title: "Check INCLUDEs",
|
|
25
25
|
shortDescription: `Checks INCLUDE statements`,
|
|
26
|
-
extendedInformation: `
|
|
27
|
-
* Reports unused includes
|
|
28
|
-
* Errors if the includes are not found
|
|
29
|
-
* Error if including a main program
|
|
26
|
+
extendedInformation: `
|
|
27
|
+
* Reports unused includes
|
|
28
|
+
* Errors if the includes are not found
|
|
29
|
+
* Error if including a main program
|
|
30
30
|
* Skips ZX* includes`,
|
|
31
31
|
tags: [_irule_1.RuleTag.Syntax],
|
|
32
32
|
};
|
|
@@ -36,14 +36,14 @@ class CheckSubrc extends _abap_rule_1.ABAPRule {
|
|
|
36
36
|
key: "check_subrc",
|
|
37
37
|
title: "Check sy-subrc",
|
|
38
38
|
shortDescription: `Check sy-subrc`,
|
|
39
|
-
extendedInformation: `Pseudo comment "#EC CI_SUBRC can be added to suppress findings
|
|
40
|
-
|
|
41
|
-
If sy-dbcnt is checked after database statements, it is considered okay.
|
|
42
|
-
|
|
43
|
-
"SELECT SINGLE @abap_true FROM " is considered as an existence check, also "SELECT COUNT( * )" is considered okay
|
|
44
|
-
|
|
45
|
-
If IS ASSIGNED is checked after assigning, it is considered okay.
|
|
46
|
-
|
|
39
|
+
extendedInformation: `Pseudo comment "#EC CI_SUBRC can be added to suppress findings
|
|
40
|
+
|
|
41
|
+
If sy-dbcnt is checked after database statements, it is considered okay.
|
|
42
|
+
|
|
43
|
+
"SELECT SINGLE @abap_true FROM " is considered as an existence check, also "SELECT COUNT( * )" is considered okay
|
|
44
|
+
|
|
45
|
+
If IS ASSIGNED is checked after assigning, it is considered okay.
|
|
46
|
+
|
|
47
47
|
FIND statement with MATCH COUNT is considered okay if subrc is not checked`,
|
|
48
48
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
49
49
|
pseudoComment: "EC CI_SUBRC",
|
|
@@ -21,17 +21,17 @@ class ClassicExceptionsOverlap extends _abap_rule_1.ABAPRule {
|
|
|
21
21
|
shortDescription: `Find overlapping classic exceptions`,
|
|
22
22
|
extendedInformation: `When debugging its typically good to know exactly which exception is caught`,
|
|
23
23
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
|
-
badExample: `CALL FUNCTION 'SOMETHING'
|
|
25
|
-
EXCEPTIONS
|
|
26
|
-
system_failure = 1 MESSAGE lv_message
|
|
27
|
-
communication_failure = 1 MESSAGE lv_message
|
|
28
|
-
resource_failure = 1
|
|
24
|
+
badExample: `CALL FUNCTION 'SOMETHING'
|
|
25
|
+
EXCEPTIONS
|
|
26
|
+
system_failure = 1 MESSAGE lv_message
|
|
27
|
+
communication_failure = 1 MESSAGE lv_message
|
|
28
|
+
resource_failure = 1
|
|
29
29
|
OTHERS = 1.`,
|
|
30
|
-
goodExample: `CALL FUNCTION 'SOMETHING'
|
|
31
|
-
EXCEPTIONS
|
|
32
|
-
system_failure = 1 MESSAGE lv_message
|
|
33
|
-
communication_failure = 2 MESSAGE lv_message
|
|
34
|
-
resource_failure = 3
|
|
30
|
+
goodExample: `CALL FUNCTION 'SOMETHING'
|
|
31
|
+
EXCEPTIONS
|
|
32
|
+
system_failure = 1 MESSAGE lv_message
|
|
33
|
+
communication_failure = 2 MESSAGE lv_message
|
|
34
|
+
resource_failure = 3
|
|
35
35
|
OTHERS = 4.`,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -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
|
badExample: `* WRITE 'hello world'.`,
|
|
@@ -18,10 +18,10 @@ class ConstructorVisibilityPublic {
|
|
|
18
18
|
key: "constructor_visibility_public",
|
|
19
19
|
title: "Check constructor visibility is public",
|
|
20
20
|
shortDescription: `Constructor must be placed in the public section, even if the class is not CREATE PUBLIC.`,
|
|
21
|
-
extendedInformation: `
|
|
22
|
-
This only applies to global classes.
|
|
23
|
-
|
|
24
|
-
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public
|
|
21
|
+
extendedInformation: `
|
|
22
|
+
This only applies to global classes.
|
|
23
|
+
|
|
24
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public
|
|
25
25
|
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,
|
|
26
26
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
27
27
|
};
|
|
@@ -25,8 +25,8 @@ class ContainsTab extends _abap_rule_1.ABAPRule {
|
|
|
25
25
|
key: "contains_tab",
|
|
26
26
|
title: "Code contains tab",
|
|
27
27
|
shortDescription: `Checks for usage of tabs (enable to enforce spaces)`,
|
|
28
|
-
extendedInformation: `
|
|
29
|
-
https://docs.abapopenchecks.org/checks/09/
|
|
28
|
+
extendedInformation: `
|
|
29
|
+
https://docs.abapopenchecks.org/checks/09/
|
|
30
30
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,
|
|
31
31
|
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
32
32
|
badExample: `\tWRITE 'hello world'.`,
|
|
@@ -32,10 +32,10 @@ class CyclicOO {
|
|
|
32
32
|
key: "cyclic_oo",
|
|
33
33
|
title: "Cyclic OO",
|
|
34
34
|
shortDescription: `Finds cyclic/circular OO references`,
|
|
35
|
-
extendedInformation: `Runs for global INTF + CLAS objects
|
|
36
|
-
|
|
37
|
-
Objects must be without syntax errors for this rule to take effect
|
|
38
|
-
|
|
35
|
+
extendedInformation: `Runs for global INTF + CLAS objects
|
|
36
|
+
|
|
37
|
+
Objects must be without syntax errors for this rule to take effect
|
|
38
|
+
|
|
39
39
|
References in testclass includes are ignored`,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -41,7 +41,7 @@ class DangerousStatement extends _abap_rule_1.ABAPRule {
|
|
|
41
41
|
key: "dangerous_statement",
|
|
42
42
|
title: "Dangerous statement",
|
|
43
43
|
shortDescription: `Detects potentially dangerous statements`,
|
|
44
|
-
extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,
|
|
44
|
+
extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,
|
|
45
45
|
dynamic SQL can potentially create SQL injection problems`,
|
|
46
46
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
47
47
|
};
|
|
@@ -30,13 +30,13 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
30
30
|
shortDescription: `Checks that definitions are placed at the beginning of METHODs, FORMs and FUNCTIONs.`,
|
|
31
31
|
extendedInformation: `https://docs.abapopenchecks.org/checks/17/`,
|
|
32
32
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
33
|
-
badExample: `FORM foo.
|
|
34
|
-
WRITE 'hello'.
|
|
35
|
-
DATA int TYPE i.
|
|
33
|
+
badExample: `FORM foo.
|
|
34
|
+
WRITE 'hello'.
|
|
35
|
+
DATA int TYPE i.
|
|
36
36
|
ENDFORM.`,
|
|
37
|
-
goodExample: `FORM foo.
|
|
38
|
-
DATA int TYPE i.
|
|
39
|
-
WRITE 'hello'.
|
|
37
|
+
goodExample: `FORM foo.
|
|
38
|
+
DATA int TYPE i.
|
|
39
|
+
WRITE 'hello'.
|
|
40
40
|
ENDFORM.`,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -125,39 +125,39 @@ class Downport {
|
|
|
125
125
|
key: "downport",
|
|
126
126
|
title: "Downport statement",
|
|
127
127
|
shortDescription: `Downport functionality`,
|
|
128
|
-
extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with
|
|
129
|
-
a higher level language version. If successful, various rules are applied to downport the statement.
|
|
130
|
-
Target downport version is always v702, thus rule is only enabled if target version is v702.
|
|
131
|
-
|
|
132
|
-
Current rules:
|
|
133
|
-
* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/
|
|
134
|
-
* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/
|
|
135
|
-
* FIELD-SYMBOL() definitions are outlined
|
|
136
|
-
* CONV is outlined
|
|
137
|
-
* COND is outlined
|
|
138
|
-
* REDUCE is outlined
|
|
139
|
-
* SWITCH is outlined
|
|
140
|
-
* FILTER is outlined
|
|
141
|
-
* APPEND expression is outlined
|
|
142
|
-
* INSERT expression is outlined
|
|
143
|
-
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
144
|
-
* CAST changed to ?=
|
|
145
|
-
* LOOP AT method_call( ) is outlined
|
|
146
|
-
* VALUE # with structure fields
|
|
147
|
-
* VALUE # with internal table lines
|
|
148
|
-
* Table Expressions are outlined
|
|
149
|
-
* SELECT INTO @DATA definitions are outlined
|
|
150
|
-
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
151
|
-
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
152
|
-
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
153
|
-
* RAISE EXCEPTION ... MESSAGE
|
|
154
|
-
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
155
|
-
* line_exists and line_index is downported to READ TABLE
|
|
156
|
-
* ENUMs, but does not nessesarily give the correct type and value
|
|
157
|
-
* MESSAGE with non simple source
|
|
158
|
-
|
|
159
|
-
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.
|
|
160
|
-
|
|
128
|
+
extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with
|
|
129
|
+
a higher level language version. If successful, various rules are applied to downport the statement.
|
|
130
|
+
Target downport version is always v702, thus rule is only enabled if target version is v702.
|
|
131
|
+
|
|
132
|
+
Current rules:
|
|
133
|
+
* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/
|
|
134
|
+
* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/
|
|
135
|
+
* FIELD-SYMBOL() definitions are outlined
|
|
136
|
+
* CONV is outlined
|
|
137
|
+
* COND is outlined
|
|
138
|
+
* REDUCE is outlined
|
|
139
|
+
* SWITCH is outlined
|
|
140
|
+
* FILTER is outlined
|
|
141
|
+
* APPEND expression is outlined
|
|
142
|
+
* INSERT expression is outlined
|
|
143
|
+
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
144
|
+
* CAST changed to ?=
|
|
145
|
+
* LOOP AT method_call( ) is outlined
|
|
146
|
+
* VALUE # with structure fields
|
|
147
|
+
* VALUE # with internal table lines
|
|
148
|
+
* Table Expressions are outlined
|
|
149
|
+
* SELECT INTO @DATA definitions are outlined
|
|
150
|
+
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
151
|
+
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
152
|
+
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
153
|
+
* RAISE EXCEPTION ... MESSAGE
|
|
154
|
+
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
155
|
+
* line_exists and line_index is downported to READ TABLE
|
|
156
|
+
* ENUMs, but does not nessesarily give the correct type and value
|
|
157
|
+
* MESSAGE with non simple source
|
|
158
|
+
|
|
159
|
+
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.
|
|
160
|
+
|
|
161
161
|
Make sure to test the downported code, it might not always be completely correct.`,
|
|
162
162
|
tags: [_irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
|
|
163
163
|
};
|
|
@@ -772,10 +772,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
772
772
|
const fieldName = f.concatTokens();
|
|
773
773
|
fieldDefinition += indentation + " " + fieldName + " TYPE " + tableName + "-" + fieldName + ",\n";
|
|
774
774
|
}
|
|
775
|
-
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
775
|
+
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
776
776
|
${fieldDefinition}${indentation} END OF ${name}.`;
|
|
777
777
|
}
|
|
778
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
778
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
779
779
|
${indentation}`);
|
|
780
780
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
781
781
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -834,12 +834,12 @@ ${indentation}`);
|
|
|
834
834
|
}
|
|
835
835
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
836
836
|
const name = ((_g = inlineData.findFirstExpression(Expressions.TargetField)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "error";
|
|
837
|
-
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
838
|
-
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
839
|
-
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
837
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
838
|
+
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
839
|
+
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
840
840
|
${indentation}`);
|
|
841
841
|
if (fieldDefinitions === "") {
|
|
842
|
-
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
842
|
+
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
843
843
|
${indentation}`);
|
|
844
844
|
}
|
|
845
845
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
@@ -907,7 +907,7 @@ ${indentation}`);
|
|
|
907
907
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
908
908
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
909
909
|
const firstToken = high.getFirstToken();
|
|
910
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
910
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
911
911
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
912
912
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
913
913
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -963,7 +963,7 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
963
963
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
964
964
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
965
965
|
const firstToken = high.getFirstToken();
|
|
966
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
966
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
967
967
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
968
968
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
969
969
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1005,14 +1005,14 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
1005
1005
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1006
1006
|
const firstToken = high.getFirstToken();
|
|
1007
1007
|
// note that the tabix restore should be done before throwing the exception
|
|
1008
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
1009
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1010
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1011
|
-
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
1012
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1013
|
-
${indentation}IF sy-subrc <> 0.
|
|
1014
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1015
|
-
${indentation}ENDIF.
|
|
1008
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
1009
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1010
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1011
|
+
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
1012
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1013
|
+
${indentation}IF sy-subrc <> 0.
|
|
1014
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1015
|
+
${indentation}ENDIF.
|
|
1016
1016
|
${indentation}`);
|
|
1017
1017
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
|
|
1018
1018
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1072,7 +1072,7 @@ ${indentation}`);
|
|
|
1072
1072
|
const className = classNames[0].concatTokens();
|
|
1073
1073
|
const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1074
1074
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1075
|
-
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1075
|
+
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1076
1076
|
${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
1077
1077
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
1078
1078
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -1240,17 +1240,17 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
1240
1240
|
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1241
1241
|
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1242
1242
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1243
|
-
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1244
|
-
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1243
|
+
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1244
|
+
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1245
1245
|
${indentation}${uniqueName1}-msgno = ${number}.\n`;
|
|
1246
1246
|
if (withs.length > 0) {
|
|
1247
|
-
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1248
|
-
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1249
|
-
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1247
|
+
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1248
|
+
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1249
|
+
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1250
1250
|
${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
|
|
1251
1251
|
}
|
|
1252
|
-
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1253
|
-
${indentation}CREATE OBJECT ${uniqueName2}.
|
|
1252
|
+
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1253
|
+
${indentation}CREATE OBJECT ${uniqueName2}.
|
|
1254
1254
|
${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
|
|
1255
1255
|
if (withs.length > 0) {
|
|
1256
1256
|
abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
|
|
@@ -1363,10 +1363,10 @@ ${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
|
|
|
1363
1363
|
let code = "";
|
|
1364
1364
|
if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
|
|
1365
1365
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1366
|
-
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1367
|
-
IF sy-subrc <> 0.
|
|
1368
|
-
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1369
|
-
ENDIF.
|
|
1366
|
+
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1367
|
+
IF sy-subrc <> 0.
|
|
1368
|
+
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1369
|
+
ENDIF.
|
|
1370
1370
|
GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
1371
1371
|
}
|
|
1372
1372
|
else {
|
|
@@ -1455,20 +1455,20 @@ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
|
1455
1455
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1456
1456
|
const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1457
1457
|
const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1458
|
-
code += ` items LIKE ${loopSourceName},
|
|
1459
|
-
END OF ${groupTargetName}type.
|
|
1460
|
-
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1461
|
-
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1458
|
+
code += ` items LIKE ${loopSourceName},
|
|
1459
|
+
END OF ${groupTargetName}type.
|
|
1460
|
+
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1461
|
+
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1462
1462
|
LOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\n`;
|
|
1463
1463
|
if (groupIndexName !== undefined) {
|
|
1464
1464
|
code += `DATA(${uniqueNameIndex}) = sy-tabix.\n`;
|
|
1465
1465
|
}
|
|
1466
|
-
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1466
|
+
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1467
1467
|
IF sy-subrc = 0.\n`;
|
|
1468
1468
|
if (groupCountName !== undefined) {
|
|
1469
1469
|
code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\n`;
|
|
1470
1470
|
}
|
|
1471
|
-
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1471
|
+
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1472
1472
|
ELSE.\n`;
|
|
1473
1473
|
code += ` CLEAR ${uniqueName}.\n`;
|
|
1474
1474
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
@@ -1489,8 +1489,8 @@ ELSE.\n`;
|
|
|
1489
1489
|
}
|
|
1490
1490
|
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE ${uniqueName}-items.\n`;
|
|
1491
1491
|
code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\n`;
|
|
1492
|
-
code += `ENDIF.
|
|
1493
|
-
ENDLOOP.
|
|
1492
|
+
code += `ENDIF.
|
|
1493
|
+
ENDLOOP.
|
|
1494
1494
|
LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
1495
1495
|
let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1496
1496
|
for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {
|
|
@@ -1662,7 +1662,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1662
1662
|
const enumName = (_b = high.findExpressionAfterToken("ENUM")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1663
1663
|
const structureName = (_c = high.findExpressionAfterToken("STRUCTURE")) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
1664
1664
|
// all ENUMS are char like?
|
|
1665
|
-
let code = `TYPES ${enumName} TYPE string.
|
|
1665
|
+
let code = `TYPES ${enumName} TYPE string.
|
|
1666
1666
|
CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
1667
1667
|
let count = 1;
|
|
1668
1668
|
for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {
|
|
@@ -1706,14 +1706,14 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
1706
1706
|
const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1707
1707
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1708
1708
|
// restore tabix before exeption
|
|
1709
|
-
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1710
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1711
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1712
|
-
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1713
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1714
|
-
${indentation}IF sy-subrc <> 0.
|
|
1715
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1716
|
-
${indentation}ENDIF.
|
|
1709
|
+
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1710
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1711
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1712
|
+
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1713
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1714
|
+
${indentation}IF sy-subrc <> 0.
|
|
1715
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1716
|
+
${indentation}ENDIF.
|
|
1717
1717
|
${indentation}${uniqueName}`;
|
|
1718
1718
|
const start = target.getFirstToken().getStart();
|
|
1719
1719
|
const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
|
|
@@ -1793,11 +1793,11 @@ ${indentation}${uniqueName}`;
|
|
|
1793
1793
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1794
1794
|
const source = (_b = child.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1795
1795
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1796
|
-
const code = `DATA ${uniqueName} TYPE string.
|
|
1797
|
-
${indentation}CALL FUNCTION '${functionName}'
|
|
1798
|
-
${indentation} EXPORTING
|
|
1799
|
-
${indentation} input = ${source}
|
|
1800
|
-
${indentation} IMPORTING
|
|
1796
|
+
const code = `DATA ${uniqueName} TYPE string.
|
|
1797
|
+
${indentation}CALL FUNCTION '${functionName}'
|
|
1798
|
+
${indentation} EXPORTING
|
|
1799
|
+
${indentation} input = ${source}
|
|
1800
|
+
${indentation} IMPORTING
|
|
1801
1801
|
${indentation} output = ${uniqueName}.\n`;
|
|
1802
1802
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1803
1803
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);
|
|
@@ -19,12 +19,12 @@ class EasyToFindMessages {
|
|
|
19
19
|
key: "easy_to_find_messages",
|
|
20
20
|
title: "Easy to find messages",
|
|
21
21
|
shortDescription: `Make messages easy to find`,
|
|
22
|
-
extendedInformation: `All messages must be statically referenced exactly once
|
|
23
|
-
|
|
24
|
-
Only MESSAGE and RAISE statments are counted as static references
|
|
25
|
-
|
|
26
|
-
Also see rule "message_exists"
|
|
27
|
-
|
|
22
|
+
extendedInformation: `All messages must be statically referenced exactly once
|
|
23
|
+
|
|
24
|
+
Only MESSAGE and RAISE statments are counted as static references
|
|
25
|
+
|
|
26
|
+
Also see rule "message_exists"
|
|
27
|
+
|
|
28
28
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#make-messages-easy-to-find`,
|
|
29
29
|
tags: [_irule_1.RuleTag.Styleguide],
|
|
30
30
|
};
|