@abaplint/core 2.105.16 → 2.105.17
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 +1 -0
- package/build/adhoc/syntax_performance.js +165 -165
- package/build/src/abap/2_statements/expressions/raise_with.js +1 -1
- package/build/src/abap/5_syntax/expressions/raise_with.js +1 -1
- package/build/src/abap/5_syntax/statements/modify_internal.js +22 -2
- package/build/src/abap/5_syntax/statements/parameter.js +3 -0
- package/build/src/abap/flow/flow_graph.js +7 -7
- package/build/src/abap/nodes/expression_node.js +26 -0
- package/build/src/lsp/help.js +7 -7
- 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/align_parameters.js +40 -40
- package/build/src/rules/ambiguous_statement.js +6 -6
- package/build/src/rules/avoid_use.js +24 -13
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +12 -12
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/cds_comment_style.js +4 -4
- package/build/src/rules/cds_legacy_view.js +4 -4
- 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 +3 -3
- 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 +84 -84
- package/build/src/rules/easy_to_find_messages.js +6 -6
- package/build/src/rules/empty_line_in_statement.js +2 -2
- 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 +1 -1
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +8 -8
- package/build/src/rules/identical_conditions.js +2 -2
- package/build/src/rules/identical_contents.js +14 -14
- package/build/src/rules/identical_descriptions.js +6 -6
- package/build/src/rules/if_in_if.js +35 -35
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/intf_referencing_clas.js +3 -3
- 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 +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 +9 -2
- package/build/src/rules/method_overwrites_builtin.js +4 -4
- 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 +1 -1
- package/build/src/rules/prefer_xsdbool.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 +9 -9
- 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/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 +3 -3
- package/build/src/rules/tabl_enhancement_category.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_methods.js +11 -11
- package/build/src/rules/unused_variables.js +12 -12
- package/build/src/rules/use_bool_expression.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/package.json +70 -70
|
@@ -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
|
};
|
|
@@ -731,10 +731,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
731
731
|
const fieldName = f.concatTokens();
|
|
732
732
|
fieldDefinition += indentation + " " + fieldName + " TYPE " + tableName + "-" + fieldName + ",\n";
|
|
733
733
|
}
|
|
734
|
-
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
734
|
+
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
735
735
|
${fieldDefinition}${indentation} END OF ${name}.`;
|
|
736
736
|
}
|
|
737
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
737
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
738
738
|
${indentation}`);
|
|
739
739
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
740
740
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -778,12 +778,12 @@ ${indentation}`);
|
|
|
778
778
|
}
|
|
779
779
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
780
780
|
const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "error";
|
|
781
|
-
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
782
|
-
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
783
|
-
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
781
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
782
|
+
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
783
|
+
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
784
784
|
${indentation}`);
|
|
785
785
|
if (fieldDefinitions === "") {
|
|
786
|
-
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
786
|
+
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
787
787
|
${indentation}`);
|
|
788
788
|
}
|
|
789
789
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
@@ -851,7 +851,7 @@ ${indentation}`);
|
|
|
851
851
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
852
852
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
853
853
|
const firstToken = high.getFirstToken();
|
|
854
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
854
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
855
855
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
856
856
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
857
857
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -889,7 +889,7 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
889
889
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
890
890
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
891
891
|
const firstToken = high.getFirstToken();
|
|
892
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
892
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
893
893
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
894
894
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
895
895
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -931,14 +931,14 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
931
931
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
932
932
|
const firstToken = high.getFirstToken();
|
|
933
933
|
// note that the tabix restore should be done before throwing the exception
|
|
934
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
935
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
936
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
937
|
-
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
938
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
939
|
-
${indentation}IF sy-subrc <> 0.
|
|
940
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
941
|
-
${indentation}ENDIF.
|
|
934
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
935
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
936
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
937
|
+
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
938
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
939
|
+
${indentation}IF sy-subrc <> 0.
|
|
940
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
941
|
+
${indentation}ENDIF.
|
|
942
942
|
${indentation}`);
|
|
943
943
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
|
|
944
944
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -995,7 +995,7 @@ ${indentation}`);
|
|
|
995
995
|
const className = classNames[0].concatTokens();
|
|
996
996
|
const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
997
997
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
998
|
-
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
998
|
+
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
999
999
|
${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
1000
1000
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
1001
1001
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -1152,21 +1152,21 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
1152
1152
|
}
|
|
1153
1153
|
startToken = node.getFirstToken();
|
|
1154
1154
|
}
|
|
1155
|
-
const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.
|
|
1155
|
+
const withs = ((_f = node.findDirectExpression(Expressions.RaiseWith)) === null || _f === void 0 ? void 0 : _f.findDirectExpressions(Expressions.SimpleSource3)) || [];
|
|
1156
1156
|
const className = ((_g = node.findDirectExpression(Expressions.ClassName)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "ERROR";
|
|
1157
1157
|
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1158
1158
|
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1159
1159
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1160
|
-
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1161
|
-
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1160
|
+
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1161
|
+
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1162
1162
|
${indentation}${uniqueName1}-msgno = ${number}.\n`;
|
|
1163
1163
|
if (withs.length > 0) {
|
|
1164
|
-
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1165
|
-
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1166
|
-
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1164
|
+
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1165
|
+
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1166
|
+
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1167
1167
|
${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
|
|
1168
1168
|
}
|
|
1169
|
-
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1169
|
+
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1170
1170
|
${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
|
|
1171
1171
|
if (withs.length > 0) {
|
|
1172
1172
|
abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
|
|
@@ -1278,10 +1278,10 @@ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`
|
|
|
1278
1278
|
let code = "";
|
|
1279
1279
|
if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
|
|
1280
1280
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1281
|
-
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1282
|
-
IF sy-subrc <> 0.
|
|
1283
|
-
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1284
|
-
ENDIF.
|
|
1281
|
+
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1282
|
+
IF sy-subrc <> 0.
|
|
1283
|
+
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1284
|
+
ENDIF.
|
|
1285
1285
|
GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
1286
1286
|
}
|
|
1287
1287
|
else {
|
|
@@ -1357,20 +1357,20 @@ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
|
1357
1357
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1358
1358
|
const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1359
1359
|
const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1360
|
-
code += ` items LIKE ${loopSourceName},
|
|
1361
|
-
END OF ${groupTargetName}type.
|
|
1362
|
-
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1363
|
-
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1360
|
+
code += ` items LIKE ${loopSourceName},
|
|
1361
|
+
END OF ${groupTargetName}type.
|
|
1362
|
+
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1363
|
+
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1364
1364
|
LOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\n`;
|
|
1365
1365
|
if (groupIndexName !== undefined) {
|
|
1366
1366
|
code += `DATA(${uniqueNameIndex}) = sy-tabix.\n`;
|
|
1367
1367
|
}
|
|
1368
|
-
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1368
|
+
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1369
1369
|
IF sy-subrc = 0.\n`;
|
|
1370
1370
|
if (groupCountName !== undefined) {
|
|
1371
1371
|
code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\n`;
|
|
1372
1372
|
}
|
|
1373
|
-
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1373
|
+
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1374
1374
|
ELSE.\n`;
|
|
1375
1375
|
code += ` CLEAR ${uniqueName}.\n`;
|
|
1376
1376
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
@@ -1391,8 +1391,8 @@ ELSE.\n`;
|
|
|
1391
1391
|
}
|
|
1392
1392
|
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE ${uniqueName}-items.\n`;
|
|
1393
1393
|
code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\n`;
|
|
1394
|
-
code += `ENDIF.
|
|
1395
|
-
ENDLOOP.
|
|
1394
|
+
code += `ENDIF.
|
|
1395
|
+
ENDLOOP.
|
|
1396
1396
|
LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
1397
1397
|
let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1398
1398
|
for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {
|
|
@@ -1540,7 +1540,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1540
1540
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1541
1541
|
let code = `CLEAR ${target.concatTokens()}.\n`;
|
|
1542
1542
|
for (const fieldAssignment of fieldAssignments) {
|
|
1543
|
-
code += indentation + target.concatTokens() + "-" + fieldAssignment.
|
|
1543
|
+
code += indentation + target.concatTokens() + "-" + fieldAssignment.concatTokensWithLinebreaks() + `.\n`;
|
|
1544
1544
|
}
|
|
1545
1545
|
code = code.trimEnd();
|
|
1546
1546
|
const start = high.getFirstToken().getStart();
|
|
@@ -1564,7 +1564,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1564
1564
|
const enumName = (_b = high.findExpressionAfterToken("ENUM")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1565
1565
|
const structureName = (_c = high.findExpressionAfterToken("STRUCTURE")) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
1566
1566
|
// all ENUMS are char like?
|
|
1567
|
-
let code = `TYPES ${enumName} TYPE string.
|
|
1567
|
+
let code = `TYPES ${enumName} TYPE string.
|
|
1568
1568
|
CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
1569
1569
|
let count = 1;
|
|
1570
1570
|
for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {
|
|
@@ -1608,14 +1608,14 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
1608
1608
|
const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1609
1609
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1610
1610
|
// restore tabix before exeption
|
|
1611
|
-
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1612
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1613
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1614
|
-
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1615
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1616
|
-
${indentation}IF sy-subrc <> 0.
|
|
1617
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1618
|
-
${indentation}ENDIF.
|
|
1611
|
+
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1612
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1613
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1614
|
+
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1615
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1616
|
+
${indentation}IF sy-subrc <> 0.
|
|
1617
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1618
|
+
${indentation}ENDIF.
|
|
1619
1619
|
${indentation}${uniqueName}`;
|
|
1620
1620
|
const start = target.getFirstToken().getStart();
|
|
1621
1621
|
const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
|
|
@@ -1699,11 +1699,11 @@ ${indentation}${uniqueName}`;
|
|
|
1699
1699
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1700
1700
|
const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1701
1701
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1702
|
-
const code = `DATA ${uniqueName} TYPE string.
|
|
1703
|
-
${indentation}CALL FUNCTION '${functionName}'
|
|
1704
|
-
${indentation} EXPORTING
|
|
1705
|
-
${indentation} input = ${source}
|
|
1706
|
-
${indentation} IMPORTING
|
|
1702
|
+
const code = `DATA ${uniqueName} TYPE string.
|
|
1703
|
+
${indentation}CALL FUNCTION '${functionName}'
|
|
1704
|
+
${indentation} EXPORTING
|
|
1705
|
+
${indentation} input = ${source}
|
|
1706
|
+
${indentation} IMPORTING
|
|
1707
1707
|
${indentation} output = ${uniqueName}.\n`;
|
|
1708
1708
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1709
1709
|
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
|
};
|
|
@@ -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.`,
|
|
@@ -24,10 +24,10 @@ class ExitOrCheck extends _abap_rule_1.ABAPRule {
|
|
|
24
24
|
return {
|
|
25
25
|
key: "exit_or_check",
|
|
26
26
|
title: "Find EXIT or CHECK outside loops",
|
|
27
|
-
shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
|
|
27
|
+
shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.
|
|
28
28
|
Use RETURN to leave procesing blocks instead.`,
|
|
29
|
-
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
30
|
-
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
29
|
+
extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm
|
|
30
|
+
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm
|
|
31
31
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,
|
|
32
32
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
33
33
|
};
|
|
@@ -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
|
}
|
|
@@ -20,7 +20,7 @@ class FullyTypeITabs extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
key: "fully_type_itabs",
|
|
21
21
|
title: "Fully type internal tables",
|
|
22
22
|
shortDescription: `No implict table types or table keys`,
|
|
23
|
-
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
23
|
+
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
24
24
|
DATA lt_bar TYPE STANDARD TABLE OF ty.`,
|
|
25
25
|
goodExample: `DATA lt_foo TYPE STANDARD TABLE OF ty WITH EMPTY KEY.`,
|
|
26
26
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
@@ -28,26 +28,26 @@ class FunctionalWriting extends _abap_rule_1.ABAPRule {
|
|
|
28
28
|
key: "functional_writing",
|
|
29
29
|
title: "Use functional writing",
|
|
30
30
|
shortDescription: `Detects usage of call method when functional style calls can be used.`,
|
|
31
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls
|
|
31
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls
|
|
32
32
|
https://docs.abapopenchecks.org/checks/07/`,
|
|
33
33
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
34
|
-
badExample: `CALL METHOD zcl_class=>method( ).
|
|
35
|
-
CALL METHOD cl_abap_typedescr=>describe_by_name
|
|
36
|
-
EXPORTING
|
|
37
|
-
p_name = 'NAME'
|
|
38
|
-
RECEIVING
|
|
39
|
-
p_descr_ref = lr_typedescr
|
|
40
|
-
EXCEPTIONS
|
|
41
|
-
type_not_found = 1
|
|
34
|
+
badExample: `CALL METHOD zcl_class=>method( ).
|
|
35
|
+
CALL METHOD cl_abap_typedescr=>describe_by_name
|
|
36
|
+
EXPORTING
|
|
37
|
+
p_name = 'NAME'
|
|
38
|
+
RECEIVING
|
|
39
|
+
p_descr_ref = lr_typedescr
|
|
40
|
+
EXCEPTIONS
|
|
41
|
+
type_not_found = 1
|
|
42
42
|
OTHERS = 2.`,
|
|
43
|
-
goodExample: `zcl_class=>method( ).
|
|
44
|
-
cl_abap_typedescr=>describe_by_name(
|
|
45
|
-
EXPORTING
|
|
46
|
-
p_name = 'NAME'
|
|
47
|
-
RECEIVING
|
|
48
|
-
p_descr_ref = lr_typedescr
|
|
49
|
-
EXCEPTIONS
|
|
50
|
-
type_not_found = 1
|
|
43
|
+
goodExample: `zcl_class=>method( ).
|
|
44
|
+
cl_abap_typedescr=>describe_by_name(
|
|
45
|
+
EXPORTING
|
|
46
|
+
p_name = 'NAME'
|
|
47
|
+
RECEIVING
|
|
48
|
+
p_descr_ref = lr_typedescr
|
|
49
|
+
EXCEPTIONS
|
|
50
|
+
type_not_found = 1
|
|
51
51
|
OTHERS = 2 ).`,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
@@ -19,14 +19,14 @@ class GlobalClass extends _abap_rule_1.ABAPRule {
|
|
|
19
19
|
key: "global_class",
|
|
20
20
|
title: "Global class checks",
|
|
21
21
|
shortDescription: `Checks related to global classes`,
|
|
22
|
-
extendedInformation: `* global classes must be in own files
|
|
23
|
-
|
|
24
|
-
* file names must match class name
|
|
25
|
-
|
|
26
|
-
* file names must match interface name
|
|
27
|
-
|
|
28
|
-
* global classes must be global definitions
|
|
29
|
-
|
|
22
|
+
extendedInformation: `* global classes must be in own files
|
|
23
|
+
|
|
24
|
+
* file names must match class name
|
|
25
|
+
|
|
26
|
+
* file names must match interface name
|
|
27
|
+
|
|
28
|
+
* global classes must be global definitions
|
|
29
|
+
|
|
30
30
|
* global interfaces must be global definitions`,
|
|
31
31
|
tags: [_irule_1.RuleTag.Syntax],
|
|
32
32
|
};
|
|
@@ -33,8 +33,8 @@ class IdenticalConditions extends _abap_rule_1.ABAPRule {
|
|
|
33
33
|
return {
|
|
34
34
|
key: "identical_conditions",
|
|
35
35
|
title: "Identical conditions",
|
|
36
|
-
shortDescription: `Find identical conditions in IF + CASE + WHILE etc
|
|
37
|
-
|
|
36
|
+
shortDescription: `Find identical conditions in IF + CASE + WHILE etc
|
|
37
|
+
|
|
38
38
|
Prerequsites: code is pretty printed with identical cAsE`,
|
|
39
39
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
40
40
|
};
|
|
@@ -20,23 +20,23 @@ class IdenticalContents extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
key: "identical_contents",
|
|
21
21
|
title: "Identical contents",
|
|
22
22
|
shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,
|
|
23
|
-
extendedInformation: `
|
|
24
|
-
Prerequsites: code is pretty printed with identical cAsE
|
|
25
|
-
|
|
23
|
+
extendedInformation: `
|
|
24
|
+
Prerequsites: code is pretty printed with identical cAsE
|
|
25
|
+
|
|
26
26
|
Chained statments are ignored`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
28
|
-
badExample: `IF foo = bar.
|
|
29
|
-
WRITE 'bar'.
|
|
30
|
-
WRITE 'world'.
|
|
31
|
-
ELSE.
|
|
32
|
-
WRITE 'foo'.
|
|
33
|
-
WRITE 'world'.
|
|
28
|
+
badExample: `IF foo = bar.
|
|
29
|
+
WRITE 'bar'.
|
|
30
|
+
WRITE 'world'.
|
|
31
|
+
ELSE.
|
|
32
|
+
WRITE 'foo'.
|
|
33
|
+
WRITE 'world'.
|
|
34
34
|
ENDIF.`,
|
|
35
|
-
goodExample: `IF foo = bar.
|
|
36
|
-
WRITE 'bar'.
|
|
37
|
-
ELSE.
|
|
38
|
-
WRITE 'foo'.
|
|
39
|
-
ENDIF.
|
|
35
|
+
goodExample: `IF foo = bar.
|
|
36
|
+
WRITE 'bar'.
|
|
37
|
+
ELSE.
|
|
38
|
+
WRITE 'foo'.
|
|
39
|
+
ENDIF.
|
|
40
40
|
WRITE 'world'.`,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -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
|
};
|
|
@@ -21,43 +21,43 @@ class IfInIf extends _abap_rule_1.ABAPRule {
|
|
|
21
21
|
key: "if_in_if",
|
|
22
22
|
title: "IF in IF",
|
|
23
23
|
shortDescription: `Detects nested ifs which can be refactored.`,
|
|
24
|
-
extendedInformation: `
|
|
25
|
-
Directly nested IFs without ELSE can be refactored to a single condition using AND.
|
|
26
|
-
|
|
27
|
-
ELSE condtions with directly nested IF refactored to ELSEIF, quickfixes are suggested for this case.
|
|
28
|
-
|
|
29
|
-
https://docs.abapopenchecks.org/checks/01/
|
|
24
|
+
extendedInformation: `
|
|
25
|
+
Directly nested IFs without ELSE can be refactored to a single condition using AND.
|
|
26
|
+
|
|
27
|
+
ELSE condtions with directly nested IF refactored to ELSEIF, quickfixes are suggested for this case.
|
|
28
|
+
|
|
29
|
+
https://docs.abapopenchecks.org/checks/01/
|
|
30
30
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low`,
|
|
31
|
-
badExample: `IF condition1.
|
|
32
|
-
IF condition2.
|
|
33
|
-
...
|
|
34
|
-
ENDIF.
|
|
35
|
-
ENDIF.
|
|
36
|
-
|
|
37
|
-
IF condition1.
|
|
38
|
-
...
|
|
39
|
-
ELSE.
|
|
40
|
-
IF condition2.
|
|
41
|
-
...
|
|
42
|
-
ENDIF.
|
|
31
|
+
badExample: `IF condition1.
|
|
32
|
+
IF condition2.
|
|
33
|
+
...
|
|
34
|
+
ENDIF.
|
|
35
|
+
ENDIF.
|
|
36
|
+
|
|
37
|
+
IF condition1.
|
|
38
|
+
...
|
|
39
|
+
ELSE.
|
|
40
|
+
IF condition2.
|
|
41
|
+
...
|
|
42
|
+
ENDIF.
|
|
43
43
|
ENDIF.`,
|
|
44
|
-
goodExample: `IF ( condition1 ) AND ( condition2 ).
|
|
45
|
-
...
|
|
46
|
-
ENDIF.
|
|
47
|
-
|
|
48
|
-
IF condition1.
|
|
49
|
-
...
|
|
50
|
-
ELSEIF condition2.
|
|
51
|
-
...
|
|
52
|
-
ENDIF.
|
|
53
|
-
|
|
54
|
-
CASE variable.
|
|
55
|
-
WHEN value1.
|
|
56
|
-
...
|
|
57
|
-
WHEN value2.
|
|
58
|
-
IF condition2.
|
|
59
|
-
...
|
|
60
|
-
ENDIF.
|
|
44
|
+
goodExample: `IF ( condition1 ) AND ( condition2 ).
|
|
45
|
+
...
|
|
46
|
+
ENDIF.
|
|
47
|
+
|
|
48
|
+
IF condition1.
|
|
49
|
+
...
|
|
50
|
+
ELSEIF condition2.
|
|
51
|
+
...
|
|
52
|
+
ENDIF.
|
|
53
|
+
|
|
54
|
+
CASE variable.
|
|
55
|
+
WHEN value1.
|
|
56
|
+
...
|
|
57
|
+
WHEN value2.
|
|
58
|
+
IF condition2.
|
|
59
|
+
...
|
|
60
|
+
ENDIF.
|
|
61
61
|
ENDCASE.`,
|
|
62
62
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
63
63
|
};
|
|
@@ -102,9 +102,9 @@ class ImplementMethods extends _abap_rule_1.ABAPRule {
|
|
|
102
102
|
for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.ClassImplementation)) || []) {
|
|
103
103
|
const name = (_b = i.findFirstExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();
|
|
104
104
|
if (name === impl.identifier.getName().toUpperCase()) {
|
|
105
|
-
return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `
|
|
106
|
-
METHOD ${methodName.toLowerCase()}.
|
|
107
|
-
RETURN. " todo, implement method
|
|
105
|
+
return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `
|
|
106
|
+
METHOD ${methodName.toLowerCase()}.
|
|
107
|
+
RETURN. " todo, implement method
|
|
108
108
|
ENDMETHOD.`);
|
|
109
109
|
}
|
|
110
110
|
}
|