codeclimate-test-reporter 0.0.7 → 0.0.8
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.
data/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Collects test coverage data from your Ruby test suite and sends it to Code
|
|
4
4
|
Climate's hosted, automated code review service. Based on SimpleCov.
|
|
5
5
|
|
|
6
|
-
**Note:** Code Climate's test coverage functionality is currently in private beta. If you are interested in volunteering for the beta, please contact us at hello@codeclimate.com .
|
|
7
|
-
|
|
8
6
|
Code Climate - [https://codeclimate.com](https://codeclimate.com)
|
|
9
7
|
|
|
10
8
|
## Installation
|
|
@@ -30,9 +28,30 @@ Code Climate account if you are in the test coverage private beta.
|
|
|
30
28
|
|
|
31
29
|
Please contact hello@codeclimate.com if you need any assistance setting this up.
|
|
32
30
|
|
|
31
|
+
## Help! Your gem is raising a ...
|
|
32
|
+
|
|
33
|
+
### VCR::Errors::UnhandledHTTPRequestError
|
|
34
|
+
|
|
35
|
+
Add the following to your spec or test helper:
|
|
36
|
+
|
|
37
|
+
VCR.configure do |config|
|
|
38
|
+
# your existing configuration
|
|
39
|
+
config.ignore_hosts 'codeclimate.com'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
### WebMock::NetConnectNotAllowedError
|
|
43
|
+
|
|
44
|
+
Add the following to your spec or test helper:
|
|
45
|
+
|
|
46
|
+
WebMock.disable_net_connect!(:allow => "codeclimate.com")
|
|
47
|
+
|
|
48
|
+
### Other communication failures
|
|
49
|
+
|
|
50
|
+
If you are using a web stubbing library similar to VCR or WebMock which prevent external requests during test runs, you will need configure these libraries to allow Code Climate to make external requests.
|
|
51
|
+
|
|
33
52
|
## Contributions
|
|
34
53
|
|
|
35
|
-
Patches, bug
|
|
54
|
+
Patches, bug fixes, feature requests, and pull requests are welcome on the
|
|
36
55
|
GitHub page for this project: [https://github.com/codeclimate/ruby-test-reporter](https://github.com/codeclimate/ruby-test-reporter)
|
|
37
56
|
|
|
38
57
|
This gem is maintained by Bryan Helmkamp (bryan@codeclimate.com).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module CodeClimate
|
|
2
|
+
module TestReporter
|
|
3
|
+
|
|
4
|
+
class WebMockMessage
|
|
5
|
+
def library_name
|
|
6
|
+
"WebMock"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def instructions
|
|
10
|
+
<<-STR
|
|
11
|
+
WebMock.disable_net_connect!(:allow => "codeclimate.com")
|
|
12
|
+
STR
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class VCRMessage
|
|
17
|
+
def library_name
|
|
18
|
+
"VCR"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def instructions
|
|
22
|
+
<<-STR
|
|
23
|
+
VCR.configure do |config|
|
|
24
|
+
# your existing configuration
|
|
25
|
+
config.ignore_hosts 'codeclimate.com'
|
|
26
|
+
end
|
|
27
|
+
STR
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class ExceptionMessage
|
|
32
|
+
|
|
33
|
+
HTTP_STUBBING_MESSAGES = {
|
|
34
|
+
"VCR::Errors::UnhandledHTTPRequestError" => VCRMessage,
|
|
35
|
+
"WebMock::NetConnectNotAllowedError" => WebMockMessage
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
def initialize(exception)
|
|
39
|
+
@exception = exception
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def message
|
|
43
|
+
parts = []
|
|
44
|
+
parts << "Code Climate encountered an exception: #{exception_class}"
|
|
45
|
+
if http_stubbing_exception
|
|
46
|
+
message = http_stubbing_exception.new
|
|
47
|
+
parts << "======"
|
|
48
|
+
parts << "Hey! Looks like you are using #{message.library_name}, which will prevent the codeclimate-test-reporter from reporting results to codeclimate.com.
|
|
49
|
+
Add the following to your spec or test helper to ensure codeclimate-test-reporter can post coverage results:"
|
|
50
|
+
parts << "\n" + message.instructions + "\n"
|
|
51
|
+
parts << "======"
|
|
52
|
+
else
|
|
53
|
+
parts << @exception.message
|
|
54
|
+
@exception.backtrace.each do |line|
|
|
55
|
+
parts << line
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
parts.join("\n")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
def exception_class
|
|
64
|
+
@exception.class.to_s
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def http_stubbing_exception
|
|
68
|
+
HTTP_STUBBING_MESSAGES[exception_class]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -3,6 +3,8 @@ require "securerandom"
|
|
|
3
3
|
require "json"
|
|
4
4
|
require "digest/sha1"
|
|
5
5
|
|
|
6
|
+
require "code_climate/test_reporter/exception_message"
|
|
7
|
+
|
|
6
8
|
module CodeClimate
|
|
7
9
|
module TestReporter
|
|
8
10
|
class Formatter
|
|
@@ -23,11 +25,7 @@ module CodeClimate
|
|
|
23
25
|
puts "done."
|
|
24
26
|
true
|
|
25
27
|
rescue => ex
|
|
26
|
-
puts
|
|
27
|
-
puts ex.message
|
|
28
|
-
ex.backtrace.each do |line|
|
|
29
|
-
puts line
|
|
30
|
-
end
|
|
28
|
+
puts ExceptionMessage.new(ex).message
|
|
31
29
|
false
|
|
32
30
|
end
|
|
33
31
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: codeclimate-test-reporter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-09-
|
|
12
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: simplecov
|
|
@@ -84,6 +84,7 @@ files:
|
|
|
84
84
|
- config/cacert.pem
|
|
85
85
|
- lib/code_climate/test_reporter.rb
|
|
86
86
|
- lib/code_climate/test_reporter/client.rb
|
|
87
|
+
- lib/code_climate/test_reporter/exception_message.rb
|
|
87
88
|
- lib/code_climate/test_reporter/formatter.rb
|
|
88
89
|
- lib/codeclimate-test-reporter.rb
|
|
89
90
|
- spec/spec_helper.rb
|
|
@@ -99,12 +100,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
99
100
|
- - ! '>='
|
|
100
101
|
- !ruby/object:Gem::Version
|
|
101
102
|
version: '0'
|
|
103
|
+
segments:
|
|
104
|
+
- 0
|
|
105
|
+
hash: -1626756073592550820
|
|
102
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
107
|
none: false
|
|
104
108
|
requirements:
|
|
105
109
|
- - ! '>='
|
|
106
110
|
- !ruby/object:Gem::Version
|
|
107
111
|
version: '0'
|
|
112
|
+
segments:
|
|
113
|
+
- 0
|
|
114
|
+
hash: -1626756073592550820
|
|
108
115
|
requirements: []
|
|
109
116
|
rubyforge_project:
|
|
110
117
|
rubygems_version: 1.8.23
|
|
@@ -113,4 +120,3 @@ specification_version: 3
|
|
|
113
120
|
summary: Uploads Ruby test coverage data to Code Climate.
|
|
114
121
|
test_files:
|
|
115
122
|
- spec/spec_helper.rb
|
|
116
|
-
has_rdoc:
|