codeclimate_circle_ci_coverage 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80efd9d157477409d66776b499feef2d0369abb2
|
4
|
+
data.tar.gz: 065d5b230669202674010522e1fa3f83ddc8d88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdf9361215d3bd25a79c446debe4d4e692f3795a66245669906e5d63f2e19d4214238b0875d97dbcfd6ff5932d81f1711e2282dbbd82ad9ccf53315b507a63ac
|
7
|
+
data.tar.gz: 5de1ba8c318c31f5a6280dd9bfc6364c346a7e0c6e95687436dfd2dd100a11cc990ab2e1078f610c5dbb081f7636cd7308e68cb75a6c8ad469582eb05588b8dd
|
@@ -45,6 +45,7 @@ class CoverageReporter
|
|
45
45
|
output_result_html(merged_result)
|
46
46
|
upload_result_file(merged_result)
|
47
47
|
store_code_climate_payload(merged_result)
|
48
|
+
puts "Reporting Complete."
|
48
49
|
true
|
49
50
|
end
|
50
51
|
|
@@ -63,7 +64,7 @@ class CoverageReporter
|
|
63
64
|
json_files.each_with_index do |resultset, i|
|
64
65
|
resultset.each do |_command_name, data|
|
65
66
|
result = SimpleCov::Result.from_hash(['command', i].join => data)
|
66
|
-
check_and_fix_result_time(result)
|
67
|
+
check_and_fix_result_time(result, i)
|
67
68
|
SimpleCov::ResultMerger.store_result(result)
|
68
69
|
end
|
69
70
|
end
|
@@ -73,11 +74,11 @@ class CoverageReporter
|
|
73
74
|
merged_result
|
74
75
|
end
|
75
76
|
|
76
|
-
def check_and_fix_result_time(result)
|
77
|
+
def check_and_fix_result_time(result, index)
|
77
78
|
if Time.now - result.created_at >= SimpleCov.merge_timeout
|
78
|
-
puts "result #{
|
79
|
+
puts "result #{index} has a created_at from #{result.created_at} (current time #{Time.now})"
|
79
80
|
puts "This will prevent coverage from being combined. Please check your tests for Stub-Time-related issues"
|
80
|
-
|
81
|
+
puts "Setting result created_at to current time to avoid this issue"
|
81
82
|
# If the result is timestamped old, it is ignored by SimpleCov
|
82
83
|
# So we always set the created_at to Time.now so that the ResultMerger
|
83
84
|
# doesn't discard any results
|
@@ -94,7 +95,8 @@ class CoverageReporter
|
|
94
95
|
def upload_result_file(merged_result)
|
95
96
|
# Post merged coverage result to codeclimate
|
96
97
|
codeclimate_formatter = CodeClimate::TestReporter::Formatter.new
|
97
|
-
codeclimate_formatter.format(merged_result.to_hash)
|
98
|
+
formatted_results = codeclimate_formatter.format(merged_result.to_hash)
|
99
|
+
CodeClimate::TestReporter::PostResults.new(formatted_results).post
|
98
100
|
end
|
99
101
|
|
100
102
|
# Internal: Debug function, in use to log the exact file which is sent to codeclimate
|
@@ -36,4 +36,23 @@ describe CoverageReporter do
|
|
36
36
|
# failing because creating a believable SimpleCov Result is more difficult than I thought
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
describe "#check_and_fix_result_time" do
|
41
|
+
context "when the time is new enough" do
|
42
|
+
let(:result) { OpenStruct.new(created_at: Time.now) }
|
43
|
+
|
44
|
+
it "does nothing" do
|
45
|
+
reporter.check_and_fix_result_time(result, 1)
|
46
|
+
expect(result.created_at).to be_within(1).of(Time.now)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when the time is in the past" do
|
51
|
+
let(:result) { OpenStruct.new(created_at: Time.now - 3600) }
|
52
|
+
it "can fix times" do
|
53
|
+
reporter.check_and_fix_result_time(result, 1)
|
54
|
+
expect(result.created_at).to be_within(1).of(Time.now)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
39
58
|
end
|
metadata
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate_circle_ci_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Dunlop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
17
20
|
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: '2'
|
@@ -21,6 +24,9 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
24
30
|
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: '2'
|
@@ -131,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
137
|
version: '0'
|
132
138
|
requirements: []
|
133
139
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
140
|
+
rubygems_version: 2.6.7
|
135
141
|
signing_key:
|
136
142
|
specification_version: 4
|
137
143
|
summary: CodeClimate Code Coverage reporting script for CircleCI
|