Skip to content

Commit 3f7b445

Browse files
Eugen Güntherlucasborin
andauthored
adjust of ignore pseudocomment on relevant checks (#375)
* adjust of ignore pseudocomment on relevant checks * update * update Co-authored-by: Lucas Borin <[email protected]>
1 parent 159848e commit 3f7b445

8 files changed

+85
-87
lines changed

src/checks/y_check_branch_coverage.clas.abap

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CLASS y_check_branch_coverage DEFINITION PUBLIC INHERITING FROM y_check_base CRE
55
PROTECTED SECTION.
66
METHODS execute_check REDEFINITION.
77
METHODS inspect_tokens REDEFINITION.
8-
98
ENDCLASS.
109

1110

@@ -24,6 +23,7 @@ CLASS y_check_branch_coverage IMPLEMENTATION.
2423
settings-disable_on_prodcode_selection = abap_true.
2524
settings-disable_on_testcode_selection = abap_true.
2625
settings-apply_on_test_code = abap_false.
26+
settings-ignore_pseudo_comments = abap_true.
2727
settings-documentation = |{ c_docs_path-checks }unit-test-coverages.md|.
2828

2929
set_check_message( 'Branch Coverage must be higher than &2%! (&1%<=&2%)' ).
@@ -50,21 +50,19 @@ CLASS y_check_branch_coverage IMPLEMENTATION.
5050
RETURN.
5151
ENDIF.
5252

53-
raise_error( statement_level = 1
54-
statement_index = 1
55-
statement_from = 1
56-
error_priority = check_configuration-prio
57-
parameter_01 = |{ branch }|
58-
parameter_02 = |{ check_configuration-threshold }|
59-
parameter_03 = |{ coverage->get_total( ) }|
60-
parameter_04 = |{ coverage->get_executed( ) }| ).
53+
raise_error( statement_level = 1
54+
statement_index = 1
55+
statement_from = 1
56+
error_priority = check_configuration-prio
57+
parameter_01 = |{ branch }|
58+
parameter_02 = |{ check_configuration-threshold }|
59+
parameter_03 = |{ coverage->get_total( ) }|
60+
parameter_04 = |{ coverage->get_executed( ) }| ).
6161

6262
ENDMETHOD.
6363

6464

6565
METHOD inspect_tokens.
6666
RETURN.
6767
ENDMETHOD.
68-
69-
7068
ENDCLASS.

src/checks/y_check_comment_position.clas.abap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ ENDCLASS.
2626

2727

2828

29-
CLASS Y_CHECK_COMMENT_POSITION IMPLEMENTATION.
29+
CLASS y_check_comment_position IMPLEMENTATION.
3030

3131

3232
METHOD constructor.
3333
super->constructor( ).
3434

3535
settings-disable_threshold_selection = abap_true.
36+
settings-ignore_pseudo_comments = abap_true.
3637
settings-threshold = 0.
3738
settings-documentation = |{ c_docs_path-checks }comment-position.md|.
3839

@@ -41,7 +42,6 @@ CLASS Y_CHECK_COMMENT_POSITION IMPLEMENTATION.
4142

4243

4344
METHOD inspect_tokens.
44-
4545
CHECK statement-type = 'P'.
4646
CHECK has_wrong_position( statement ).
4747

@@ -53,8 +53,8 @@ CLASS Y_CHECK_COMMENT_POSITION IMPLEMENTATION.
5353

5454
raise_error( statement_level = statement-level
5555
statement_index = index
56-
statement_from = statement-from
57-
error_priority = configuration-prio ).
56+
statement_from = statement-from
57+
error_priority = configuration-prio ).
5858

5959
ENDMETHOD.
6060

src/checks/y_check_comment_type.clas.abap

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@ CLASS y_check_comment_type DEFINITION PUBLIC INHERITING FROM y_check_base CREATE
99
METHODS get_second_character IMPORTING token TYPE stokesx RETURNING VALUE(result) TYPE char1.
1010
ENDCLASS.
1111

12+
13+
1214
CLASS y_check_comment_type IMPLEMENTATION.
1315

16+
1417
METHOD constructor.
1518
super->constructor( ).
1619

1720
settings-disable_threshold_selection = abap_true.
21+
settings-ignore_pseudo_comments = abap_true.
1822
settings-threshold = 0.
1923
settings-documentation = |{ c_docs_path-checks }comment-type.md|.
2024

2125
set_check_message( 'Comment with ", not with *!' ).
2226
ENDMETHOD.
2327

24-
METHOD inspect_tokens.
2528

29+
METHOD inspect_tokens.
2630
CHECK statement-type = 'P'.
2731
CHECK has_wrong_comment_type( statement ).
2832

@@ -34,11 +38,12 @@ CLASS y_check_comment_type IMPLEMENTATION.
3438

3539
raise_error( statement_level = statement-level
3640
statement_index = index
37-
statement_from = statement-from
38-
error_priority = configuration-prio ).
41+
statement_from = statement-from
42+
error_priority = configuration-prio ).
3943

4044
ENDMETHOD.
4145

46+
4247
METHOD has_wrong_comment_type.
4348
LOOP AT ref_scan_manager->tokens ASSIGNING FIELD-SYMBOL(<token>)
4449
FROM statement-from TO statement-to.
@@ -50,6 +55,7 @@ CLASS y_check_comment_type IMPLEMENTATION.
5055
ENDLOOP.
5156
ENDMETHOD.
5257

58+
5359
METHOD get_first_character.
5460
TRY.
5561
result = token-str(1).
@@ -58,12 +64,12 @@ CLASS y_check_comment_type IMPLEMENTATION.
5864
ENDTRY.
5965
ENDMETHOD.
6066

67+
6168
METHOD get_second_character.
6269
TRY.
6370
result = token-str(2).
6471
CATCH cx_sy_range_out_of_bounds.
6572
result = ''.
6673
ENDTRY.
6774
ENDMETHOD.
68-
6975
ENDCLASS.

src/checks/y_check_comment_usage.clas.abap

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ CLASS y_check_comment_usage DEFINITION PUBLIC INHERITING FROM y_check_base CREAT
1515

1616
METHODS check_result IMPORTING structure TYPE sstruc.
1717

18-
METHODS is_code_disabled IMPORTING structure TYPE sstruc
19-
statement TYPE sstmnt
18+
METHODS is_code_disabled IMPORTING structure TYPE sstruc
19+
statement TYPE sstmnt
2020
RETURNING VALUE(result) TYPE abap_bool.
2121

2222
ENDCLASS.
@@ -32,6 +32,7 @@ CLASS y_check_comment_usage IMPLEMENTATION.
3232
settings-prio = c_note.
3333
settings-threshold = 10.
3434
settings-documentation = |{ c_docs_path-checks }comment-usage.md|.
35+
settings-ignore_pseudo_comments = abap_true.
3536

3637
relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_definition )
3738
( scan_struc_stmnt_type-class_implementation )
@@ -57,7 +58,6 @@ CLASS y_check_comment_usage IMPLEMENTATION.
5758
METHOD inspect_tokens.
5859
DATA(code_disabled) = is_code_disabled( statement = statement
5960
structure = structure ).
60-
6161
IF code_disabled = abap_true.
6262
RETURN.
6363
ENDIF.
@@ -97,13 +97,13 @@ CLASS y_check_comment_usage IMPLEMENTATION.
9797
RETURN.
9898
ENDIF.
9999

100-
raise_error( statement_level = statement_for_message-level
101-
statement_index = structure-stmnt_from
102-
statement_from = statement_for_message-from
103-
error_priority = check_configuration-prio
104-
parameter_01 = |{ comment_number }|
105-
parameter_02 = |{ percentage_of_comments }|
106-
parameter_03 = |{ check_configuration-threshold }| ).
100+
raise_error( statement_level = statement_for_message-level
101+
statement_index = structure-stmnt_from
102+
statement_from = statement_for_message-from
103+
error_priority = check_configuration-prio
104+
parameter_01 = |{ comment_number }|
105+
parameter_02 = |{ percentage_of_comments }|
106+
parameter_03 = |{ check_configuration-threshold }| ).
107107
ENDMETHOD.
108108

109109

@@ -129,6 +129,4 @@ CLASS y_check_comment_usage IMPLEMENTATION.
129129

130130
result = xsdbool( is_function_module = abap_false ).
131131
ENDMETHOD.
132-
133-
134132
ENDCLASS.

src/checks/y_check_procedure_coverage.clas.abap

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CLASS y_check_procedure_coverage DEFINITION PUBLIC INHERITING FROM y_check_base
55
PROTECTED SECTION.
66
METHODS execute_check REDEFINITION.
77
METHODS inspect_tokens REDEFINITION.
8-
98
ENDCLASS.
109

1110

@@ -24,6 +23,7 @@ CLASS y_check_procedure_coverage IMPLEMENTATION.
2423
settings-disable_on_prodcode_selection = abap_true.
2524
settings-disable_on_testcode_selection = abap_true.
2625
settings-apply_on_test_code = abap_false.
26+
settings-ignore_pseudo_comments = abap_true.
2727
settings-documentation = |{ c_docs_path-checks }unit-test-coverages.md|.
2828

2929
set_check_message( 'Procedure Coverage must be higher than &2%! (&1%<=&2%)' ).
@@ -50,21 +50,19 @@ CLASS y_check_procedure_coverage IMPLEMENTATION.
5050
RETURN.
5151
ENDIF.
5252

53-
raise_error( statement_level = 1
54-
statement_index = 1
55-
statement_from = 1
56-
error_priority = check_configuration-prio
57-
parameter_01 = |{ procedure }|
58-
parameter_02 = |{ check_configuration-threshold }|
59-
parameter_03 = |{ coverage->get_total( ) }|
60-
parameter_04 = |{ coverage->get_executed( ) }| ).
53+
raise_error( statement_level = 1
54+
statement_index = 1
55+
statement_from = 1
56+
error_priority = check_configuration-prio
57+
parameter_01 = |{ procedure }|
58+
parameter_02 = |{ check_configuration-threshold }|
59+
parameter_03 = |{ coverage->get_total( ) }|
60+
parameter_04 = |{ coverage->get_executed( ) }| ).
6161

6262
ENDMETHOD.
6363

6464

6565
METHOD inspect_tokens.
6666
RETURN.
6767
ENDMETHOD.
68-
69-
7068
ENDCLASS.

src/checks/y_check_profile_message.clas.abap

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ CLASS y_check_profile_message DEFINITION PUBLIC INHERITING FROM y_check_base CRE
1111
CLASS-DATA ran TYPE abap_bool.
1212
METHODS get_profiles RETURNING VALUE(result) TYPE y_if_profile_manager=>profile_assignments.
1313
METHODS list_profiles IMPORTING profiles TYPE y_if_profile_manager=>profile_assignments
14-
RETURNING value(result) TYPE string.
14+
RETURNING VALUE(result) TYPE string.
1515
ENDCLASS.
1616

17+
18+
1719
CLASS y_check_profile_message IMPLEMENTATION.
1820

1921

@@ -28,6 +30,7 @@ CLASS y_check_profile_message IMPLEMENTATION.
2830
settings-threshold = 0.
2931
settings-apply_on_test_code = abap_true.
3032
settings-apply_on_productive_code = abap_true.
33+
settings-ignore_pseudo_comments = abap_true.
3134
settings-prio = c_note.
3235

3336
set_check_message( '&1 Profile(s) in use: &2.' ).
@@ -46,12 +49,12 @@ CLASS y_check_profile_message IMPLEMENTATION.
4649

4750
DATA(profiles) = get_profiles( ).
4851

49-
raise_error( statement_level = 1
50-
statement_index = 1
51-
statement_from = 1
52-
error_priority = check_configuration-prio
53-
parameter_01 = |{ lines( profiles ) }|
54-
parameter_02 = |{ list_profiles( profiles ) }| ).
52+
raise_error( statement_level = 1
53+
statement_index = 1
54+
statement_from = 1
55+
error_priority = check_configuration-prio
56+
parameter_01 = |{ lines( profiles ) }|
57+
parameter_02 = |{ list_profiles( profiles ) }| ).
5558

5659
ran = abap_true.
5760
ENDMETHOD.
@@ -63,24 +66,24 @@ CLASS y_check_profile_message IMPLEMENTATION.
6366

6467

6568
METHOD inform.
66-
super->inform( p_sub_obj_type = 'TRAN'
67-
p_sub_obj_name = 'Y_CODE_PAL_PROFILE'
68-
p_position = ''
69-
p_line = ''
70-
p_column = ''
71-
p_errcnt = p_errcnt
72-
p_kind = p_kind
73-
p_test = p_test
74-
p_code = p_code
75-
p_suppress = p_suppress
76-
p_param_1 = p_param_1
77-
p_param_2 = p_param_2
78-
p_param_3 = p_param_3
79-
p_param_4 = p_param_4
80-
p_inclspec = p_inclspec
81-
p_detail = p_detail
82-
p_checksum_1 = p_checksum_1
83-
p_comments = p_comments ).
69+
super->inform( p_sub_obj_type = 'TRAN'
70+
p_sub_obj_name = 'Y_CODE_PAL_PROFILE'
71+
p_position = ''
72+
p_line = ''
73+
p_column = ''
74+
p_errcnt = p_errcnt
75+
p_kind = p_kind
76+
p_test = p_test
77+
p_code = p_code
78+
p_suppress = p_suppress
79+
p_param_1 = p_param_1
80+
p_param_2 = p_param_2
81+
p_param_3 = p_param_3
82+
p_param_4 = p_param_4
83+
p_inclspec = p_inclspec
84+
p_detail = p_detail
85+
p_checksum_1 = p_checksum_1
86+
p_comments = p_comments ).
8487
ENDMETHOD.
8588

8689

@@ -99,6 +102,4 @@ CLASS y_check_profile_message IMPLEMENTATION.
99102
ELSE |{ result }, { <profile>-profile }| ).
100103
ENDLOOP.
101104
ENDMETHOD.
102-
103-
104105
ENDCLASS.

src/checks/y_check_pseudo_comment_usage.clas.abap

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ CLASS y_check_pseudo_comment_usage DEFINITION PUBLIC INHERITING FROM y_check_bas
1818
METHODS check_result.
1919

2020
METHODS select_object_list RETURNING VALUE(result) LIKE name_tab
21-
RAISING cx_failed.
21+
RAISING cx_failed.
2222

23-
METHODS call_get_pseudo_comment IMPORTING obj_name TYPE stokesx-str
23+
METHODS call_get_pseudo_comment IMPORTING obj_name TYPE stokesx-str
2424
RETURNING VALUE(result) TYPE stokesx-str
25-
RAISING cx_sy_create_object_error.
25+
RAISING cx_sy_create_object_error.
2626

2727
ENDCLASS.
2828

@@ -52,6 +52,7 @@ CLASS y_check_pseudo_comment_usage IMPLEMENTATION.
5252
settings-threshold = 0.
5353
settings-apply_on_test_code = abap_true.
5454
settings-apply_on_productive_code = abap_true.
55+
settings-ignore_pseudo_comments = abap_true.
5556
settings-prio = c_note.
5657

5758
relevant_statement_types = VALUE #( BASE relevant_statement_types
@@ -112,8 +113,8 @@ CLASS y_check_pseudo_comment_usage IMPLEMENTATION.
112113
raise_error( statement_level = 1
113114
statement_index = 1
114115
statement_from = 1
115-
error_priority = check_configuration-prio
116-
parameter_01 = |{ pseudo_comment_counter }| ).
116+
error_priority = check_configuration-prio
117+
parameter_01 = |{ pseudo_comment_counter }| ).
117118
ENDMETHOD.
118119

119120

@@ -137,6 +138,4 @@ CLASS y_check_pseudo_comment_usage IMPLEMENTATION.
137138
RAISE EXCEPTION TYPE cx_failed.
138139
ENDIF.
139140
ENDMETHOD.
140-
141-
142141
ENDCLASS.

0 commit comments

Comments
 (0)