Module: PmdTester::CpdProjectHasher
Overview
Turn a CPD project report into a hash that can be rendered somewhere else
Constant Summary
Constants included
from PmdTester
BASE, PATCH, PR_NUM_ENV_VAR, VERSION
Instance Method Summary
collapse
Methods included from PmdTester
#logger, logger
Instance Method Details
#cpd_errors_to_h(project) ⇒ Object
39
40
41
42
|
# File 'lib/pmdtester/builders/cpd_project_hasher.rb', line 39
def cpd_errors_to_h(project)
errors = project.cpd_report_diff.error_diffs
errors.map { |e| error_to_hash(e, project) }
end
|
#cpd_report_diff_to_h(cpd_rdiff) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/pmdtester/builders/cpd_project_hasher.rb', line 8
def cpd_report_diff_to_h(cpd_rdiff)
{
'duplication_counts' => cpd_rdiff.duplication_counts.to_h.transform_keys(&:to_s),
'error_counts' => cpd_rdiff.error_counts.to_h.transform_keys(&:to_s),
'base_details' => cpd_rdiff.base_report.report_details.to_h,
'patch_details' => cpd_rdiff.patch_report.report_details.to_h,
'diff_execution_time' => PmdReportDetail.convert_seconds(cpd_rdiff.patch_report.report_details.execution_time -
cpd_rdiff.base_report.report_details.execution_time)
}
end
|
#duplications_to_hash(project, duplications, is_diff) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/pmdtester/builders/cpd_project_hasher.rb', line 20
def duplications_to_hash(project, duplications, is_diff)
filename_index = {}
duplications.each do |d|
d.files.each do |f|
local_path = project.get_local_path(f.path)
filename_index[local_path] = filename_index.size unless filename_index.include?(local_path)
end
end
duplications_table = duplications.map do |d|
make_duplication_table(project, filename_index, d, is_diff)
end
{
'file_index' => filename_index.keys,
'duplications' => duplications_table
}
end
|