Skip to content

Commit 1eeb92a

Browse files
committed
Add header and timestamp to index page
1 parent 1ad4d24 commit 1eeb92a

File tree

12 files changed

+58
-4
lines changed

12 files changed

+58
-4
lines changed

lib/pmdtester/builders/summary_report_builder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def to_liquid(details, config_name)
8080
'sha' => details.branch_last_sha,
8181
'message' => details.branch_last_message
8282
},
83+
'timestamp' => details.timestamp,
8384
'execution_time' => PmdReportDetail.convert_seconds(details.execution_time),
8485
'jdk_info' => details.jdk_version,
8586
'locale' => details.language,

lib/pmdtester/pmd_branch_detail.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class PmdBranchDetail
1010
attr_accessor :branch_last_sha
1111
attr_accessor :branch_last_message
1212
attr_accessor :branch_name
13+
# Start of the regression report
14+
attr_accessor :timestamp
1315
# The branch's execution time on all standard projects
1416
attr_accessor :execution_time
1517
attr_accessor :jdk_version
@@ -26,6 +28,7 @@ def initialize(branch_name)
2628
@branch_name = branch_name
2729
branch_filename = PmdBranchDetail.branch_filename(branch_name)
2830
@base_branch_dir = "target/reports/#{branch_filename}" unless @branch_name.nil?
31+
@timestamp = Time.now
2932
@execution_time = 0
3033
# the result of command 'java -version' is going to stderr
3134
@jdk_version = Cmd.stderr_of('java -version')
@@ -42,11 +45,13 @@ def self.load(branch_name, logger)
4245
details.branch_last_sha = hash['branch_last_sha']
4346
details.branch_last_message = hash['branch_last_message']
4447
details.branch_name = hash['branch_name']
48+
details.timestamp = hash['timestamp']
4549
details.execution_time = hash['execution_time']
4650
details.jdk_version = hash['jdk_version']
4751
details.language = hash['language']
4852
details.pull_request = hash['pull_request']
4953
else
54+
details.timestamp = Time.now
5055
details.jdk_version = ''
5156
details.language = ''
5257
logger&.warn "#{details.path_to_save_file} doesn't exist!"
@@ -58,6 +63,7 @@ def save
5863
hash = { branch_last_sha: @branch_last_sha,
5964
branch_last_message: @branch_last_message,
6065
branch_name: @branch_name,
66+
timestamp: @timestamp,
6167
execution_time: @execution_time,
6268
jdk_version: @jdk_version,
6369
language: @language,

pmdtester.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake hoe:spec`.
22

33
# -*- encoding: utf-8 -*-
4-
# stub: pmdtester 1.1.2 ruby lib
4+
# stub: pmdtester 1.2.0.pre.SNAPSHOT ruby lib
55

66
Gem::Specification.new do |s|
77
s.name = "pmdtester".freeze
8-
s.version = "1.1.2"
8+
s.version = "1.2.0.pre.SNAPSHOT"
99

10-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
10+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
1111
s.metadata = { "bug_tracker_uri" => "https://github.com/pmd/pmd-regression-tester/issues", "homepage_uri" => "https://pmd.github.io", "source_code_uri" => "https://github.com/pmd/pmd-regression-tester" } if s.respond_to? :metadata=
1212
s.require_paths = ["lib".freeze]
1313
s.authors = ["Andreas Dangel".freeze, "Binguo Bao".freeze, "Cl\u00E9ment Fournier".freeze]
14-
s.date = "2021-04-20"
14+
s.date = "2021-06-17"
1515
s.description = "A regression testing tool ensure that new problems and unexpected behaviors will not be introduced to PMD project after fixing an issue , and new rules can work as expected.".freeze
1616
s.email = ["[email protected]".freeze, "[email protected]".freeze, "[email protected]".freeze]
1717
s.executables = ["pmdtester".freeze]

resources/project_diff_report.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
</head>
2020
<body>
21+
<div class="section">
22+
<h1>PMD Regression Tester Diff Report for {{project_name}}</h1>
23+
</div>
2124
<div class="section">
2225
<h2>Summary</h2>
2326
<div class="section-content">

resources/project_index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<link rel="stylesheet" href="css/pmd-tester.css">
1414
</head>
1515
<body>
16+
<div class="section">
17+
<h1>PMD Regression Tester Report</h1>
18+
<p>
19+
<a href="https://github.com/pmd/pmd-regression-tester">github.com/pmd/pmd-regression-tester</a>
20+
</p>
21+
</div>
1622
<div class="section">
1723
<h2>Branch details</h2>
1824
<div class="section-content">
@@ -37,6 +43,11 @@ <h2>Branch details</h2>
3743
<span class="external-link-secondary"><a href="{{ comparison_url }}">[Compare]</a></span>
3844
</td>
3945
</tr>
46+
<tr>
47+
<td class="item">Timestamp</td>
48+
<td class="base">{{base.timestamp}}</td>
49+
<td class="patch">{{patch.timestamp}}</td>
50+
</tr>
4051
<tr>
4152
<td class="item">Total PMD runtime</td>
4253
<td class="base">{{base.execution_time}}</td>

test/resources/html_report_builder/expected_diff_report_index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
</head>
2020
<body>
21+
<div class="section">
22+
<h1>PMD Regression Tester Diff Report for spring-framework</h1>
23+
</div>
2124
<div class="section">
2225
<h2>Summary</h2>
2326
<div class="section-content">

test/resources/html_report_builder/expected_empty_diff_report.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
</head>
2020
<body>
21+
<div class="section">
22+
<h1>PMD Regression Tester Diff Report for openjdk10</h1>
23+
</div>
2124
<div class="section">
2225
<h2>Summary</h2>
2326
<div class="section-content">

test/resources/summary_report_builder/base_branch_info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"branch_last_sha":"test sha",
33
"branch_last_message":"test message",
44
"branch_name":"base_branch",
5+
"timestamp":"foo",
56
"execution_time":121.123,
67
"jdk_version":"test version",
78
"language":"test language",

test/resources/summary_report_builder/expected_filtered_index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<link rel="stylesheet" href="css/pmd-tester.css">
1414
</head>
1515
<body>
16+
<div class="section">
17+
<h1>PMD Regression Tester Report</h1>
18+
<p>
19+
<a href="https://github.com/pmd/pmd-regression-tester">github.com/pmd/pmd-regression-tester</a>
20+
</p>
21+
</div>
1622
<div class="section">
1723
<h2>Branch details</h2>
1824
<div class="section-content">
@@ -37,6 +43,11 @@ <h2>Branch details</h2>
3743
<span class="external-link-secondary"><a href="https://github.com/pmd/pmd/compare/base_branch...test+sha">[Compare]</a></span>
3844
</td>
3945
</tr>
46+
<tr>
47+
<td class="item">Timestamp</td>
48+
<td class="base">foo</td>
49+
<td class="patch">foo2</td>
50+
</tr>
4051
<tr>
4152
<td class="item">Total PMD runtime</td>
4253
<td class="base">00:02:01</td>

test/resources/summary_report_builder/expected_index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<link rel="stylesheet" href="css/pmd-tester.css">
1414
</head>
1515
<body>
16+
<div class="section">
17+
<h1>PMD Regression Tester Report</h1>
18+
<p>
19+
<a href="https://github.com/pmd/pmd-regression-tester">github.com/pmd/pmd-regression-tester</a>
20+
</p>
21+
</div>
1622
<div class="section">
1723
<h2>Branch details</h2>
1824
<div class="section-content">
@@ -35,6 +41,11 @@ <h2>Branch details</h2>
3541
<span class="external-link-secondary"><a href="https://github.com/pmd/pmd/compare/base_branch...test+sha">[Compare]</a></span>
3642
</td>
3743
</tr>
44+
<tr>
45+
<td class="item">Timestamp</td>
46+
<td class="base">foo</td>
47+
<td class="patch">foo</td>
48+
</tr>
3849
<tr>
3950
<td class="item">Total PMD runtime</td>
4051
<td class="base">00:02:01</td>

0 commit comments

Comments
 (0)