danger-jacoco 0.1.0 → 0.1.1

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: e8caafe32ed85b587ff05493d8787e293aaad3eb
4
- data.tar.gz: fded83a5dbdae6209dd1986b761b9c861d6ccd01
3
+ metadata.gz: df5403f35daa0b6089984099c9aa4e6457f21a40
4
+ data.tar.gz: e487698753b72030f1be8d2ea20021f25c690c74
5
5
  SHA512:
6
- metadata.gz: 7b91364232e571798fe45bf8b0911bd09fca607b3e6e1ca04a384052bdedd4b206251694cac69d376c9240633b72a5af119b31271be8411f1fa35199b83cdf42
7
- data.tar.gz: 144d396fad44caa4ddc756139861a14bda5b3ee2f336772abaf7ff55a960bea795fe06fdf00abbaf3157d744e9f3b9a94bd96f99a272ef105f4482eceeb52323
6
+ metadata.gz: b661f9d21c87564e0693be598152a0d1b06f1579d28b3b19e679c304682498c1ad74e0f4729cfb474a904be7369078e24da9649830ad21b84e32026c84cc631e
7
+ data.tar.gz: 50b915a03189ebc3830ab5f6afb852862e35f72da0b63f4b70e39b1d0e0f427b4c70123212cc31a5da08dbfbf4c425bf97d5790eb071671e4c2a4e9bbff5d923
@@ -1,3 +1,3 @@
1
1
  module Jacoco
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -53,14 +53,10 @@ module Danger
53
53
  report_markdown = "### JaCoCO Code Coverage #{total_covered[:covered]}% #{total_covered[:status]}\n"
54
54
  report_markdown << "| Class | Covered | Meta | Status |\n"
55
55
  report_markdown << "|:---:|:---:|:---:|:---:|\n"
56
- markdown_class(parser, report_markdown)
56
+ class_coverage_above_minimum = markdown_class(parser, report_markdown)
57
57
  markdown(report_markdown)
58
58
 
59
- return if total_covered[:covered] >= minimum_project_coverage_percentage
60
-
61
- # fail danger if total coveraged is smaller than minimum_project_coverage_percentage
62
- covered = total_covered[:covered]
63
- raise("Total coverage of #{covered}%. Improve this to as least #{minimum_project_coverage_percentage} %")
59
+ report_fails(class_coverage_above_minimum, total_covered)
64
60
  end
65
61
 
66
62
  # Select modified and added files in this PR
@@ -113,12 +109,30 @@ module Danger
113
109
 
114
110
  private
115
111
 
112
+ # rubocop:disable Style/SignalException
113
+ def report_fails(class_coverage_above_minimum, total_covered)
114
+ if total_covered[:covered] < minimum_project_coverage_percentage
115
+ # fail danger if total coverage is smaller than minimum_project_coverage_percentage
116
+ covered = total_covered[:covered]
117
+ fail("Total coverage of #{covered}%. Improve this to at least #{minimum_project_coverage_percentage}%")
118
+ end
119
+
120
+ return if class_coverage_above_minimum
121
+
122
+ fail("Class coverage is below minimum. Improve to at least #{minimum_class_coverage_percentage}%")
123
+ end
124
+
116
125
  def markdown_class(parser, report_markdown)
126
+ class_coverage_above_minimum = true
117
127
  parser.classes.each do |jacoco_class| # Check metrics for each classes
118
128
  rp = report_class(jacoco_class)
119
129
  ln = "| `#{jacoco_class.name}` | #{rp[:covered]}% | #{minimum_class_coverage_percentage}% | #{rp[:status]} |\n"
120
130
  report_markdown << ln
131
+
132
+ class_coverage_above_minimum &&= rp[:covered] >= minimum_class_coverage_percentage
121
133
  end
134
+
135
+ class_coverage_above_minimum
122
136
  end
123
137
  end
124
138
  end
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.0
4
+ version: 0.1.1
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-04 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api
@@ -175,7 +175,6 @@ files:
175
175
  - ".rubocop.yml"
176
176
  - ".travis.yml"
177
177
  - Gemfile
178
- - Gemfile.lock
179
178
  - Guardfile
180
179
  - LICENSE.txt
181
180
  - README.md