Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 86d7a71

Browse files
committed
Merge pull request #105 from codeclimate/gd-cc-issues
Fix a host of Code Climate Issues
2 parents 246267d + 5f8607e commit 86d7a71

13 files changed

+85
-94
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

33
# Specify your gem's dependencies in codeclimate-test-reporter.gemspec
44
gemspec

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "bundler/gem_tasks"
2-
require 'rspec/core/rake_task'
2+
require "rspec/core/rake_task"
33

44
RSpec::Core::RakeTask.new(:spec)
55

6-
task :default => :spec
6+
task default: :spec

bin/cc-tddium-post-worker

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22

3-
require 'codeclimate-test-reporter'
4-
require 'tmpdir'
3+
require "codeclimate-test-reporter"
4+
require "tmpdir"
55

66
if ENV["CODECLIMATE_REPO_TOKEN"]
77
tmpdir = Dir.tmpdir

codeclimate-test-reporter.gemspec

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
require "./lib/code_climate/test_reporter/version"
22

33
Gem::Specification.new do |spec|
4-
spec.name = "codeclimate-test-reporter"
5-
spec.version = CodeClimate::TestReporter::VERSION
6-
spec.authors = ["Bryan Helmkamp"]
7-
spec.email = ["[email protected]"]
8-
spec.description = "Collects test coverage data from your Ruby test suite and sends it to Code Climate's hosted, automated code review service. Based on SimpleCov."
9-
spec.summary = "Uploads Ruby test coverage data to Code Climate."
10-
spec.homepage = "https://github.com/codeclimate/ruby-test-reporter"
11-
spec.license = "MIT"
4+
spec.name = "codeclimate-test-reporter"
5+
spec.version = CodeClimate::TestReporter::VERSION
6+
spec.authors = ["Bryan Helmkamp"]
7+
spec.email = ["[email protected]"]
8+
spec.description = "Collects test coverage data from your Ruby test suite and sends it to Code Climate's hosted, automated code review service. Based on SimpleCov."
9+
spec.summary = "Uploads Ruby test coverage data to Code Climate."
10+
spec.homepage = "https://github.com/codeclimate/ruby-test-reporter"
11+
spec.license = "MIT"
1212

13-
spec.files = `git ls-files bin lib config LICENSE.txt README.md`.split($/)
14-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13+
spec.files = `git ls-files bin lib config LICENSE.txt README.md`.split($/)
14+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
1515

1616
spec.required_ruby_version = ">= 1.9"
1717

lib/code_climate/test_reporter.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module CodeClimate
22
module TestReporter
3-
43
def self.start
54
if run?
65
require "simplecov"
7-
::SimpleCov.add_filter 'vendor'
6+
::SimpleCov.add_filter "vendor"
87
::SimpleCov.formatter = Formatter
98
::SimpleCov.start(configuration.profile) do
109
skip_token CodeClimate::TestReporter.configuration.skip_token
@@ -51,6 +50,5 @@ def self.current_branch
5150
def self.logger
5251
CodeClimate::TestReporter.configuration.logger
5352
end
54-
5553
end
5654
end

lib/code_climate/test_reporter/calculate_blob.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module CodeClimate
22
module TestReporter
3-
43
class CalculateBlob
54

65
def initialize(file_path)
@@ -28,12 +27,11 @@ def calculate_with_file
2827

2928
def calculate_with_git
3029
output = `git hash-object -t blob #{@file_path}`.chomp
31-
raise 'ERROR: Failed to calculate blob with git' unless $?.success?
30+
raise "ERROR: Failed to calculate blob with git" unless $?.success?
3231

3332
output
3433
end
3534

3635
end
37-
3836
end
3937
end

lib/code_climate/test_reporter/ci.rb

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,97 +3,97 @@ module TestReporter
33
class Ci
44

55
def self.service_data(env = ENV)
6-
if env['TRAVIS']
6+
if env["TRAVIS"]
77
{
88
name: "travis-ci",
9-
branch: env['TRAVIS_BRANCH'],
10-
build_identifier: env['TRAVIS_JOB_ID'],
11-
pull_request: env['TRAVIS_PULL_REQUEST']
9+
branch: env["TRAVIS_BRANCH"],
10+
build_identifier: env["TRAVIS_JOB_ID"],
11+
pull_request: env["TRAVIS_PULL_REQUEST"]
1212
}
13-
elsif env['CIRCLECI']
13+
elsif env["CIRCLECI"]
1414
{
1515
name: "circlci",
16-
build_identifier: env['CIRCLE_BUILD_NUM'],
17-
branch: env['CIRCLE_BRANCH'],
18-
commit_sha: env['CIRCLE_SHA1']
16+
build_identifier: env["CIRCLE_BUILD_NUM"],
17+
branch: env["CIRCLE_BRANCH"],
18+
commit_sha: env["CIRCLE_SHA1"]
1919
}
20-
elsif env['SEMAPHORE']
20+
elsif env["SEMAPHORE"]
2121
{
2222
name: "semaphore",
23-
branch: env['BRANCH_NAME'],
24-
build_identifier: env['SEMAPHORE_BUILD_NUMBER']
23+
branch: env["BRANCH_NAME"],
24+
build_identifier: env["SEMAPHORE_BUILD_NUMBER"]
2525
}
26-
elsif env['JENKINS_URL']
26+
elsif env["JENKINS_URL"]
2727
{
2828
name: "jenkins",
29-
build_identifier: env['BUILD_NUMBER'],
30-
build_url: env['BUILD_URL'],
31-
branch: env['GIT_BRANCH'],
32-
commit_sha: env['GIT_COMMIT']
29+
build_identifier: env["BUILD_NUMBER"],
30+
build_url: env["BUILD_URL"],
31+
branch: env["GIT_BRANCH"],
32+
commit_sha: env["GIT_COMMIT"]
3333
}
34-
elsif env['TDDIUM']
34+
elsif env["TDDIUM"]
3535
{
3636
name: "tddium",
37-
build_identifier: env['TDDIUM_SESSION_ID'],
38-
worker_id: env['TDDIUM_TID']
37+
build_identifier: env["TDDIUM_SESSION_ID"],
38+
worker_id: env["TDDIUM_TID"]
3939
}
40-
elsif env['WERCKER']
40+
elsif env["WERCKER"]
4141
{
4242
name: "wercker",
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']
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"]
4747
}
48-
elsif env['APPVEYOR']
48+
elsif env["APPVEYOR"]
4949
{
5050
name: "appveyor",
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']
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"]
5656
}
57-
elsif env['CI_NAME'] =~ /DRONE/i
57+
elsif env["CI_NAME"] =~ /DRONE/i
5858
{
5959
name: "drone",
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']
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"]
6565
}
66-
elsif env['CI_NAME'] =~ /codeship/i
66+
elsif env["CI_NAME"] =~ /codeship/i
6767
{
6868
name: "codeship",
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'],
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"],
7373
}
74-
elsif env['CI_NAME'] =~ /VEXOR/i
74+
elsif env["CI_NAME"] =~ /VEXOR/i
7575
{
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']
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"]
8282
}
83-
elsif env['BUILDKITE']
83+
elsif env["BUILDKITE"]
8484
{
8585
name: "buildkite",
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']
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"]
9090
}
91-
elsif env['GITLAB_CI']
91+
elsif env["GITLAB_CI"]
9292
{
9393
name: "gitlab-ci",
94-
build_identifier: env['CI_BUILD_ID'],
95-
branch: env['CI_BUILD_REF_NAME'],
96-
commit_sha: env['CI_BUILD_REF']
94+
build_identifier: env["CI_BUILD_ID"],
95+
branch: env["CI_BUILD_REF_NAME"],
96+
commit_sha: env["CI_BUILD_REF"]
9797
}
9898
else
9999
{}

lib/code_climate/test_reporter/client.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
module CodeClimate
66
module TestReporter
7-
87
class Client
98

109
DEFAULT_TIMEOUT = 5 # in seconds
11-
USER_AGENT = "Code Climate (Ruby Test Reporter v#{VERSION})"
10+
USER_AGENT = "Code Climate (Ruby Test Reporter v#{VERSION})"
1211

1312
def host
1413
ENV["CODECLIMATE_API_HOST"] ||
@@ -80,7 +79,7 @@ def http_client(uri)
8079
if uri.scheme == "https"
8180
http.use_ssl = true
8281
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
83-
http.ca_file = File.expand_path('../../../../config/cacert.pem', __FILE__)
82+
http.ca_file = File.expand_path("../../../../config/cacert.pem", __FILE__)
8483
http.verify_depth = 5
8584
end
8685
http.open_timeout = CodeClimate::TestReporter.configuration.timeout
@@ -97,6 +96,5 @@ def compress(str)
9796
end
9897

9998
end
100-
10199
end
102100
end

lib/code_climate/test_reporter/configuration.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'logger'
1+
require "logger"
22

33
module CodeClimate
44
module TestReporter
@@ -52,6 +52,5 @@ def default_logger
5252
log
5353
end
5454
end
55-
5655
end
5756
end

lib/code_climate/test_reporter/exception_message.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module CodeClimate
22
module TestReporter
3-
43
class WebMockMessage
54
def library_name
65
"WebMock"

0 commit comments

Comments
 (0)