codeclimate-test-reporter 0.5.0 → 0.5.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 +4 -4
- data/README.md +2 -2
- data/bin/cc-tddium-post-worker +2 -2
- data/lib/code_climate/test_reporter.rb +1 -3
- data/lib/code_climate/test_reporter/calculate_blob.rb +1 -3
- data/lib/code_climate/test_reporter/ci.rb +61 -54
- data/lib/code_climate/test_reporter/client.rb +2 -4
- data/lib/code_climate/test_reporter/configuration.rb +1 -2
- data/lib/code_climate/test_reporter/exception_message.rb +0 -1
- data/lib/code_climate/test_reporter/formatter.rb +9 -4
- data/lib/code_climate/test_reporter/git.rb +4 -4
- data/lib/code_climate/test_reporter/payload_validator.rb +0 -1
- data/lib/code_climate/test_reporter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96de1473cbfbf76faf670cc24b20ee12aca01d56
|
4
|
+
data.tar.gz: 1ff2ca29aeea50a4e5262d4deec97ec4bd1a782c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba6945d29cf097912f36785ad4af4f8a7a6f81f37422fcbd8622cb279db1c6c4657c7fedf77e3b82708dc7804dd0d916c7606058ffa82b1d05f8c0baa623793
|
7
|
+
data.tar.gz: 54fb6f840f963be3b1360d6ae1771eecb9fce514e5c31a9d4926666bf375b4a88264db5e9871b8fbc8d43d34077ea8ef7c47bf2e88a5d88bf09fa0206d4dfa51
|
data/README.md
CHANGED
@@ -80,10 +80,10 @@ Since ruby-test-reporter 0.4.0 you can use `CodeClimate::TestReporter::Formatter
|
|
80
80
|
```ruby
|
81
81
|
require 'codeclimate-test-reporter'
|
82
82
|
SimpleCov.start do
|
83
|
-
formatter SimpleCov::Formatter::MultiFormatter[
|
83
|
+
formatter SimpleCov::Formatter::MultiFormatter.new([
|
84
84
|
SimpleCov::Formatter::HTMLFormatter,
|
85
85
|
CodeClimate::TestReporter::Formatter
|
86
|
-
]
|
86
|
+
])
|
87
87
|
...
|
88
88
|
end
|
89
89
|
```
|
data/bin/cc-tddium-post-worker
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
module CodeClimate
|
2
2
|
module TestReporter
|
3
|
-
|
4
3
|
def self.start
|
5
4
|
if run?
|
6
5
|
require "simplecov"
|
7
|
-
::SimpleCov.add_filter
|
6
|
+
::SimpleCov.add_filter "vendor"
|
8
7
|
::SimpleCov.formatter = Formatter
|
9
8
|
::SimpleCov.start(configuration.profile) do
|
10
9
|
skip_token CodeClimate::TestReporter.configuration.skip_token
|
@@ -51,6 +50,5 @@ module CodeClimate
|
|
51
50
|
def self.logger
|
52
51
|
CodeClimate::TestReporter.configuration.logger
|
53
52
|
end
|
54
|
-
|
55
53
|
end
|
56
54
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module CodeClimate
|
2
2
|
module TestReporter
|
3
|
-
|
4
3
|
class CalculateBlob
|
5
4
|
|
6
5
|
def initialize(file_path)
|
@@ -28,12 +27,11 @@ module CodeClimate
|
|
28
27
|
|
29
28
|
def calculate_with_git
|
30
29
|
output = `git hash-object -t blob #{@file_path}`.chomp
|
31
|
-
raise
|
30
|
+
raise "ERROR: Failed to calculate blob with git" unless $?.success?
|
32
31
|
|
33
32
|
output
|
34
33
|
end
|
35
34
|
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
@@ -3,90 +3,97 @@ module CodeClimate
|
|
3
3
|
class Ci
|
4
4
|
|
5
5
|
def self.service_data(env = ENV)
|
6
|
-
if env[
|
6
|
+
if env["TRAVIS"]
|
7
7
|
{
|
8
8
|
name: "travis-ci",
|
9
|
-
branch: env[
|
10
|
-
build_identifier: env[
|
11
|
-
pull_request: env[
|
9
|
+
branch: env["TRAVIS_BRANCH"],
|
10
|
+
build_identifier: env["TRAVIS_JOB_ID"],
|
11
|
+
pull_request: env["TRAVIS_PULL_REQUEST"]
|
12
12
|
}
|
13
|
-
elsif env[
|
13
|
+
elsif env["CIRCLECI"]
|
14
14
|
{
|
15
|
-
name: "
|
16
|
-
build_identifier: env[
|
17
|
-
branch: env[
|
18
|
-
commit_sha: env[
|
15
|
+
name: "circleci",
|
16
|
+
build_identifier: env["CIRCLE_BUILD_NUM"],
|
17
|
+
branch: env["CIRCLE_BRANCH"],
|
18
|
+
commit_sha: env["CIRCLE_SHA1"]
|
19
19
|
}
|
20
|
-
elsif env[
|
20
|
+
elsif env["SEMAPHORE"]
|
21
21
|
{
|
22
22
|
name: "semaphore",
|
23
|
-
branch: env[
|
24
|
-
build_identifier: env[
|
23
|
+
branch: env["BRANCH_NAME"],
|
24
|
+
build_identifier: env["SEMAPHORE_BUILD_NUMBER"]
|
25
25
|
}
|
26
|
-
elsif env[
|
26
|
+
elsif env["JENKINS_URL"]
|
27
27
|
{
|
28
28
|
name: "jenkins",
|
29
|
-
build_identifier: env[
|
30
|
-
build_url: env[
|
31
|
-
branch: env[
|
32
|
-
commit_sha: env[
|
29
|
+
build_identifier: env["BUILD_NUMBER"],
|
30
|
+
build_url: env["BUILD_URL"],
|
31
|
+
branch: env["GIT_BRANCH"],
|
32
|
+
commit_sha: env["GIT_COMMIT"]
|
33
33
|
}
|
34
|
-
elsif env[
|
34
|
+
elsif env["TDDIUM"]
|
35
35
|
{
|
36
36
|
name: "tddium",
|
37
|
-
build_identifier: env[
|
38
|
-
worker_id: env[
|
37
|
+
build_identifier: env["TDDIUM_SESSION_ID"],
|
38
|
+
worker_id: env["TDDIUM_TID"]
|
39
39
|
}
|
40
|
-
elsif env[
|
40
|
+
elsif env["WERCKER"]
|
41
41
|
{
|
42
42
|
name: "wercker",
|
43
|
-
build_identifier: env[
|
44
|
-
build_url: env[
|
45
|
-
branch: env[
|
46
|
-
commit_sha: env[
|
43
|
+
build_identifier: env["WERCKER_BUILD_ID"],
|
44
|
+
build_url: env["WERCKER_BUILD_URL"],
|
45
|
+
branch: env["WERCKER_GIT_BRANCH"],
|
46
|
+
commit_sha: env["WERCKER_GIT_COMMIT"]
|
47
47
|
}
|
48
|
-
elsif env[
|
48
|
+
elsif env["APPVEYOR"]
|
49
49
|
{
|
50
50
|
name: "appveyor",
|
51
|
-
build_identifier: env[
|
52
|
-
build_url: env[
|
53
|
-
branch: env[
|
54
|
-
commit_sha: env[
|
55
|
-
pull_request: env[
|
51
|
+
build_identifier: env["APPVEYOR_BUILD_ID"],
|
52
|
+
build_url: env["APPVEYOR_API_URL"],
|
53
|
+
branch: env["APPVEYOR_REPO_BRANCH"],
|
54
|
+
commit_sha: env["APPVEYOR_REPO_COMMIT"],
|
55
|
+
pull_request: env["APPVEYOR_PULL_REQUEST_NUMBER"]
|
56
56
|
}
|
57
|
-
elsif env[
|
57
|
+
elsif env["CI_NAME"] =~ /DRONE/i
|
58
58
|
{
|
59
59
|
name: "drone",
|
60
|
-
build_identifier: env[
|
61
|
-
build_url: env[
|
62
|
-
branch: env[
|
63
|
-
commit_sha: env[
|
64
|
-
pull_request: env[
|
60
|
+
build_identifier: env["CI_BUILD_NUMBER"],
|
61
|
+
build_url: env["CI_BUILD_URL"],
|
62
|
+
branch: env["CI_BRANCH"],
|
63
|
+
commit_sha: env["CI_BUILD_NUMBER"],
|
64
|
+
pull_request: env["CI_PULL_REQUEST"]
|
65
65
|
}
|
66
|
-
elsif env[
|
66
|
+
elsif env["CI_NAME"] =~ /codeship/i
|
67
67
|
{
|
68
68
|
name: "codeship",
|
69
|
-
build_identifier: env[
|
70
|
-
build_url: env[
|
71
|
-
branch: env[
|
72
|
-
commit_sha: env[
|
69
|
+
build_identifier: env["CI_BUILD_NUMBER"],
|
70
|
+
build_url: env["CI_BUILD_URL"],
|
71
|
+
branch: env["CI_BRANCH"],
|
72
|
+
commit_sha: env["CI_COMMIT_ID"],
|
73
73
|
}
|
74
|
-
elsif env[
|
74
|
+
elsif env["CI_NAME"] =~ /VEXOR/i
|
75
75
|
{
|
76
|
-
name:
|
77
|
-
build_identifier: env[
|
78
|
-
build_url: env[
|
79
|
-
branch: env[
|
80
|
-
commit_sha: env[
|
81
|
-
pull_request: env[
|
76
|
+
name: "vexor",
|
77
|
+
build_identifier: env["CI_BUILD_NUMBER"],
|
78
|
+
build_url: env["CI_BUILD_URL"],
|
79
|
+
branch: env["CI_BRANCH"],
|
80
|
+
commit_sha: env["CI_BUILD_SHA"],
|
81
|
+
pull_request: env["CI_PULL_REQUEST_ID"]
|
82
82
|
}
|
83
|
-
elsif env[
|
83
|
+
elsif env["BUILDKITE"]
|
84
84
|
{
|
85
85
|
name: "buildkite",
|
86
|
-
build_identifier: env[
|
87
|
-
build_url: env[
|
88
|
-
branch: env[
|
89
|
-
commit_sha: env[
|
86
|
+
build_identifier: env["BUILDKITE_JOB_ID"],
|
87
|
+
build_url: env["BUILDKITE_BUILD_URL"],
|
88
|
+
branch: env["BUILDKITE_BRANCH"],
|
89
|
+
commit_sha: env["BUILDKITE_COMMIT"]
|
90
|
+
}
|
91
|
+
elsif env["GITLAB_CI"]
|
92
|
+
{
|
93
|
+
name: "gitlab-ci",
|
94
|
+
build_identifier: env["CI_BUILD_ID"],
|
95
|
+
branch: env["CI_BUILD_REF_NAME"],
|
96
|
+
commit_sha: env["CI_BUILD_REF"]
|
90
97
|
}
|
91
98
|
else
|
92
99
|
{}
|
@@ -4,11 +4,10 @@ require "net/https"
|
|
4
4
|
|
5
5
|
module CodeClimate
|
6
6
|
module TestReporter
|
7
|
-
|
8
7
|
class Client
|
9
8
|
|
10
9
|
DEFAULT_TIMEOUT = 5 # in seconds
|
11
|
-
USER_AGENT
|
10
|
+
USER_AGENT = "Code Climate (Ruby Test Reporter v#{VERSION})"
|
12
11
|
|
13
12
|
def host
|
14
13
|
ENV["CODECLIMATE_API_HOST"] ||
|
@@ -80,7 +79,7 @@ module CodeClimate
|
|
80
79
|
if uri.scheme == "https"
|
81
80
|
http.use_ssl = true
|
82
81
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
83
|
-
http.ca_file = File.expand_path(
|
82
|
+
http.ca_file = File.expand_path("../../../../config/cacert.pem", __FILE__)
|
84
83
|
http.verify_depth = 5
|
85
84
|
end
|
86
85
|
http.open_timeout = CodeClimate::TestReporter.configuration.timeout
|
@@ -97,6 +96,5 @@ module CodeClimate
|
|
97
96
|
end
|
98
97
|
|
99
98
|
end
|
100
|
-
|
101
99
|
end
|
102
100
|
end
|
@@ -39,7 +39,7 @@ module CodeClimate
|
|
39
39
|
# actually private ...
|
40
40
|
def short_filename(filename)
|
41
41
|
return filename unless ::SimpleCov.root
|
42
|
-
filename = filename.gsub(::SimpleCov.root
|
42
|
+
filename = filename.gsub(/^#{::SimpleCov.root}/, ".").gsub(/^\.\//, "")
|
43
43
|
apply_prefix filename
|
44
44
|
end
|
45
45
|
|
@@ -52,9 +52,14 @@ module CodeClimate
|
|
52
52
|
def to_payload(result)
|
53
53
|
totals = Hash.new(0)
|
54
54
|
source_files = result.files.map do |file|
|
55
|
-
totals[:total]
|
56
|
-
totals[:covered]
|
57
|
-
totals[:missed]
|
55
|
+
totals[:total] += file.lines.count
|
56
|
+
totals[:covered] += file.covered_lines.count
|
57
|
+
totals[:missed] += file.missed_lines.count
|
58
|
+
|
59
|
+
# Set coverage for all skipped lines to nil
|
60
|
+
file.skipped_lines.each do |skipped_line|
|
61
|
+
file.coverage[skipped_line.line_number - 1] = nil
|
62
|
+
end
|
58
63
|
|
59
64
|
{
|
60
65
|
name: short_filename(file.filename),
|
@@ -36,12 +36,12 @@ module CodeClimate
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def committed_at
|
39
|
-
committed_at = git(
|
39
|
+
committed_at = git("log -1 --pretty=format:%ct")
|
40
40
|
committed_at.to_i.zero? ? nil : committed_at.to_i
|
41
41
|
end
|
42
42
|
|
43
43
|
def branch_from_git
|
44
|
-
git(
|
44
|
+
git("rev-parse --abbrev-ref HEAD").chomp
|
45
45
|
end
|
46
46
|
|
47
47
|
def git(command)
|
@@ -50,7 +50,7 @@ module CodeClimate
|
|
50
50
|
|
51
51
|
def git_dir
|
52
52
|
return configured_git_dir unless configured_git_dir.nil?
|
53
|
-
rails_git_dir_present? ? Rails.root :
|
53
|
+
rails_git_dir_present? ? Rails.root : "."
|
54
54
|
end
|
55
55
|
|
56
56
|
def configured_git_dir
|
@@ -59,7 +59,7 @@ module CodeClimate
|
|
59
59
|
|
60
60
|
def rails_git_dir_present?
|
61
61
|
const_defined?(:Rails) && Rails.respond_to?(:root) && !Rails.root.nil? &&
|
62
|
-
File.directory?(File.expand_path(
|
62
|
+
File.directory?(File.expand_path(".git", Rails.root))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-test-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|