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.
-
#exec_time ⇒ Object
readonly
Returns the value of attribute exec_time.
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#report_folder ⇒ Object
Returns the value of attribute report_folder.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#violations_by_file ⇒ Object
readonly
Returns the value of attribute violations_by_file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(report_document: nil, file: '', exec_time: 0, timestamp: '0', exit_code: '?') ⇒ Report
constructor
A new instance of Report.
- #rule_summaries ⇒ Object
Constructor Details
#initialize(report_document: nil, file: '', exec_time: 0, timestamp: '0', exit_code: '?') ⇒ Report
Returns a new instance of Report.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/pmdtester/report_diff.rb', line 65 def initialize(report_document: nil, file: '', exec_time: 0, timestamp: '0', exit_code: '?') initialize_empty initialize_with_report_document report_document unless report_document.nil? @exec_time = exec_time @timestamp = @file = file @exit_code = exit_code 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 |
#exec_time ⇒ Object (readonly)
Returns the value of attribute exec_time.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def exec_time @exec_time end |
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def exit_code @exit_code 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_folder ⇒ Object
Returns the value of attribute report_folder.
63 64 65 |
# File 'lib/pmdtester/report_diff.rb', line 63 def report_folder @report_folder end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
55 56 57 |
# File 'lib/pmdtester/report_diff.rb', line 55 def @timestamp 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
78 79 80 |
# File 'lib/pmdtester/report_diff.rb', line 78 def self.empty new end |
Instance Method Details
#rule_summaries ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pmdtester/report_diff.rb', line 82 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 |