danger-jacoco 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df5403f35daa0b6089984099c9aa4e6457f21a40
4
- data.tar.gz: e487698753b72030f1be8d2ea20021f25c690c74
3
+ metadata.gz: 371b0dde165ac428614147067f7e6afb770a5612
4
+ data.tar.gz: 8ca1e6cdcee1c395c4627c6a41254ea80b64a43c
5
5
  SHA512:
6
- metadata.gz: b661f9d21c87564e0693be598152a0d1b06f1579d28b3b19e679c304682498c1ad74e0f4729cfb474a904be7369078e24da9649830ad21b84e32026c84cc631e
7
- data.tar.gz: 50b915a03189ebc3830ab5f6afb852862e35f72da0b63f4b70e39b1d0e0f427b4c70123212cc31a5da08dbfbf4c425bf97d5790eb071671e4c2a4e9bbff5d923
6
+ metadata.gz: d216754af4136b642921a1bae373a437e97cf0f99326be3260d8b77bfa02aa94735eab6077f0cc1721d57e2fea6e917f7c6effec83c4cfe94d1f04f9650ec411
7
+ data.tar.gz: 02f1ffc71d5eac688733f5165f6cf9152df4542d4f29d2f3ad20b3ddb635b964f9bf05124c211998fe75073cd625fb01506dde6600d36280510e3003246946dd
@@ -1,3 +1,3 @@
1
1
  module Jacoco
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
data/lib/jacoco/plugin.rb CHANGED
@@ -69,10 +69,7 @@ module Danger
69
69
 
70
70
  # It returns a specific class code coverage and an emoji status as well
71
71
  def report_class(jacoco_class)
72
- counters = jacoco_class.counters
73
- branch_counter = counters.detect { |e| e.type.eql? 'BRANCH' }
74
- line_counter = counters.detect { |e| e.type.eql? 'LINE' }
75
- counter = branch_counter.nil? ? line_counter : branch_counter
72
+ counter = coverage_counter(jacoco_class)
76
73
  coverage = (counter.covered.fdiv(counter.covered + counter.missed) * 100).floor
77
74
  status = coverage_status(coverage, minimum_class_coverage_percentage)
78
75
 
@@ -109,6 +106,16 @@ module Danger
109
106
 
110
107
  private
111
108
 
109
+ def coverage_counter(jacoco_class)
110
+ counters = jacoco_class.counters
111
+ branch_counter = counters.detect { |e| e.type.eql? 'BRANCH' }
112
+ line_counter = counters.detect { |e| e.type.eql? 'LINE' }
113
+ counter = branch_counter.nil? ? line_counter : branch_counter
114
+ raise "No coverage data found for #{jacoco_class.name}" if counter.nil?
115
+
116
+ counter
117
+ end
118
+
112
119
  # rubocop:disable Style/SignalException
113
120
  def report_fails(class_coverage_above_minimum, total_covered)
114
121
  if total_covered[:covered] < minimum_project_coverage_percentage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-jacoco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Malinskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-07 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api