danger-jacoco-instacart 0.1.13 → 0.1.14

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
  SHA256:
3
- metadata.gz: 04b74ccc5974fdd122bb8909a71b541891e760d99f7cfd120c06d71c133c2b32
4
- data.tar.gz: 9f8e75aa5cf7611307255edb1ae2119e81f5c7010700d324d1b7041cd7d5d275
3
+ metadata.gz: 2796b44c6c3c0252797c88e6836096d3f528524f2a3719111607df5375e00afa
4
+ data.tar.gz: bd5f313356ca48dc58e35a35c425b4b158686f924264fcacd1a48d54cb9a2108
5
5
  SHA512:
6
- metadata.gz: da2bc98c6c2693be43e96012f0ac3b2000911fca7610fba47387046f908797eb49a4b2f04d505af4ddd359cae44703725c1216bf9716bb0cf62c58b20636dca5
7
- data.tar.gz: 9f768d669d1eb720bf898ab9fbdfd6deb8fd68994a67ae490938eee2fd4c693dcfb0a06314b466fef6c9109424f037738171e77113546579986a1ca6dfce4266
6
+ metadata.gz: b9a81a4673b390c90b0e58626cad1a0b922a1158f6425f7e0999b03ca7c41c1d94b7b6bbe4ffc13eb0a4fb79dc2dff801f61d78b7945845b091bb79a3a71d8df
7
+ data.tar.gz: 283344a767f8500e3fda05291cb12c5a18c525ec8e0fd191ab8cae1f63d79c07c38f5140cb8334b5cb0449116977f653b7b00cc0d33fd0625f903c0f9253336a
data/.yardoc/checksums CHANGED
@@ -1,6 +1,6 @@
1
1
  /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/danger_jacoco.rb 38229d934b3315bb2a5a4eec18eb65f3c54d304f
2
- /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/gem_version.rb 1c81f68cb95296bfd592c1b57e0f2e6341f56b55
3
- /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb e99030c6a408c1bc77962b844d74c324daecad40
2
+ /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/gem_version.rb 8f31621c2d22f454fcaacb2640694c9c6e7f1fb8
3
+ /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb e0262efb6d2458fa4ad4e2138c1f8a10fb11a1de
4
4
  /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/sax_parser.rb 370e2799f8dbdf7d642c820214e6ea84c30c9cb0
5
5
  /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/counter.rb 368f4a9811617b7a174ddf837a8fac49a4bc32a6
6
6
  /Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/model/report.rb 7cf45ee71ff347a130320f6190ddb25525c7095d
data/.yardoc/object_types CHANGED
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jacoco
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.14'
5
5
  end
data/lib/jacoco/plugin.rb CHANGED
@@ -21,7 +21,7 @@ module Danger
21
21
  #
22
22
  class DangerJacoco < Plugin # rubocop:disable Metrics/ClassLength
23
23
  attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage,
24
- :minimum_composable_class_coverage_percentage, :only_check_new_files, :files_extension,
24
+ :minimum_composable_class_coverage_percentage, :files_to_check, :files_extension,
25
25
  :minimum_package_coverage_map, :minimum_class_coverage_map, :fail_no_coverage_data_found,
26
26
  :title, :class_column_title, :subtitle_success, :subtitle_failure, :file_to_create_on_failure
27
27
 
@@ -29,7 +29,7 @@ module Danger
29
29
  def setup
30
30
  setup_minimum_coverages
31
31
  setup_texts
32
- @only_check_new_files = false unless only_check_new_files
32
+ @files_to_check = [] unless files_to_check
33
33
  @files_extension = ['.kt', '.java'] unless files_extension
34
34
  @file_to_create_on_failure = 'danger_jacoco_failure_status_file.txt' unless file_to_create_on_failure
35
35
  end
@@ -103,13 +103,9 @@ module Danger
103
103
  end
104
104
  # rubocop:enable Style/AbcSize
105
105
 
106
- # Select either only added files or modified and added files in this PR,
107
- # depending on "only_check_new_files" attribute
108
106
  def classes(delimiter)
109
- git = @dangerfile.git
110
- affected_files = only_check_new_files ? git.added_files : git.added_files + git.modified_files
111
107
  class_to_file_path_hash = {}
112
- affected_files.select { |file| files_extension.reduce(false) { |state, el| state || file.end_with?(el) } }
108
+ files_to_check.select { |file| files_extension.reduce(false) { |state, el| state || file.end_with?(el) } }
113
109
  .each do |file| # "src/java/com/example/CachedRepository.java"
114
110
  classname = file.split('.').first.split(delimiter)[1] # "com/example/CachedRepository"
115
111
  class_to_file_path_hash[classname] = file
data/spec/jacoco_spec.rb CHANGED
@@ -20,17 +20,13 @@ module Danger
20
20
  @dangerfile = testing_dangerfile
21
21
  @my_plugin = @dangerfile.jacoco
22
22
 
23
- modified_files = ['src/java/com/example/CachedRepository.java']
24
- added_files = ['src/java/io/sample/UseCase.java']
25
-
26
- allow(@dangerfile.git).to receive(:modified_files).and_return(modified_files)
27
- allow(@dangerfile.git).to receive(:added_files).and_return(added_files)
28
23
  allow(File).to receive(:open).and_call_original
29
24
  end
30
25
 
31
26
  it :report do
32
27
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
33
28
 
29
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
34
30
  @my_plugin.minimum_project_coverage_percentage = 50
35
31
  @my_plugin.minimum_class_coverage_map = { 'com/example/CachedRepository' => 100 }
36
32
 
@@ -47,6 +43,7 @@ module Danger
47
43
  it 'creates supplied status file upon failure' do
48
44
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
49
45
 
46
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
50
47
  @my_plugin.minimum_project_coverage_percentage = 100
51
48
  @my_plugin.minimum_class_coverage_percentage = 60
52
49
  @my_plugin.file_to_create_on_failure = 'kmm.txt'
@@ -58,6 +55,7 @@ module Danger
58
55
  it 'creates default status file upon failure' do
59
56
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
60
57
 
58
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
61
59
  @my_plugin.minimum_class_coverage_percentage = 60
62
60
 
63
61
  expect(File).to receive(:open).with('danger_jacoco_failure_status_file.txt', 'w')
@@ -67,6 +65,7 @@ module Danger
67
65
  it 'does _not_ create status file upon success' do
68
66
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
69
67
 
68
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
70
69
  @my_plugin.minimum_class_coverage_percentage = 40
71
70
  @my_plugin.file_to_create_on_failure = 'kmm.txt'
72
71
 
@@ -77,6 +76,7 @@ module Danger
77
76
  it 'test regex class coverage' do
78
77
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
79
78
 
79
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
80
80
  @my_plugin.minimum_project_coverage_percentage = 50
81
81
  @my_plugin.minimum_class_coverage_map = { '.*Repository' => 60 }
82
82
 
@@ -88,6 +88,7 @@ module Danger
88
88
  it 'test with package coverage' do
89
89
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
90
90
 
91
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
91
92
  @my_plugin.minimum_project_coverage_percentage = 50
92
93
  @my_plugin.minimum_package_coverage_map = { 'com/example/' => 70 }
93
94
 
@@ -99,6 +100,7 @@ module Danger
99
100
  it 'test with bigger overlapped package coverage' do
100
101
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
101
102
 
103
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
102
104
  @my_plugin.minimum_project_coverage_percentage = 50
103
105
  @my_plugin.minimum_package_coverage_map = {
104
106
  'com/example/' => 70,
@@ -113,6 +115,7 @@ module Danger
113
115
  it 'test with lower overlapped package coverage' do
114
116
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
115
117
 
118
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
116
119
  @my_plugin.minimum_project_coverage_percentage = 50
117
120
  @my_plugin.minimum_package_coverage_map = {
118
121
  'com/example/' => 77,
@@ -127,6 +130,7 @@ module Danger
127
130
  it 'test with overlapped package coverage and bigger class coverage' do
128
131
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
129
132
 
133
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
130
134
  @my_plugin.minimum_project_coverage_percentage = 50
131
135
  @my_plugin.minimum_package_coverage_map = {
132
136
  'com/example/' => 77,
@@ -142,6 +146,7 @@ module Danger
142
146
  it 'test with overlapped package coverage and lower class coverage' do
143
147
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
144
148
 
149
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
145
150
  @my_plugin.minimum_project_coverage_percentage = 50
146
151
  @my_plugin.minimum_package_coverage_map = {
147
152
  'com/example/' => 90,
@@ -154,24 +159,10 @@ module Danger
154
159
  expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 80% | :warning: |')
155
160
  end
156
161
 
157
- it 'checks modified files when "only_check_new_files" attribute is false' do
158
- path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
159
-
160
- @my_plugin.minimum_project_coverage_percentage = 50
161
- @my_plugin.only_check_new_files = false
162
-
163
- @my_plugin.report path_a
164
-
165
- expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 55.59% :white_check_mark:')
166
- expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
167
- expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
168
- expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 0% | :white_check_mark: |')
169
- expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
170
- end
171
-
172
162
  it 'defaults "only_check_new_files" attribute to false' do
173
163
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
174
164
 
165
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
175
166
  @my_plugin.minimum_project_coverage_percentage = 50
176
167
 
177
168
  @my_plugin.report path_a
@@ -180,25 +171,10 @@ module Danger
180
171
  expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 0% | :white_check_mark: |')
181
172
  end
182
173
 
183
- it 'does _not_ check modified files when "only_check_new_files" attribute is true' do
184
- path_a = "#{File.dirname(__FILE__)}/fixtures/output_c.xml"
185
-
186
- @my_plugin.minimum_project_coverage_percentage = 50
187
- @my_plugin.minimum_class_coverage_percentage = 70
188
- @my_plugin.only_check_new_files = true
189
-
190
- @my_plugin.report path_a
191
-
192
- expect(@dangerfile.status_report[:markdowns][0].message).to include('### JaCoCo Code Coverage 55.59% :white_check_mark:')
193
- expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
194
- expect(@dangerfile.status_report[:markdowns][0].message).to include('|:---|:---:|:---:|:---:|')
195
- expect(@dangerfile.status_report[:markdowns][0].message).to include('| `io/sample/UseCase` | 66% | 70% | :warning: |')
196
- expect(@dangerfile.status_report[:markdowns][0].message).not_to include('com/example/CachedRepository')
197
- end
198
-
199
174
  it 'adds a link to report' do
200
175
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
201
176
 
177
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
202
178
  @my_plugin.minimum_class_coverage_percentage = 80
203
179
  @my_plugin.minimum_project_coverage_percentage = 50
204
180
 
@@ -210,6 +186,7 @@ module Danger
210
186
  it 'When option "fail_no_coverage_data_found" is set to optionally fail, it doesn\'t fail the execution' do
211
187
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
212
188
 
189
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
213
190
  @my_plugin.minimum_class_coverage_percentage = 80
214
191
  @my_plugin.minimum_project_coverage_percentage = 50
215
192
 
@@ -219,6 +196,7 @@ module Danger
219
196
  it 'When option "fail_no_coverage_data_found" is not set, the execution fails on empty data' do
220
197
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
221
198
 
199
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
222
200
  @my_plugin.minimum_class_coverage_percentage = 80
223
201
  @my_plugin.minimum_project_coverage_percentage = 50
224
202
 
@@ -228,6 +206,7 @@ module Danger
228
206
  it 'When option "fail_no_coverage_data_found" is set to optionally fail, the execution fails on empty data' do
229
207
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
230
208
 
209
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
231
210
  @my_plugin.minimum_class_coverage_percentage = 80
232
211
  @my_plugin.minimum_project_coverage_percentage = 50
233
212
 
@@ -237,6 +216,7 @@ module Danger
237
216
  it 'When option "fail_no_coverage_data_found" is set to optionally warn (not fail), the execution doesn\'t fail on empty data' do
238
217
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_b.xml"
239
218
 
219
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
240
220
  @my_plugin.minimum_class_coverage_percentage = 80
241
221
  @my_plugin.minimum_project_coverage_percentage = 50
242
222
 
@@ -246,6 +226,7 @@ module Danger
246
226
  it 'prints default success subtitle' do
247
227
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
248
228
 
229
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
249
230
  @my_plugin.minimum_project_coverage_percentage = 30
250
231
  @my_plugin.minimum_class_coverage_percentage = 40
251
232
 
@@ -262,6 +243,7 @@ module Danger
262
243
  it 'prints default failure subtitle' do
263
244
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
264
245
 
246
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
265
247
  @my_plugin.minimum_project_coverage_percentage = 30
266
248
  @my_plugin.minimum_class_coverage_percentage = 60
267
249
 
@@ -278,6 +260,7 @@ module Danger
278
260
  it 'prints custom success subtitle' do
279
261
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
280
262
 
263
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
281
264
  @my_plugin.minimum_project_coverage_percentage = 30
282
265
  @my_plugin.minimum_class_coverage_percentage = 40
283
266
  @my_plugin.subtitle_success = 'You rock! 🔥'
@@ -295,6 +278,7 @@ module Danger
295
278
  it 'prints custom failure subtitle' do
296
279
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
297
280
 
281
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
298
282
  @my_plugin.minimum_project_coverage_percentage = 30
299
283
  @my_plugin.minimum_class_coverage_percentage = 60
300
284
  @my_plugin.subtitle_failure = 'Too bad :('
@@ -312,6 +296,8 @@ module Danger
312
296
  it 'prints default class column title' do
313
297
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
314
298
 
299
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
300
+
315
301
  @my_plugin.report path_a
316
302
 
317
303
  expect(@dangerfile.status_report[:markdowns][0].message).to include('| Class | Covered | Required | Status |')
@@ -320,6 +306,7 @@ module Danger
320
306
  it 'prints custom class column title' do
321
307
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
322
308
 
309
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
323
310
  @my_plugin.class_column_title = 'New files'
324
311
 
325
312
  @my_plugin.report path_a
@@ -330,6 +317,7 @@ module Danger
330
317
  it 'instruction coverage takes over all the rest coverages for classes' do
331
318
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_d.xml"
332
319
 
320
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
333
321
  @my_plugin.minimum_class_coverage_percentage = 50
334
322
 
335
323
  @my_plugin.report path_a
@@ -340,6 +328,7 @@ module Danger
340
328
  it 'branch coverage takes over line coverage for classes, when instruction coverage is not available' do
341
329
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_e.xml"
342
330
 
331
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
343
332
  @my_plugin.minimum_class_coverage_percentage = 50
344
333
 
345
334
  @my_plugin.report path_a
@@ -350,6 +339,7 @@ module Danger
350
339
  it 'line coverage takes over for classes, when both instruction coverage and branch coverage are not available' do
351
340
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_f.xml"
352
341
 
342
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
353
343
  @my_plugin.minimum_class_coverage_percentage = 50
354
344
 
355
345
  @my_plugin.report path_a
@@ -366,6 +356,7 @@ module Danger
366
356
  it 'applies minimum_composable_class_coverage_percentage' do
367
357
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
368
358
 
359
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
369
360
  @my_plugin.minimum_class_coverage_percentage = 55
370
361
  @my_plugin.minimum_composable_class_coverage_percentage = 45
371
362
 
@@ -384,6 +375,7 @@ module Danger
384
375
  it 'does not apply minimum_composable_class_coverage_percentage' do
385
376
  path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
386
377
 
378
+ @my_plugin.files_to_check = ['src/java/com/example/CachedRepository.java', 'src/java/io/sample/UseCase.java']
387
379
  @my_plugin.minimum_class_coverage_percentage = 55
388
380
  @my_plugin.minimum_composable_class_coverage_percentage = 45
389
381
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-jacoco-instacart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Malinskiy