Class: PmdTester::ReportDiff
- Inherits:
-
Object
- Object
- PmdTester::ReportDiff
- Includes:
- PmdTester
- Defined in:
- lib/pmdtester/report_diff.rb
Overview
This class represents all the diff report information, including the summary information of the original pmd reports, as well as the specific information of the diff report.
Constant Summary
Constants included from PmdTester
BASE, PATCH, PR_NUM_ENV_VAR, VERSION
Instance Attribute Summary collapse
-
#base_report ⇒ Object
Returns the value of attribute base_report.
-
#configerror_counts ⇒ Object
readonly
Returns the value of attribute configerror_counts.
-
#configerror_diffs_by_rule ⇒ Object
Returns the value of attribute configerror_diffs_by_rule.
-
#error_counts ⇒ Object
readonly
Returns the value of attribute error_counts.
-
#error_diffs_by_file ⇒ Object
Returns the value of attribute error_diffs_by_file.
-
#patch_report ⇒ Object
Returns the value of attribute patch_report.
-
#rule_infos_union ⇒ Object
Returns the value of attribute rule_infos_union.
-
#violation_counts ⇒ Object
readonly
Returns the value of attribute violation_counts.
-
#violation_diffs_by_file ⇒ Object
Returns the value of attribute violation_diffs_by_file.
Instance Method Summary collapse
-
#initialize(base_report:, patch_report:) ⇒ ReportDiff
constructor
A new instance of ReportDiff.
- #rule_summaries ⇒ Object
Methods included from PmdTester
Constructor Details
#initialize(base_report:, patch_report:) ⇒ ReportDiff
Returns a new instance of ReportDiff.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/pmdtester/report_diff.rb', line 138 def initialize(base_report:, patch_report:) @violation_counts = RunningDiffCounters.new(base_report.violations_by_file.total_size) @error_counts = RunningDiffCounters.new(base_report.errors_by_file.total_size) @configerror_counts = RunningDiffCounters.new(base_report.configerrors_by_rule.values.flatten.length) @violation_diffs_by_file = {} @error_diffs_by_file = {} @configerror_diffs_by_rule = {} @rule_infos_union = {} @base_report = base_report @patch_report = patch_report @violation_diffs_by_rule = {} diff_with(patch_report) end |
Instance Attribute Details
#base_report ⇒ Object
Returns the value of attribute base_report.
135 136 137 |
# File 'lib/pmdtester/report_diff.rb', line 135 def base_report @base_report end |
#configerror_counts ⇒ Object (readonly)
Returns the value of attribute configerror_counts.
128 129 130 |
# File 'lib/pmdtester/report_diff.rb', line 128 def configerror_counts @configerror_counts end |
#configerror_diffs_by_rule ⇒ Object
Returns the value of attribute configerror_diffs_by_rule.
132 133 134 |
# File 'lib/pmdtester/report_diff.rb', line 132 def configerror_diffs_by_rule @configerror_diffs_by_rule end |
#error_counts ⇒ Object (readonly)
Returns the value of attribute error_counts.
126 127 128 |
# File 'lib/pmdtester/report_diff.rb', line 126 def error_counts @error_counts end |
#error_diffs_by_file ⇒ Object
Returns the value of attribute error_diffs_by_file.
131 132 133 |
# File 'lib/pmdtester/report_diff.rb', line 131 def error_diffs_by_file @error_diffs_by_file end |
#patch_report ⇒ Object
Returns the value of attribute patch_report.
136 137 138 |
# File 'lib/pmdtester/report_diff.rb', line 136 def patch_report @patch_report end |
#rule_infos_union ⇒ Object
Returns the value of attribute rule_infos_union.
134 135 136 |
# File 'lib/pmdtester/report_diff.rb', line 134 def rule_infos_union @rule_infos_union end |
#violation_counts ⇒ Object (readonly)
Returns the value of attribute violation_counts.
127 128 129 |
# File 'lib/pmdtester/report_diff.rb', line 127 def violation_counts @violation_counts end |
#violation_diffs_by_file ⇒ Object
Returns the value of attribute violation_diffs_by_file.
130 131 132 |
# File 'lib/pmdtester/report_diff.rb', line 130 def violation_diffs_by_file @violation_diffs_by_file end |
Instance Method Details
#rule_summaries ⇒ Object
155 156 157 158 159 160 161 162 163 |
# File 'lib/pmdtester/report_diff.rb', line 155 def rule_summaries @violation_diffs_by_rule.map do |(rule, counters)| { 'name' => rule, 'info_url' => @rule_infos_union[rule].info_url, **counters.to_h.transform_keys(&:to_s) } end end |