codeclimate_batch 0.3.0 → 0.4.0
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/lib/codeclimate_batch.rb +25 -2
- data/lib/codeclimate_batch/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9bd2ea876f2dc38e3f3236a50545ff2054467a1
|
4
|
+
data.tar.gz: 0316022ebf6aaeb982e95285b35e878336ec6bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de5d913945f7e318104d0ecc59e85ff975acebad95a76bf98be376a5bd98faf90e0a529b1930d7e162e2cce037d52c580a43013e3e39f050db53ad2a59b71e7
|
7
|
+
data.tar.gz: 69f0663700c12c072694a3d4de242f6b691b8b14ec2dd18c6c6eef769f14b8d7ca037b62383f7c9140db315bdbf18799fb4765c5adbfce525b32149c8a92ad04
|
data/lib/codeclimate_batch.rb
CHANGED
@@ -2,9 +2,11 @@ require 'json'
|
|
2
2
|
|
3
3
|
module CodeclimateBatch
|
4
4
|
class << self
|
5
|
-
#
|
5
|
+
# Start TestReporter with appropriate settings.
|
6
|
+
# Note that Code Climate only accepts reports from the default branch (usually master, but can be changed)
|
7
|
+
# but records coverage on all PRs -> wasted time
|
6
8
|
def start
|
7
|
-
return if
|
9
|
+
return if travis? && (outside_default_branch? || pull_request?)
|
8
10
|
ENV['CODECLIMATE_TO_FILE'] = '1' # write results to file since we need to combine them before sending
|
9
11
|
gem 'codeclimate-test-reporter', '>= 0.4.8' # get CODECLIMATE_TO_FILE support and avoid deprecations
|
10
12
|
require 'codeclimate-test-reporter'
|
@@ -23,6 +25,27 @@ module CodeclimateBatch
|
|
23
25
|
|
24
26
|
private
|
25
27
|
|
28
|
+
# Return the default branch. Most of the time it's master, but can be overridden
|
29
|
+
# by setting DEFAULT_BRANCH in the environment.
|
30
|
+
def default_branch
|
31
|
+
ENV['DEFAULT_BRANCH'] || 'master'
|
32
|
+
end
|
33
|
+
|
34
|
+
# Check if we are running on Travis CI.
|
35
|
+
def travis?
|
36
|
+
ENV['TRAVIS']
|
37
|
+
end
|
38
|
+
|
39
|
+
# Check if our Travis build is running on the default branch.
|
40
|
+
def outside_default_branch?
|
41
|
+
default_branch != ENV['TRAVIS_BRANCH']
|
42
|
+
end
|
43
|
+
|
44
|
+
# Check if running a pull request.
|
45
|
+
def pull_request?
|
46
|
+
ENV['TRAVIS_PULL_REQUEST'].to_i != 0
|
47
|
+
end
|
48
|
+
|
26
49
|
def load(file)
|
27
50
|
JSON.load(File.read(file))
|
28
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate_batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.4.5.1
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Report a batch of codeclimate results by merging and from multiple servers
|