@abaplint/core 2.120.0 → 2.120.1
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/src/cds/expressions/cds_define_abstract.js +1 -1
- package/build/src/cds/expressions/cds_define_custom.js +1 -1
- package/build/src/cds/expressions/cds_define_external_entity.js +1 -1
- package/build/src/cds/expressions/cds_define_hierarchy.js +1 -1
- package/build/src/cds/expressions/cds_define_projection.js +1 -1
- package/build/src/cds/expressions/cds_define_table_entity.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/class_attribute_names.js +6 -6
- package/build/src/rules/classic_exceptions_overlap.js +10 -10
- package/build/src/rules/clear_exporting_parameters.js +254 -0
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +10 -10
- 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/db_operation_in_loop.js +9 -9
- 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 +7 -7
- 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/form_tables_obsolete.js +2 -2
- package/build/src/rules/fully_type_itabs.js +2 -2
- package/build/src/rules/function_module_recommendations.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/index.js +1 -0
- 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 +2 -2
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_class_naming.js +2 -2
- 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/method_parameter_names.js +4 -4
- package/build/src/rules/mix_returning.js +8 -8
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_aliases.js +5 -5
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_comments_between_methods.js +12 -12
- 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_macros.js +4 -4
- package/build/src/rules/no_prefixes.js +6 -6
- package/build/src/rules/no_public_attributes.js +7 -7
- 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/prefix_is_current_class.js +6 -6
- package/build/src/rules/reduce_procedural_code.js +17 -17
- package/build/src/rules/redundant_conversion.js +2 -2
- 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/selection_screen_texts_missing.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/static_call_via_instance.js +4 -4
- 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 +72 -72
|
@@ -158,39 +158,39 @@ class Downport {
|
|
|
158
158
|
key: "downport",
|
|
159
159
|
title: "Downport statement",
|
|
160
160
|
shortDescription: `Downport functionality`,
|
|
161
|
-
extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with
|
|
162
|
-
a higher level language version. If successful, various rules are applied to downport the statement.
|
|
163
|
-
Target downport version is always v702, thus rule is only enabled if target version is v702.
|
|
164
|
-
|
|
165
|
-
Current rules:
|
|
166
|
-
* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/
|
|
167
|
-
* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/
|
|
168
|
-
* FIELD-SYMBOL() definitions are outlined
|
|
169
|
-
* CONV is outlined
|
|
170
|
-
* COND is outlined
|
|
171
|
-
* REDUCE is outlined
|
|
172
|
-
* SWITCH is outlined
|
|
173
|
-
* FILTER is outlined
|
|
174
|
-
* APPEND expression is outlined
|
|
175
|
-
* INSERT expression is outlined
|
|
176
|
-
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
177
|
-
* CAST changed to ?=
|
|
178
|
-
* LOOP AT method_call( ) is outlined
|
|
179
|
-
* VALUE # with structure fields
|
|
180
|
-
* VALUE # with internal table lines
|
|
181
|
-
* Table Expressions are outlined
|
|
182
|
-
* SELECT INTO @DATA definitions are outlined
|
|
183
|
-
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
184
|
-
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
185
|
-
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
186
|
-
* RAISE EXCEPTION ... MESSAGE
|
|
187
|
-
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
188
|
-
* line_exists and line_index is downported to READ TABLE
|
|
189
|
-
* ENUMs, but does not nessesarily give the correct type and value
|
|
190
|
-
* MESSAGE with non simple source
|
|
191
|
-
|
|
192
|
-
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.
|
|
193
|
-
|
|
161
|
+
extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with
|
|
162
|
+
a higher level language version. If successful, various rules are applied to downport the statement.
|
|
163
|
+
Target downport version is always v702, thus rule is only enabled if target version is v702.
|
|
164
|
+
|
|
165
|
+
Current rules:
|
|
166
|
+
* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/
|
|
167
|
+
* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/
|
|
168
|
+
* FIELD-SYMBOL() definitions are outlined
|
|
169
|
+
* CONV is outlined
|
|
170
|
+
* COND is outlined
|
|
171
|
+
* REDUCE is outlined
|
|
172
|
+
* SWITCH is outlined
|
|
173
|
+
* FILTER is outlined
|
|
174
|
+
* APPEND expression is outlined
|
|
175
|
+
* INSERT expression is outlined
|
|
176
|
+
* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/
|
|
177
|
+
* CAST changed to ?=
|
|
178
|
+
* LOOP AT method_call( ) is outlined
|
|
179
|
+
* VALUE # with structure fields
|
|
180
|
+
* VALUE # with internal table lines
|
|
181
|
+
* Table Expressions are outlined
|
|
182
|
+
* SELECT INTO @DATA definitions are outlined
|
|
183
|
+
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
184
|
+
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
185
|
+
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
186
|
+
* RAISE EXCEPTION ... MESSAGE
|
|
187
|
+
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
188
|
+
* line_exists and line_index is downported to READ TABLE
|
|
189
|
+
* ENUMs, but does not nessesarily give the correct type and value
|
|
190
|
+
* MESSAGE with non simple source
|
|
191
|
+
|
|
192
|
+
Only one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.
|
|
193
|
+
|
|
194
194
|
Make sure to test the downported code, it might not always be completely correct.`,
|
|
195
195
|
tags: [_irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],
|
|
196
196
|
};
|
|
@@ -826,10 +826,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
826
826
|
const fieldName = f.concatTokens();
|
|
827
827
|
fieldDefinition += indentation + " " + fieldName + " TYPE " + tableName + "-" + fieldName + ",\n";
|
|
828
828
|
}
|
|
829
|
-
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
829
|
+
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
830
830
|
${fieldDefinition}${indentation} END OF ${name}.`;
|
|
831
831
|
}
|
|
832
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
832
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
833
833
|
${indentation}`);
|
|
834
834
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
835
835
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -888,12 +888,12 @@ ${indentation}`);
|
|
|
888
888
|
}
|
|
889
889
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
890
890
|
const name = ((_g = inlineData.findFirstExpression(Expressions.TargetField)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "error";
|
|
891
|
-
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
892
|
-
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
893
|
-
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
891
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
892
|
+
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
893
|
+
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
894
894
|
${indentation}`);
|
|
895
895
|
if (fieldDefinitions === "") {
|
|
896
|
-
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
896
|
+
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
897
897
|
${indentation}`);
|
|
898
898
|
}
|
|
899
899
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
@@ -961,7 +961,7 @@ ${indentation}`);
|
|
|
961
961
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
962
962
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
963
963
|
const firstToken = high.getFirstToken();
|
|
964
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
964
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
965
965
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
966
966
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
967
967
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1017,7 +1017,7 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
1017
1017
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1018
1018
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1019
1019
|
const firstToken = high.getFirstToken();
|
|
1020
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
1020
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
1021
1021
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
1022
1022
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
1023
1023
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1059,14 +1059,14 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
1059
1059
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1060
1060
|
const firstToken = high.getFirstToken();
|
|
1061
1061
|
// note that the tabix restore should be done before throwing the exception
|
|
1062
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
1063
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1064
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1065
|
-
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
1066
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1067
|
-
${indentation}IF sy-subrc <> 0.
|
|
1068
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1069
|
-
${indentation}ENDIF.
|
|
1062
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
1063
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1064
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1065
|
+
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
1066
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1067
|
+
${indentation}IF sy-subrc <> 0.
|
|
1068
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1069
|
+
${indentation}ENDIF.
|
|
1070
1070
|
${indentation}`);
|
|
1071
1071
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
|
|
1072
1072
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1126,7 +1126,7 @@ ${indentation}`);
|
|
|
1126
1126
|
const className = classNames[0].concatTokens();
|
|
1127
1127
|
const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1128
1128
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1129
|
-
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1129
|
+
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1130
1130
|
${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
1131
1131
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
1132
1132
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -1294,17 +1294,17 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
1294
1294
|
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1295
1295
|
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1296
1296
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1297
|
-
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1298
|
-
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1297
|
+
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1298
|
+
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1299
1299
|
${indentation}${uniqueName1}-msgno = ${number}.\n`;
|
|
1300
1300
|
if (withs.length > 0) {
|
|
1301
|
-
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1302
|
-
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1303
|
-
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1301
|
+
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1302
|
+
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1303
|
+
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1304
1304
|
${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
|
|
1305
1305
|
}
|
|
1306
|
-
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1307
|
-
${indentation}CREATE OBJECT ${uniqueName2}.
|
|
1306
|
+
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1307
|
+
${indentation}CREATE OBJECT ${uniqueName2}.
|
|
1308
1308
|
${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
|
|
1309
1309
|
if (withs.length > 0) {
|
|
1310
1310
|
abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
|
|
@@ -1417,10 +1417,10 @@ ${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
|
|
|
1417
1417
|
let code = "";
|
|
1418
1418
|
if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
|
|
1419
1419
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1420
|
-
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1421
|
-
IF sy-subrc <> 0.
|
|
1422
|
-
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1423
|
-
ENDIF.
|
|
1420
|
+
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1421
|
+
IF sy-subrc <> 0.
|
|
1422
|
+
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1423
|
+
ENDIF.
|
|
1424
1424
|
GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
1425
1425
|
}
|
|
1426
1426
|
else {
|
|
@@ -1509,20 +1509,20 @@ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
|
1509
1509
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1510
1510
|
const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1511
1511
|
const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1512
|
-
code += ` items LIKE ${loopSourceName},
|
|
1513
|
-
END OF ${groupTargetName}type.
|
|
1514
|
-
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1515
|
-
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1512
|
+
code += ` items LIKE ${loopSourceName},
|
|
1513
|
+
END OF ${groupTargetName}type.
|
|
1514
|
+
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1515
|
+
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1516
1516
|
LOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\n`;
|
|
1517
1517
|
if (groupIndexName !== undefined) {
|
|
1518
1518
|
code += `DATA(${uniqueNameIndex}) = sy-tabix.\n`;
|
|
1519
1519
|
}
|
|
1520
|
-
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1520
|
+
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1521
1521
|
IF sy-subrc = 0.\n`;
|
|
1522
1522
|
if (groupCountName !== undefined) {
|
|
1523
1523
|
code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\n`;
|
|
1524
1524
|
}
|
|
1525
|
-
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1525
|
+
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1526
1526
|
ELSE.\n`;
|
|
1527
1527
|
code += ` CLEAR ${uniqueName}.\n`;
|
|
1528
1528
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
@@ -1543,8 +1543,8 @@ ELSE.\n`;
|
|
|
1543
1543
|
}
|
|
1544
1544
|
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE ${uniqueName}-items.\n`;
|
|
1545
1545
|
code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\n`;
|
|
1546
|
-
code += `ENDIF.
|
|
1547
|
-
ENDLOOP.
|
|
1546
|
+
code += `ENDIF.
|
|
1547
|
+
ENDLOOP.
|
|
1548
1548
|
LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
1549
1549
|
let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1550
1550
|
for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {
|
|
@@ -1716,7 +1716,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1716
1716
|
const enumName = (_b = high.findExpressionAfterToken("ENUM")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1717
1717
|
const structureName = (_c = high.findExpressionAfterToken("STRUCTURE")) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
1718
1718
|
// all ENUMS are char like?
|
|
1719
|
-
let code = `TYPES ${enumName} TYPE string.
|
|
1719
|
+
let code = `TYPES ${enumName} TYPE string.
|
|
1720
1720
|
CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
1721
1721
|
let count = 1;
|
|
1722
1722
|
for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {
|
|
@@ -1760,14 +1760,14 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
1760
1760
|
const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1761
1761
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1762
1762
|
// restore tabix before exeption
|
|
1763
|
-
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1764
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1765
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1766
|
-
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1767
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1768
|
-
${indentation}IF sy-subrc <> 0.
|
|
1769
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1770
|
-
${indentation}ENDIF.
|
|
1763
|
+
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1764
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1765
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1766
|
+
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1767
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1768
|
+
${indentation}IF sy-subrc <> 0.
|
|
1769
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1770
|
+
${indentation}ENDIF.
|
|
1771
1771
|
${indentation}${uniqueName}`;
|
|
1772
1772
|
const start = target.getFirstToken().getStart();
|
|
1773
1773
|
const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
|
|
@@ -1847,11 +1847,11 @@ ${indentation}${uniqueName}`;
|
|
|
1847
1847
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1848
1848
|
const source = (_b = child.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1849
1849
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1850
|
-
const code = `DATA ${uniqueName} TYPE string.
|
|
1851
|
-
${indentation}CALL FUNCTION '${functionName}'
|
|
1852
|
-
${indentation} EXPORTING
|
|
1853
|
-
${indentation} input = ${source}
|
|
1854
|
-
${indentation} IMPORTING
|
|
1850
|
+
const code = `DATA ${uniqueName} TYPE string.
|
|
1851
|
+
${indentation}CALL FUNCTION '${functionName}'
|
|
1852
|
+
${indentation} EXPORTING
|
|
1853
|
+
${indentation} input = ${source}
|
|
1854
|
+
${indentation} IMPORTING
|
|
1855
1855
|
${indentation} output = ${uniqueName}.\n`;
|
|
1856
1856
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1857
1857
|
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
|
};
|
|
@@ -56,13 +56,13 @@ class EmptyEvent extends _abap_rule_1.ABAPRule {
|
|
|
56
56
|
shortDescription: `Empty selection screen or list processing event block`,
|
|
57
57
|
extendedInformation: ``,
|
|
58
58
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
59
|
-
badExample: `
|
|
60
|
-
INITIALIZATION.
|
|
61
|
-
WRITE 'hello'.
|
|
59
|
+
badExample: `
|
|
60
|
+
INITIALIZATION.
|
|
61
|
+
WRITE 'hello'.
|
|
62
62
|
END-OF-SELECTION.`,
|
|
63
|
-
goodExample: `
|
|
64
|
-
START-OF-SELECTION.
|
|
65
|
-
PERFORM sdf.
|
|
63
|
+
goodExample: `
|
|
64
|
+
START-OF-SELECTION.
|
|
65
|
+
PERFORM sdf.
|
|
66
66
|
COMMIT WORK.`,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
@@ -27,8 +27,8 @@ class EmptyLineinStatement extends _abap_rule_1.ABAPRule {
|
|
|
27
27
|
key: "empty_line_in_statement",
|
|
28
28
|
title: "Find empty lines in statements",
|
|
29
29
|
shortDescription: `Checks that statements do not contain empty lines.`,
|
|
30
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-obsess-with-separating-blank-lines
|
|
31
|
-
|
|
30
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-obsess-with-separating-blank-lines
|
|
31
|
+
|
|
32
32
|
https://docs.abapopenchecks.org/checks/41/`,
|
|
33
33
|
tags: [_irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
34
34
|
badExample: `WRITE\n\nhello.`,
|
|
@@ -79,13 +79,13 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
|
|
|
79
79
|
shortDescription: `Checks that the code does not contain empty blocks.`,
|
|
80
80
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-empty-if-branches`,
|
|
81
81
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
82
|
-
badExample: `IF foo = bar.
|
|
83
|
-
ENDIF.
|
|
84
|
-
|
|
85
|
-
DO 2 TIMES.
|
|
82
|
+
badExample: `IF foo = bar.
|
|
83
|
+
ENDIF.
|
|
84
|
+
|
|
85
|
+
DO 2 TIMES.
|
|
86
86
|
ENDDO.`,
|
|
87
|
-
goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
|
|
88
|
-
ENDLOOP.
|
|
87
|
+
goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
|
|
88
|
+
ENDLOOP.
|
|
89
89
|
result = xsdbool( sy-subrc = 0 ).`,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
@@ -57,17 +57,17 @@ class ExitOrCheck extends _abap_rule_1.ABAPRule {
|
|
|
57
57
|
return {
|
|
58
58
|
key: "exit_or_check",
|
|
59
59
|
title: "Find EXIT or CHECK outside loops",
|
|
60
|
-
shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
|
|
60
|
+
shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
|
|
61
61
|
Use RETURN to leave procesing blocks instead.`,
|
|
62
|
-
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
63
|
-
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
62
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
63
|
+
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
64
64
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,
|
|
65
65
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
66
|
-
badExample: `CHECK is_valid = abap_true.
|
|
66
|
+
badExample: `CHECK is_valid = abap_true.
|
|
67
67
|
do_something( ).`,
|
|
68
|
-
goodExample: `IF is_valid = abap_false.
|
|
69
|
-
RETURN.
|
|
70
|
-
ENDIF.
|
|
68
|
+
goodExample: `IF is_valid = abap_false.
|
|
69
|
+
RETURN.
|
|
70
|
+
ENDIF.
|
|
71
71
|
do_something( ).`,
|
|
72
72
|
};
|
|
73
73
|
}
|
|
@@ -21,12 +21,12 @@ class ExpandMacros extends _abap_rule_1.ABAPRule {
|
|
|
21
21
|
key: "expand_macros",
|
|
22
22
|
title: "Expand Macros",
|
|
23
23
|
shortDescription: `Allows expanding macro calls with quick fixes`,
|
|
24
|
-
extendedInformation: `Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
25
|
-
|
|
24
|
+
extendedInformation: `Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
25
|
+
|
|
26
26
|
Note that macros/DEFINE cannot be used in the ABAP Cloud programming model`,
|
|
27
|
-
badExample: `DEFINE _hello.
|
|
28
|
-
WRITE 'hello'.
|
|
29
|
-
END-OF-DEFINITION.
|
|
27
|
+
badExample: `DEFINE _hello.
|
|
28
|
+
WRITE 'hello'.
|
|
29
|
+
END-OF-DEFINITION.
|
|
30
30
|
_hello.`,
|
|
31
31
|
goodExample: `WRITE 'hello'.`,
|
|
32
32
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Upport],
|
|
@@ -22,7 +22,7 @@ class Exporting extends _abap_rule_1.ABAPRule {
|
|
|
22
22
|
shortDescription: `Detects EXPORTING statements which can be omitted.`,
|
|
23
23
|
badExample: `call_method( EXPORTING foo = bar ).`,
|
|
24
24
|
goodExample: `call_method( foo = bar ).`,
|
|
25
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting
|
|
25
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting
|
|
26
26
|
https://docs.abapopenchecks.org/checks/30/`,
|
|
27
27
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
28
28
|
};
|
|
@@ -26,7 +26,7 @@ class ForbiddenIdentifier extends _abap_rule_1.ABAPRule {
|
|
|
26
26
|
key: "forbidden_identifier",
|
|
27
27
|
title: "Forbidden Identifier",
|
|
28
28
|
shortDescription: `Forbid use of specified identifiers, list of regex.`,
|
|
29
|
-
extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,
|
|
29
|
+
extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,
|
|
30
30
|
https://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530220e/packages/transpiler/src/validation.ts#L44`,
|
|
31
31
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
32
32
|
};
|
|
@@ -28,8 +28,8 @@ class ForbiddenVoidType {
|
|
|
28
28
|
key: "forbidden_void_type",
|
|
29
29
|
title: "Forbidden Void Types",
|
|
30
30
|
shortDescription: `Avoid usage of specified void types.`,
|
|
31
|
-
extendedInformation: `Inspiration:
|
|
32
|
-
BOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,
|
|
31
|
+
extendedInformation: `Inspiration:
|
|
32
|
+
BOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,
|
|
33
33
|
DATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFELD`,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -55,9 +55,9 @@ class FormTablesObsolete extends _abap_rule_1.ABAPRule {
|
|
|
55
55
|
shortDescription: `Checks for TABLES parameters in forms.`,
|
|
56
56
|
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapform_tables.htm`,
|
|
57
57
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
58
|
-
badExample: `FORM update_items TABLES items.
|
|
58
|
+
badExample: `FORM update_items TABLES items.
|
|
59
59
|
ENDFORM.`,
|
|
60
|
-
goodExample: `FORM update_items CHANGING items TYPE ty_items.
|
|
60
|
+
goodExample: `FORM update_items CHANGING items TYPE ty_items.
|
|
61
61
|
ENDFORM.`,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -53,9 +53,9 @@ class FullyTypeITabs extends _abap_rule_1.ABAPRule {
|
|
|
53
53
|
key: "fully_type_itabs",
|
|
54
54
|
title: "Fully type internal tables",
|
|
55
55
|
shortDescription: `No implict table types or table keys`,
|
|
56
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-the-right-table-type
|
|
56
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-the-right-table-type
|
|
57
57
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key`,
|
|
58
|
-
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
58
|
+
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
59
59
|
DATA lt_bar TYPE STANDARD TABLE OF ty.`,
|
|
60
60
|
goodExample: `DATA lt_foo TYPE STANDARD TABLE OF ty WITH EMPTY KEY.`,
|
|
61
61
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
@@ -110,8 +110,8 @@ class FunctionModuleRecommendations extends _abap_rule_1.ABAPRule {
|
|
|
110
110
|
shortDescription: `Suggests replacements for various function modules`,
|
|
111
111
|
extendedInformation: `https://docs.abapopenchecks.org/checks/53/`,
|
|
112
112
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
113
|
-
badExample: `CALL FUNCTION 'GUID_CREATE'
|
|
114
|
-
IMPORTING
|
|
113
|
+
badExample: `CALL FUNCTION 'GUID_CREATE'
|
|
114
|
+
IMPORTING
|
|
115
115
|
ev_guid_32 = guid.`,
|
|
116
116
|
goodExample: `guid = cl_system_uuid=>create_uuid_c32_static( ).`,
|
|
117
117
|
};
|
|
@@ -61,26 +61,26 @@ class FunctionalWriting extends _abap_rule_1.ABAPRule {
|
|
|
61
61
|
key: "functional_writing",
|
|
62
62
|
title: "Use functional writing",
|
|
63
63
|
shortDescription: `Detects usage of call method when functional style calls can be used.`,
|
|
64
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls
|
|
64
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls
|
|
65
65
|
https://docs.abapopenchecks.org/checks/07/`,
|
|
66
66
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
67
|
-
badExample: `CALL METHOD zcl_class=>method( ).
|
|
68
|
-
CALL METHOD cl_abap_typedescr=>describe_by_name
|
|
69
|
-
EXPORTING
|
|
70
|
-
p_name = 'NAME'
|
|
71
|
-
RECEIVING
|
|
72
|
-
p_descr_ref = lr_typedescr
|
|
73
|
-
EXCEPTIONS
|
|
74
|
-
type_not_found = 1
|
|
67
|
+
badExample: `CALL METHOD zcl_class=>method( ).
|
|
68
|
+
CALL METHOD cl_abap_typedescr=>describe_by_name
|
|
69
|
+
EXPORTING
|
|
70
|
+
p_name = 'NAME'
|
|
71
|
+
RECEIVING
|
|
72
|
+
p_descr_ref = lr_typedescr
|
|
73
|
+
EXCEPTIONS
|
|
74
|
+
type_not_found = 1
|
|
75
75
|
OTHERS = 2.`,
|
|
76
|
-
goodExample: `zcl_class=>method( ).
|
|
77
|
-
cl_abap_typedescr=>describe_by_name(
|
|
78
|
-
EXPORTING
|
|
79
|
-
p_name = 'NAME'
|
|
80
|
-
RECEIVING
|
|
81
|
-
p_descr_ref = lr_typedescr
|
|
82
|
-
EXCEPTIONS
|
|
83
|
-
type_not_found = 1
|
|
76
|
+
goodExample: `zcl_class=>method( ).
|
|
77
|
+
cl_abap_typedescr=>describe_by_name(
|
|
78
|
+
EXPORTING
|
|
79
|
+
p_name = 'NAME'
|
|
80
|
+
RECEIVING
|
|
81
|
+
p_descr_ref = lr_typedescr
|
|
82
|
+
EXCEPTIONS
|
|
83
|
+
type_not_found = 1
|
|
84
84
|
OTHERS = 2 ).`,
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -53,16 +53,16 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
|
|
|
53
53
|
key: "global_class",
|
|
54
54
|
title: "Global class checks",
|
|
55
55
|
shortDescription: `Checks related to global classes`,
|
|
56
|
-
extendedInformation: `* global classes must be in own files
|
|
57
|
-
|
|
58
|
-
* file names must match class name
|
|
59
|
-
|
|
60
|
-
* file names must match interface name
|
|
61
|
-
|
|
62
|
-
* global classes must be global definitions
|
|
63
|
-
|
|
64
|
-
* global interfaces must be global definitions
|
|
65
|
-
|
|
56
|
+
extendedInformation: `* global classes must be in own files
|
|
57
|
+
|
|
58
|
+
* file names must match class name
|
|
59
|
+
|
|
60
|
+
* file names must match interface name
|
|
61
|
+
|
|
62
|
+
* global classes must be global definitions
|
|
63
|
+
|
|
64
|
+
* global interfaces must be global definitions
|
|
65
|
+
|
|
66
66
|
* global FOR TESTING, must have CATEGORY = 05 in the XML`,
|
|
67
67
|
tags: [_irule_1.RuleTag.Syntax],
|
|
68
68
|
};
|
|
@@ -66,21 +66,21 @@ class IdenticalConditions extends _abap_rule_1.ABAPRule {
|
|
|
66
66
|
return {
|
|
67
67
|
key: "identical_conditions",
|
|
68
68
|
title: "Identical conditions",
|
|
69
|
-
shortDescription: `Find identical conditions in IF + CASE + WHILE etc
|
|
70
|
-
|
|
69
|
+
shortDescription: `Find identical conditions in IF + CASE + WHILE etc
|
|
70
|
+
|
|
71
71
|
Prerequsites: code is pretty printed with identical cAsE`,
|
|
72
72
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
73
|
-
badExample: `IF foo = bar OR 1 = a OR foo = bar.
|
|
74
|
-
ENDIF.
|
|
75
|
-
CASE bar.
|
|
76
|
-
WHEN '1'.
|
|
77
|
-
WHEN 'A' OR '1'.
|
|
73
|
+
badExample: `IF foo = bar OR 1 = a OR foo = bar.
|
|
74
|
+
ENDIF.
|
|
75
|
+
CASE bar.
|
|
76
|
+
WHEN '1'.
|
|
77
|
+
WHEN 'A' OR '1'.
|
|
78
78
|
ENDCASE.`,
|
|
79
|
-
goodExample: `IF foo = bar OR 1 = a.
|
|
80
|
-
ENDIF.
|
|
81
|
-
CASE bar.
|
|
82
|
-
WHEN '1'.
|
|
83
|
-
WHEN 'A'.
|
|
79
|
+
goodExample: `IF foo = bar OR 1 = a.
|
|
80
|
+
ENDIF.
|
|
81
|
+
CASE bar.
|
|
82
|
+
WHEN '1'.
|
|
83
|
+
WHEN 'A'.
|
|
84
84
|
ENDCASE.`,
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -54,23 +54,23 @@ class IdenticalContents extends _abap_rule_1.ABAPRule {
|
|
|
54
54
|
key: "identical_contents",
|
|
55
55
|
title: "Identical contents",
|
|
56
56
|
shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,
|
|
57
|
-
extendedInformation: `
|
|
58
|
-
Prerequsites: code is pretty printed with identical cAsE
|
|
59
|
-
|
|
57
|
+
extendedInformation: `
|
|
58
|
+
Prerequsites: code is pretty printed with identical cAsE
|
|
59
|
+
|
|
60
60
|
Chained statments are ignored`,
|
|
61
61
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
62
|
-
badExample: `IF foo = bar.
|
|
63
|
-
WRITE 'bar'.
|
|
64
|
-
WRITE 'world'.
|
|
65
|
-
ELSE.
|
|
66
|
-
WRITE 'foo'.
|
|
67
|
-
WRITE 'world'.
|
|
62
|
+
badExample: `IF foo = bar.
|
|
63
|
+
WRITE 'bar'.
|
|
64
|
+
WRITE 'world'.
|
|
65
|
+
ELSE.
|
|
66
|
+
WRITE 'foo'.
|
|
67
|
+
WRITE 'world'.
|
|
68
68
|
ENDIF.`,
|
|
69
|
-
goodExample: `IF foo = bar.
|
|
70
|
-
WRITE 'bar'.
|
|
71
|
-
ELSE.
|
|
72
|
-
WRITE 'foo'.
|
|
73
|
-
ENDIF.
|
|
69
|
+
goodExample: `IF foo = bar.
|
|
70
|
+
WRITE 'bar'.
|
|
71
|
+
ELSE.
|
|
72
|
+
WRITE 'foo'.
|
|
73
|
+
ENDIF.
|
|
74
74
|
WRITE 'world'.`,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -16,12 +16,12 @@ class IdenticalDescriptions {
|
|
|
16
16
|
key: "identical_descriptions",
|
|
17
17
|
title: "Identical descriptions",
|
|
18
18
|
shortDescription: `Searches for objects with the same type and same description`,
|
|
19
|
-
extendedInformation: `Case insensitive
|
|
20
|
-
|
|
21
|
-
Only checks the master language descriptions
|
|
22
|
-
|
|
23
|
-
Dependencies are skipped
|
|
24
|
-
|
|
19
|
+
extendedInformation: `Case insensitive
|
|
20
|
+
|
|
21
|
+
Only checks the master language descriptions
|
|
22
|
+
|
|
23
|
+
Dependencies are skipped
|
|
24
|
+
|
|
25
25
|
Works for: INTF, CLAS, DOMA, DTEL, FUNC in same FUGR`,
|
|
26
26
|
tags: [],
|
|
27
27
|
};
|