@@ -45,7 +45,11 @@ def test_case_1_single_java_rule_changed
45
45
assert_equal ( 0 , @summary [ :violations ] [ :changed ] , 'found changed violations' )
46
46
assert_equal ( 0 , @summary [ :violations ] [ :new ] , 'found new violations' )
47
47
# These are the artificially created false-negatives for AbstractClassWithoutAbstractMethod rule
48
- assert_equal ( 34 + 234 , @summary [ :violations ] [ :removed ] , 'found removed violations' )
48
+ # checkstyle: 203 violations
49
+ # spring-framework: 280 violations
50
+ # openjdk11: 29 violations
51
+ # -> total = 512
52
+ assert_equal ( 203 + 280 + 29 , @summary [ :violations ] [ :removed ] , 'found removed violations' )
49
53
50
54
# errors might have been caused in the baseline for other rules (only visible in the stacktrace)
51
55
# hence they might appear as removed
@@ -55,12 +59,12 @@ def test_case_1_single_java_rule_changed
55
59
assert_equal ( 0 , @summary [ :configerrors ] [ :changed ] , 'found changed configerrors' )
56
60
assert_equal ( 0 , @summary [ :configerrors ] [ :new ] , 'found new configerrors' )
57
61
# Only the rule AbstractClassWithoutAbtractMethod has been executed, so the
58
- # configerrors about LoosePackageCoupling are gone
59
- assert_equal ( 1 + 1 , @summary [ :configerrors ] [ :removed ] , 'found removed configerrors' )
62
+ # configerrors about LoosePackageCoupling are gone, one for each project
63
+ assert_equal ( 1 + 1 + 1 , @summary [ :configerrors ] [ :removed ] , 'found removed configerrors' )
60
64
61
65
assert_equal ( "This changeset changes 0 violations,\n " \
62
66
"introduces 0 new violations, 0 new errors and 0 new configuration errors,\n " \
63
- 'removes 268 violations, 0 errors and 2 configuration errors.' ,
67
+ 'removes 512 violations, 1 errors and 3 configuration errors.' ,
64
68
create_summary_message )
65
69
66
70
assert_file_equals ( "#{ PATCHES_PATH } /expected_patch_config_1.xml" , 'target/reports/diff/patch_config.xml' )
@@ -79,8 +83,8 @@ def test_case_2_single_xpath_rule_changed
79
83
"#{ @summary } \n #############################\n "
80
84
assert_equal ( 0 , @summary [ :violations ] [ :changed ] , 'found changed violations' )
81
85
assert_equal ( 0 , @summary [ :violations ] [ :new ] , 'found new violations' )
82
- # There are no violations, that have been removed for AvoidMessageDigestField
83
- assert_equal ( 0 , @summary [ :violations ] [ :removed ] , 'found removed violations' )
86
+ # There are 22 violations, that have been removed for AvoidMessageDigestField (project openjdk-11)
87
+ assert_equal ( 22 , @summary [ :violations ] [ :removed ] , 'found removed violations' )
84
88
85
89
# errors might have been caused in the baseline for other rules (only visible in the stacktrace)
86
90
# hence they might appear as removed
@@ -90,12 +94,12 @@ def test_case_2_single_xpath_rule_changed
90
94
assert_equal ( 0 , @summary [ :configerrors ] [ :changed ] , 'found changed configerrors' )
91
95
assert_equal ( 0 , @summary [ :configerrors ] [ :new ] , 'found new configerrors' )
92
96
# Only the rule AvoidMessageDigestField and all other rules from bestpractices have been executed, so the
93
- # configerrors about LoosePackageCoupling (Design) are gone
94
- assert_equal ( 1 + 1 , @summary [ :configerrors ] [ :removed ] , 'found removed configerrors' )
97
+ # configerrors about LoosePackageCoupling are gone, one for each project
98
+ assert_equal ( 1 + 1 + 1 , @summary [ :configerrors ] [ :removed ] , 'found removed configerrors' )
95
99
96
100
assert_equal ( "This changeset changes 0 violations,\n " \
97
101
"introduces 0 new violations, 0 new errors and 0 new configuration errors,\n " \
98
- 'removes 0 violations, 0 errors and 2 configuration errors.' ,
102
+ 'removes 22 violations, 1 errors and 3 configuration errors.' ,
99
103
create_summary_message )
100
104
101
105
assert_file_equals ( "#{ PATCHES_PATH } /expected_patch_config_2.xml" , 'target/reports/diff/patch_config.xml' )
@@ -161,7 +165,7 @@ def test_case_5_create_baseline
161
165
'--html-flag' ,
162
166
'--error-recovery' ]
163
167
begin
164
- ENV [ 'LANG' ] = 'C .UTF-8'
168
+ ENV [ 'LANG' ] = 'en_US .UTF-8'
165
169
@summary = PmdTester ::Runner . new ( argv ) . run
166
170
rescue StandardError => e
167
171
raise MiniTest ::Assertion , "Running pmdtester failed: #{ e . inspect } "
@@ -185,13 +189,17 @@ def run_pmd_tester(base_branch_name = 'master')
185
189
'--baseline-download-url' , 'https://pmd-code.org/pmd-regression-tester/' ,
186
190
'--debug' ]
187
191
begin
188
- ENV [ 'LANG' ] = 'C .UTF-8'
192
+ ENV [ 'LANG' ] = 'en_US .UTF-8'
189
193
@summary = PmdTester ::Runner . new ( argv ) . run
190
194
rescue StandardError => e
191
195
raise MiniTest ::Assertion , "Running pmdtester failed: #{ e . inspect } "
192
196
end
193
197
end
194
198
199
+ #
200
+ # This is the same message as in
201
+ # https://github.com/pmd/pmd/blob/master/Dangerfile
202
+ #
195
203
def create_summary_message
196
204
'This changeset ' \
197
205
"changes #{ @summary [ :violations ] [ :changed ] } violations,\n " \
@@ -225,19 +233,24 @@ def prepare_patch_branch(patch_file, local_branch, base_branch = 'master')
225
233
system ( "git branch -D #{ local_branch } " )
226
234
system ( "git branch #{ local_branch } #{ base_branch } " )
227
235
system ( "git checkout #{ local_branch } " )
228
- system ( "git am --committer-date-is-author-date #{ absolute_patch_file } " )
236
+ system ( "git am --committer-date-is-author-date --no-gpg-sign #{ absolute_patch_file } " )
229
237
end
230
238
end
231
239
232
240
def assert_master_baseline
233
241
assert_path_exist ( 'target/reports/master/checkstyle/config.xml' )
234
242
assert_path_exist ( 'target/reports/master/checkstyle/report_info.json' )
235
243
assert_path_exist ( 'target/reports/master/checkstyle/pmd_report.xml' )
236
- assert ( File . size ( 'target/reports/master/checkstyle/pmd_report.xml' ) > 20 * 1024 * 1024 )
244
+ assert ( File . size ( 'target/reports/master/checkstyle/pmd_report.xml' ) > 50 * 1024 * 1024 )
245
+
246
+ assert_path_exist ( 'target/reports/master/openjdk-11/config.xml' )
247
+ assert_path_exist ( 'target/reports/master/openjdk-11/report_info.json' )
248
+ assert_path_exist ( 'target/reports/master/openjdk-11/pmd_report.xml' )
249
+ assert ( File . size ( 'target/reports/master/openjdk-11/pmd_report.xml' ) > 100 * 1024 * 1024 )
237
250
238
251
assert_path_exist ( 'target/reports/master/spring-framework/config.xml' )
239
252
assert_path_exist ( 'target/reports/master/spring-framework/report_info.json' )
240
253
assert_path_exist ( 'target/reports/master/spring-framework/pmd_report.xml' )
241
- assert ( File . size ( 'target/reports/master/spring-framework/pmd_report.xml' ) > 130 * 1024 * 1024 )
254
+ assert ( File . size ( 'target/reports/master/spring-framework/pmd_report.xml' ) > 150 * 1024 * 1024 )
242
255
end
243
256
end
0 commit comments