@abaplint/core 2.113.81 → 2.113.82
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/abap/flow/flow_graph.js +7 -7
- 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_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 +122 -108
- 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 +8 -8
- 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/if_in_if.js +35 -35
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/implicit_start_of_selection.js +5 -5
- 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 +6 -6
- 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 +3 -3
- 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/package.json +70 -70
|
@@ -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: `FROM foo.
|
|
34
|
-
WRITE 'hello'.
|
|
35
|
-
DATA int TYPE i.
|
|
33
|
+
badExample: `FROM foo.
|
|
34
|
+
WRITE 'hello'.
|
|
35
|
+
DATA int TYPE i.
|
|
36
36
|
ENDFORM.`,
|
|
37
|
-
goodExample: `FROM foo.
|
|
38
|
-
DATA int TYPE i.
|
|
39
|
-
WRITE 'hello'.
|
|
37
|
+
goodExample: `FROM foo.
|
|
38
|
+
DATA int TYPE i.
|
|
39
|
+
WRITE 'hello'.
|
|
40
40
|
ENDFORM.`,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Downport = exports.DownportConf = void 0;
|
|
4
4
|
/* eslint-disable max-len */
|
|
5
|
-
const
|
|
5
|
+
const crypto = require("crypto");
|
|
6
|
+
const tokens_1 = require("../abap/1_lexer/tokens");
|
|
6
7
|
const Expressions = require("../abap/2_statements/expressions");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const issue_1 = require("../issue");
|
|
10
|
-
const _irule_1 = require("./_irule");
|
|
8
|
+
const Statements = require("../abap/2_statements/statements");
|
|
9
|
+
const statements_1 = require("../abap/2_statements/statements");
|
|
11
10
|
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const position_1 = require("../position");
|
|
15
|
-
const virtual_position_1 = require("../virtual_position");
|
|
16
|
-
const _abap_object_1 = require("../objects/_abap_object");
|
|
17
|
-
const version_1 = require("../version");
|
|
18
|
-
const registry_1 = require("../registry");
|
|
19
|
-
const syntax_1 = require("../abap/5_syntax/syntax");
|
|
11
|
+
const Structures = require("../abap/3_structures/structures");
|
|
12
|
+
const _builtin_1 = require("../abap/5_syntax/_builtin");
|
|
20
13
|
const _reference_1 = require("../abap/5_syntax/_reference");
|
|
14
|
+
const _scope_type_1 = require("../abap/5_syntax/_scope_type");
|
|
15
|
+
const syntax_1 = require("../abap/5_syntax/syntax");
|
|
16
|
+
const nodes_1 = require("../abap/nodes");
|
|
21
17
|
const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
22
18
|
const basic_1 = require("../abap/types/basic");
|
|
23
19
|
const config_1 = require("../config");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
20
|
+
const edit_helper_1 = require("../edit_helper");
|
|
21
|
+
const issue_1 = require("../issue");
|
|
26
22
|
const objects_1 = require("../objects");
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
23
|
+
const _abap_object_1 = require("../objects/_abap_object");
|
|
24
|
+
const position_1 = require("../position");
|
|
25
|
+
const registry_1 = require("../registry");
|
|
26
|
+
const include_graph_1 = require("../utils/include_graph");
|
|
27
|
+
const version_1 = require("../version");
|
|
28
|
+
const virtual_position_1 = require("../virtual_position");
|
|
29
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
30
|
+
const _irule_1 = require("./_irule");
|
|
31
31
|
// todo: refactor each sub-rule to new classes?
|
|
32
32
|
// todo: add configuration
|
|
33
33
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
@@ -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
|
};
|
|
@@ -735,10 +735,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
735
735
|
const fieldName = f.concatTokens();
|
|
736
736
|
fieldDefinition += indentation + " " + fieldName + " TYPE " + tableName + "-" + fieldName + ",\n";
|
|
737
737
|
}
|
|
738
|
-
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
738
|
+
fieldDefinition = `DATA: BEGIN OF ${name},
|
|
739
739
|
${fieldDefinition}${indentation} END OF ${name}.`;
|
|
740
740
|
}
|
|
741
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
741
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}
|
|
742
742
|
${indentation}`);
|
|
743
743
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
744
744
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -797,12 +797,12 @@ ${indentation}`);
|
|
|
797
797
|
}
|
|
798
798
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
799
799
|
const name = ((_g = inlineData.findFirstExpression(Expressions.TargetField)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || "error";
|
|
800
|
-
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
801
|
-
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
802
|
-
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
800
|
+
let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},
|
|
801
|
+
${fieldDefinitions}${indentation} END OF ${uniqueName}.
|
|
802
|
+
${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.
|
|
803
803
|
${indentation}`);
|
|
804
804
|
if (fieldDefinitions === "") {
|
|
805
|
-
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
805
|
+
fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.
|
|
806
806
|
${indentation}`);
|
|
807
807
|
}
|
|
808
808
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
@@ -870,7 +870,7 @@ ${indentation}`);
|
|
|
870
870
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
871
871
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
872
872
|
const firstToken = high.getFirstToken();
|
|
873
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
873
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
874
874
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
875
875
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
876
876
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -924,7 +924,7 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
924
924
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
925
925
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
926
926
|
const firstToken = high.getFirstToken();
|
|
927
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
927
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.
|
|
928
928
|
${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
929
929
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
|
|
930
930
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -966,14 +966,14 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
966
966
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
967
967
|
const firstToken = high.getFirstToken();
|
|
968
968
|
// note that the tabix restore should be done before throwing the exception
|
|
969
|
-
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
970
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
971
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
972
|
-
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
973
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
974
|
-
${indentation}IF sy-subrc <> 0.
|
|
975
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
976
|
-
${indentation}ENDIF.
|
|
969
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
|
|
970
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
971
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
972
|
+
${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.
|
|
973
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
974
|
+
${indentation}IF sy-subrc <> 0.
|
|
975
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
976
|
+
${indentation}ENDIF.
|
|
977
977
|
${indentation}`);
|
|
978
978
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
|
|
979
979
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -1030,7 +1030,7 @@ ${indentation}`);
|
|
|
1030
1030
|
const className = classNames[0].concatTokens();
|
|
1031
1031
|
const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1032
1032
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1033
|
-
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1033
|
+
const code = ` DATA ${targetName} TYPE REF TO ${className}.
|
|
1034
1034
|
${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
1035
1035
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
1036
1036
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
@@ -1192,16 +1192,16 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
1192
1192
|
const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1193
1193
|
const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1194
1194
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1195
|
-
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1196
|
-
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1195
|
+
let abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.
|
|
1196
|
+
${indentation}${uniqueName1}-msgid = ${id}.
|
|
1197
1197
|
${indentation}${uniqueName1}-msgno = ${number}.\n`;
|
|
1198
1198
|
if (withs.length > 0) {
|
|
1199
|
-
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1200
|
-
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1201
|
-
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1199
|
+
abap += `${indentation}${uniqueName1}-attr1 = 'IF_T100_DYN_MSG~MSGV1'.
|
|
1200
|
+
${indentation}${uniqueName1}-attr2 = 'IF_T100_DYN_MSG~MSGV2'.
|
|
1201
|
+
${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
|
|
1202
1202
|
${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
|
|
1203
1203
|
}
|
|
1204
|
-
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1204
|
+
abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
|
|
1205
1205
|
${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
|
|
1206
1206
|
if (withs.length > 0) {
|
|
1207
1207
|
abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
|
|
@@ -1313,10 +1313,10 @@ ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`
|
|
|
1313
1313
|
let code = "";
|
|
1314
1314
|
if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
|
|
1315
1315
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1316
|
-
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1317
|
-
IF sy-subrc <> 0.
|
|
1318
|
-
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1319
|
-
ENDIF.
|
|
1316
|
+
code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
|
|
1317
|
+
IF sy-subrc <> 0.
|
|
1318
|
+
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1319
|
+
ENDIF.
|
|
1320
1320
|
GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
1321
1321
|
}
|
|
1322
1322
|
else {
|
|
@@ -1405,20 +1405,20 @@ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
|
|
|
1405
1405
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1406
1406
|
const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1407
1407
|
const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1408
|
-
code += ` items LIKE ${loopSourceName},
|
|
1409
|
-
END OF ${groupTargetName}type.
|
|
1410
|
-
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1411
|
-
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1408
|
+
code += ` items LIKE ${loopSourceName},
|
|
1409
|
+
END OF ${groupTargetName}type.
|
|
1410
|
+
DATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.
|
|
1411
|
+
DATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.
|
|
1412
1412
|
LOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\n`;
|
|
1413
1413
|
if (groupIndexName !== undefined) {
|
|
1414
1414
|
code += `DATA(${uniqueNameIndex}) = sy-tabix.\n`;
|
|
1415
1415
|
}
|
|
1416
|
-
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1416
|
+
code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.
|
|
1417
1417
|
IF sy-subrc = 0.\n`;
|
|
1418
1418
|
if (groupCountName !== undefined) {
|
|
1419
1419
|
code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\n`;
|
|
1420
1420
|
}
|
|
1421
|
-
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1421
|
+
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE <${uniqueFS}>-items.
|
|
1422
1422
|
ELSE.\n`;
|
|
1423
1423
|
code += ` CLEAR ${uniqueName}.\n`;
|
|
1424
1424
|
for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
|
|
@@ -1439,8 +1439,8 @@ ELSE.\n`;
|
|
|
1439
1439
|
}
|
|
1440
1440
|
code += ` INSERT ${loopTargetName}${isReference ? "->*" : ""} INTO TABLE ${uniqueName}-items.\n`;
|
|
1441
1441
|
code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\n`;
|
|
1442
|
-
code += `ENDIF.
|
|
1443
|
-
ENDLOOP.
|
|
1442
|
+
code += `ENDIF.
|
|
1443
|
+
ENDLOOP.
|
|
1444
1444
|
LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
1445
1445
|
let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
1446
1446
|
for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {
|
|
@@ -1612,7 +1612,7 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
|
|
|
1612
1612
|
const enumName = (_b = high.findExpressionAfterToken("ENUM")) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1613
1613
|
const structureName = (_c = high.findExpressionAfterToken("STRUCTURE")) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
1614
1614
|
// all ENUMS are char like?
|
|
1615
|
-
let code = `TYPES ${enumName} TYPE string.
|
|
1615
|
+
let code = `TYPES ${enumName} TYPE string.
|
|
1616
1616
|
CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
1617
1617
|
let count = 1;
|
|
1618
1618
|
for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {
|
|
@@ -1656,14 +1656,14 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
1656
1656
|
const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1657
1657
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1658
1658
|
// restore tabix before exeption
|
|
1659
|
-
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1660
|
-
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1661
|
-
${indentation}${tabixBackup} = sy-tabix.
|
|
1662
|
-
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1663
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
1664
|
-
${indentation}IF sy-subrc <> 0.
|
|
1665
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1666
|
-
${indentation}ENDIF.
|
|
1659
|
+
const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
|
|
1660
|
+
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
1661
|
+
${indentation}${tabixBackup} = sy-tabix.
|
|
1662
|
+
${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.
|
|
1663
|
+
${indentation}sy-tabix = ${tabixBackup}.
|
|
1664
|
+
${indentation}IF sy-subrc <> 0.
|
|
1665
|
+
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
1666
|
+
${indentation}ENDIF.
|
|
1667
1667
|
${indentation}${uniqueName}`;
|
|
1668
1668
|
const start = target.getFirstToken().getStart();
|
|
1669
1669
|
const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
|
|
@@ -1743,11 +1743,11 @@ ${indentation}${uniqueName}`;
|
|
|
1743
1743
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
1744
1744
|
const source = (_b = child.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
1745
1745
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
1746
|
-
const code = `DATA ${uniqueName} TYPE string.
|
|
1747
|
-
${indentation}CALL FUNCTION '${functionName}'
|
|
1748
|
-
${indentation} EXPORTING
|
|
1749
|
-
${indentation} input = ${source}
|
|
1750
|
-
${indentation} IMPORTING
|
|
1746
|
+
const code = `DATA ${uniqueName} TYPE string.
|
|
1747
|
+
${indentation}CALL FUNCTION '${functionName}'
|
|
1748
|
+
${indentation} EXPORTING
|
|
1749
|
+
${indentation} input = ${source}
|
|
1750
|
+
${indentation} IMPORTING
|
|
1751
1751
|
${indentation} output = ${uniqueName}.\n`;
|
|
1752
1752
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
1753
1753
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);
|
|
@@ -1780,24 +1780,33 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
1780
1780
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
|
|
1781
1781
|
}
|
|
1782
1782
|
outlineLoopTarget(node, lowFile, highSyntax) {
|
|
1783
|
-
var _a, _b, _c, _d, _e, _f
|
|
1783
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1784
1784
|
// also allows outlining of voided types
|
|
1785
1785
|
if (!(node.get() instanceof Statements.Loop)) {
|
|
1786
1786
|
return undefined;
|
|
1787
1787
|
}
|
|
1788
|
-
const
|
|
1788
|
+
const source = node.findDirectExpression(Expressions.SimpleSource2);
|
|
1789
|
+
if (source === undefined) {
|
|
1790
|
+
return undefined;
|
|
1791
|
+
}
|
|
1792
|
+
const sourceName = source === null || source === void 0 ? void 0 : source.concatTokens();
|
|
1789
1793
|
if (sourceName === undefined) {
|
|
1790
1794
|
return undefined;
|
|
1791
1795
|
}
|
|
1796
|
+
let foundType = undefined;
|
|
1797
|
+
const spag = highSyntax.spaghetti.lookupPosition(source.getFirstToken().getStart(), lowFile.getFilename());
|
|
1798
|
+
if (spag) {
|
|
1799
|
+
foundType = spag.findVariable(source.concatTokens());
|
|
1800
|
+
}
|
|
1792
1801
|
const concat = node.concatTokens().toUpperCase();
|
|
1793
1802
|
if (concat.includes(" GROUP BY ") || concat.startsWith("LOOP AT GROUP ")) {
|
|
1794
1803
|
return undefined;
|
|
1795
1804
|
}
|
|
1796
1805
|
const isReference = concat.includes(" REFERENCE INTO ");
|
|
1797
1806
|
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1798
|
-
const dataTarget = (
|
|
1807
|
+
const dataTarget = (_b = (_a = node.findDirectExpression(Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.InlineData);
|
|
1799
1808
|
if (dataTarget) {
|
|
1800
|
-
const targetName = ((
|
|
1809
|
+
const targetName = ((_c = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "DOWNPORT_ERROR";
|
|
1801
1810
|
let code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\n${indentation}`;
|
|
1802
1811
|
if (isReference) {
|
|
1803
1812
|
const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
@@ -1808,10 +1817,15 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
1808
1817
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
1809
1818
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline LOOP data target", this.getMetadata().key, this.conf.severity, fix);
|
|
1810
1819
|
}
|
|
1811
|
-
const fsTarget = (
|
|
1820
|
+
const fsTarget = (_e = (_d = node.findDirectExpression(Expressions.LoopTarget)) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.FSTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.InlineFS);
|
|
1812
1821
|
if (fsTarget) {
|
|
1813
|
-
const targetName = ((
|
|
1814
|
-
|
|
1822
|
+
const targetName = ((_f = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || "DOWNPORT_ERROR";
|
|
1823
|
+
let type = `LIKE LINE OF ${sourceName}`;
|
|
1824
|
+
const f = foundType === null || foundType === void 0 ? void 0 : foundType.getType();
|
|
1825
|
+
if (f instanceof basic_1.TableType && f.getRowType() instanceof basic_1.AnyType) {
|
|
1826
|
+
type = "TYPE ANY";
|
|
1827
|
+
}
|
|
1828
|
+
const code = `FIELD-SYMBOLS ${targetName} ${type}.\n${indentation}`;
|
|
1815
1829
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|
|
1816
1830
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);
|
|
1817
1831
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -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
|
};
|
|
@@ -23,13 +23,13 @@ class EmptyEvent extends _abap_rule_1.ABAPRule {
|
|
|
23
23
|
shortDescription: `Empty selection screen or list processing event block`,
|
|
24
24
|
extendedInformation: ``,
|
|
25
25
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
26
|
-
badExample: `
|
|
27
|
-
INITIALIZATION.
|
|
28
|
-
WRITE 'hello'.
|
|
26
|
+
badExample: `
|
|
27
|
+
INITIALIZATION.
|
|
28
|
+
WRITE 'hello'.
|
|
29
29
|
END-OF-SELECTION.`,
|
|
30
|
-
goodExample: `
|
|
31
|
-
START-OF-SELECTION.
|
|
32
|
-
PERFORM sdf.
|
|
30
|
+
goodExample: `
|
|
31
|
+
START-OF-SELECTION.
|
|
32
|
+
PERFORM sdf.
|
|
33
33
|
COMMIT WORK.`,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -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.`,
|
|
@@ -46,13 +46,13 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
|
|
|
46
46
|
shortDescription: `Checks that the code does not contain empty blocks.`,
|
|
47
47
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-empty-if-branches`,
|
|
48
48
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
49
|
-
badExample: `IF foo = bar.
|
|
50
|
-
ENDIF.
|
|
51
|
-
|
|
52
|
-
DO 2 TIMES.
|
|
49
|
+
badExample: `IF foo = bar.
|
|
50
|
+
ENDIF.
|
|
51
|
+
|
|
52
|
+
DO 2 TIMES.
|
|
53
53
|
ENDDO.`,
|
|
54
|
-
goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
|
|
55
|
-
ENDLOOP.
|
|
54
|
+
goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
|
|
55
|
+
ENDLOOP.
|
|
56
56
|
result = xsdbool( sy-subrc = 0 ).`,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -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,9 +20,9 @@ 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
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-the-right-table-type
|
|
23
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-the-right-table-type
|
|
24
24
|
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key`,
|
|
25
|
-
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
25
|
+
badExample: `DATA lt_foo TYPE TABLE OF ty.
|
|
26
26
|
DATA lt_bar TYPE STANDARD TABLE OF ty.`,
|
|
27
27
|
goodExample: `DATA lt_foo TYPE STANDARD TABLE OF ty WITH EMPTY KEY.`,
|
|
28
28
|
tags: [_irule_1.RuleTag.SingleFile],
|