Class: PmdTester::Report
- Inherits:
-
Object
- Object
- PmdTester::Report
- Defined in:
- lib/pmdtester/report_diff.rb
Overview
A full report, created by the report XML parser, can be diffed with another report into a ReportDiff
Instance Attribute Summary collapse
-
#configerrors_by_rule ⇒ Object
readonly
Returns the value of attribute configerrors_by_rule.
-
#errors_by_file ⇒ Object
readonly
Returns the value of attribute errors_by_file.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#report_details ⇒ Object
readonly
Returns the value of attribute report_details.
-
#report_folder ⇒ Object
Returns the value of attribute report_folder.
-
#violations_by_file ⇒ Object
readonly
Returns the value of attribute violations_by_file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(report_details:, report_document:, file:) ⇒ Report
constructor
A new instance of Report.
- #rule_summaries ⇒ Object
Constructor Details
#initialize(report_details:, report_document:, file:) ⇒ Report
Returns a new instance of Report.
63 64 65 66 67 68 |
# File 'lib/pmdtester/report_diff.rb', line 63 def initialize(report_details:, report_document:, file:) initialize_empty initialize_with_report_document report_document unless report_document.nil? @report_details = report_details @file = file end |
Instance Attribute Details
#configerrors_by_rule ⇒ Object (readonly)
Returns the value of attribute configerrors_by_rule.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def configerrors_by_rule @configerrors_by_rule end |
#errors_by_file ⇒ Object (readonly)
Returns the value of attribute errors_by_file.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def errors_by_file @errors_by_file end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def file @file end |
#report_details ⇒ Object (readonly)
Returns the value of attribute report_details.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def report_details @report_details end |
#report_folder ⇒ Object
Returns the value of attribute report_folder.
61 62 63 |
# File 'lib/pmdtester/report_diff.rb', line 61 def report_folder @report_folder end |
#violations_by_file ⇒ Object (readonly)
Returns the value of attribute violations_by_file.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def violations_by_file @violations_by_file end |
Class Method Details
.empty ⇒ Object
70 71 72 |
# File 'lib/pmdtester/report_diff.rb', line 70 def self.empty new(report_details: PmdTester::PmdReportDetail.empty, report_document: nil, file: '') end |
Instance Method Details
#rule_summaries ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pmdtester/report_diff.rb', line 74 def rule_summaries summary = {} @violations_by_file.each_value do |violation| unless summary.key?(violation.rule_name) summary[violation.rule_name] = { 'name' => violation.rule_name, 'info_url' => violation.info_url, 'count' => 0 } end summary[violation.rule_name]['count'] += 1 end summary.values end |