File tree Expand file tree Collapse file tree 7 files changed +33
-2
lines changed
resources/summary_report_builder Expand file tree Collapse file tree 7 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 2626* [ #19 ] ( https://github.com/pmd/pmd-regression-tester/pull/19 ) : Add online mode for PmdTester - [ BBG] ( https://github.com/djydewang )
2727* [ #20 ] ( https://github.com/pmd/pmd-regression-tester/pull/20 ) : Change the way of parsing xml file from DOM to SAX - [ BBG] ( https://github.com/djydewang )
2828* [ #21 ] ( https://github.com/pmd/pmd-regression-tester/pull/21 ) : Add auto-gen-config option for PmdTester - [ BBG] ( https://github.com/djydewang )
29+ * [ #22 ] ( https://github.com/pmd/pmd-regression-tester/pull/22 ) : Add 'introduce new errors' table head for html summary report - [ BBG] ( https://github.com/djydewang )
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ def build_projects_table_head(doc)
125125 doc . th 'project name'
126126 doc . th 'project branch/tag'
127127 doc . th 'diff exist?'
128+ doc . th 'introduce new errors?'
128129 end
129130 end
130131 end
@@ -136,8 +137,9 @@ def build_projects_table_body(doc)
136137 doc . td do
137138 doc . a ( href : project . diff_report_index_ref_path ) { doc . text project . name }
138139 end
139- doc . td project . tag . nil? ? 'master' : project . tag
140- doc . td project . report_diff . diffs_exist? ? 'Yes' : 'No'
140+ doc . td project . tag
141+ doc . td project . diffs_exist? ? 'Yes' : 'No'
142+ doc . td project . introduce_new_errors? ? 'Yes' : 'No'
141143 end
142144 end
143145 end
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ def initialize(project)
3333 project . xpath ( 'exclude-pattern' ) . each do |ep |
3434 @exclude_pattern . push ( ep . text )
3535 end
36+
37+ @report_diff = nil
3638 end
3739
3840 # Generate the default webview url for the projects
@@ -98,5 +100,13 @@ def diff_report_index_path
98100 def diff_report_index_ref_path
99101 "./#{ name } /index.html"
100102 end
103+
104+ def diffs_exist?
105+ @report_diff . diffs_exist?
106+ end
107+
108+ def introduce_new_errors?
109+ @report_diff . introduce_new_errors?
110+ end
101111 end
102112end
Original file line number Diff line number Diff line change @@ -96,5 +96,15 @@ def get_diffs_size(diffs_hash)
9696 end
9797 size
9898 end
99+
100+ def introduce_new_errors?
101+ @error_diffs . values . each do |pmd_errors |
102+ pmd_errors . each do |pmd_error |
103+ return true if pmd_error . branch . eql? ( 'patch' )
104+ end
105+ end
106+
107+ false
108+ end
99109 end
100110end
Original file line number Diff line number Diff line change @@ -48,22 +48,26 @@ <h2>Projects:</h2>
4848< th > project name</ th >
4949< th > project branch/tag</ th >
5050< th > diff exist?</ th >
51+ < th > introduce new errors?</ th >
5152</ tr > </ thead >
5253< tbody >
5354< tr >
5455< td > < a href ="./checkstyle/index.html "> checkstyle</ a > </ td >
5556< td > master</ td >
5657< td > Yes</ td >
58+ < td > Yes</ td >
5759</ tr >
5860< tr >
5961< td > < a href ="./openjdk10/index.html "> openjdk10</ a > </ td >
6062< td > master</ td >
6163< td > No</ td >
64+ < td > No</ td >
6265</ tr >
6366< tr >
6467< td > < a href ="./spring-framework/index.html "> spring-framework</ a > </ td >
6568< td > v5.0.6.RELEASE</ td >
6669< td > No</ td >
70+ < td > No</ td >
6771</ tr >
6872</ tbody >
6973</ table >
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def test_violation_diffs
3636 assert_equal ( 'Patch3.java' , keys [ 4 ] )
3737
3838 assert_equal ( '00:00:56' , diffs_report . diff_execution_time )
39+ assert_equal ( false , diffs_report . introduce_new_errors? )
3940 end
4041
4142 def test_error_diffs
@@ -58,6 +59,7 @@ def test_error_diffs
5859 assert_equal ( 'Both2.java' , keys [ 1 ] )
5960 assert_equal ( 2 , error_diffs [ 'Both2.java' ] . size )
6061 assert_equal ( 'Patch1.java' , keys [ 2 ] )
62+ assert_equal ( true , diffs_report . introduce_new_errors? )
6163 end
6264
6365 def test_diff_exist
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ def test_summary_report_builder
1515 projects = PmdTester ::ProjectsParser . new . parse ( 'test/resources/project-list.xml' )
1616 report_diff = mock
1717 report_diff . expects ( :diffs_exist? ) . returns ( false ) . twice
18+ report_diff . expects ( :introduce_new_errors? ) . returns ( false ) . twice
1819 report_diff . expects ( :diffs_exist? ) . returns ( true ) . once
20+ report_diff . expects ( :introduce_new_errors? ) . returns ( true ) . once
1921 projects [ 0 ] . report_diff = report_diff
2022 projects [ 1 ] . report_diff = report_diff
2123 projects [ 2 ] . report_diff = report_diff
You can’t perform that action at this time.
0 commit comments