danger-jacoco-instacart 0.1.12 → 0.1.13
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/.yardoc/checksums +2 -2
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +12 -1
- data/spec/jacoco_spec.rb +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b74ccc5974fdd122bb8909a71b541891e760d99f7cfd120c06d71c133c2b32
|
4
|
+
data.tar.gz: 9f8e75aa5cf7611307255edb1ae2119e81f5c7010700d324d1b7041cd7d5d275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2bc98c6c2693be43e96012f0ac3b2000911fca7610fba47387046f908797eb49a4b2f04d505af4ddd359cae44703725c1216bf9716bb0cf62c58b20636dca5
|
7
|
+
data.tar.gz: 9f768d669d1eb720bf898ab9fbdfd6deb8fd68994a67ae490938eee2fd4c693dcfb0a06314b466fef6c9109424f037738171e77113546579986a1ca6dfce4266
|
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
|
3
|
-
/Users/alexanderbezverhni/workspace/junk/danger-jacoco/lib/jacoco/plugin.rb
|
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
|
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
|
data/.yardoc/objects/root.dat
CHANGED
Binary file
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -23,7 +23,7 @@ module Danger
|
|
23
23
|
attr_accessor :minimum_project_coverage_percentage, :minimum_class_coverage_percentage,
|
24
24
|
:minimum_composable_class_coverage_percentage, :only_check_new_files, :files_extension,
|
25
25
|
:minimum_package_coverage_map, :minimum_class_coverage_map, :fail_no_coverage_data_found,
|
26
|
-
:title, :class_column_title, :subtitle_success, :subtitle_failure
|
26
|
+
:title, :class_column_title, :subtitle_success, :subtitle_failure, :file_to_create_on_failure
|
27
27
|
|
28
28
|
# Initialize the plugin with configured parameters or defaults
|
29
29
|
def setup
|
@@ -31,6 +31,7 @@ module Danger
|
|
31
31
|
setup_texts
|
32
32
|
@only_check_new_files = false unless only_check_new_files
|
33
33
|
@files_extension = ['.kt', '.java'] unless files_extension
|
34
|
+
@file_to_create_on_failure = 'danger_jacoco_failure_status_file.txt' unless file_to_create_on_failure
|
34
35
|
end
|
35
36
|
|
36
37
|
# Initialize the plugin with configured optional texts
|
@@ -231,14 +232,24 @@ module Danger
|
|
231
232
|
# fail danger if total coverage is smaller than minimum_project_coverage_percentage
|
232
233
|
covered = total_covered[:covered]
|
233
234
|
fail("Total coverage of #{covered}%. Improve this to at least #{minimum_project_coverage_percentage}%")
|
235
|
+
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that this line is unreachable since priorly called "fail" raises an error, but in fact "fail" is caught and handled)
|
236
|
+
create_status_file_on_failure if class_coverage_above_minimum
|
237
|
+
# rubocop:enable Lint/UnreachableCode
|
234
238
|
end
|
235
239
|
|
236
240
|
return if class_coverage_above_minimum
|
237
241
|
|
238
242
|
fail("Class coverage is below minimum. Improve to at least #{minimum_class_coverage_percentage}%")
|
243
|
+
# rubocop:disable Lint/UnreachableCode (rubocop mistakenly thinks that this line is unreachable since priorly called "fail" raises an error, but in fact "fail" is caught and handled)
|
244
|
+
create_status_file_on_failure
|
245
|
+
# rubocop:enable Lint/UnreachableCode
|
239
246
|
end
|
240
247
|
# rubocop:enable Style/SignalException
|
241
248
|
|
249
|
+
def create_status_file_on_failure
|
250
|
+
File.open(file_to_create_on_failure, 'w') {}
|
251
|
+
end
|
252
|
+
|
242
253
|
def markdown_class(parser, report_markdown, report_url, class_to_file_path_hash)
|
243
254
|
class_coverage_above_minimum = true
|
244
255
|
parser.classes.each do |jacoco_class| # Check metrics for each classes
|
data/spec/jacoco_spec.rb
CHANGED
@@ -25,6 +25,7 @@ module Danger
|
|
25
25
|
|
26
26
|
allow(@dangerfile.git).to receive(:modified_files).and_return(modified_files)
|
27
27
|
allow(@dangerfile.git).to receive(:added_files).and_return(added_files)
|
28
|
+
allow(File).to receive(:open).and_call_original
|
28
29
|
end
|
29
30
|
|
30
31
|
it :report do
|
@@ -43,6 +44,36 @@ module Danger
|
|
43
44
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
44
45
|
end
|
45
46
|
|
47
|
+
it 'creates supplied status file upon failure' do
|
48
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
49
|
+
|
50
|
+
@my_plugin.minimum_project_coverage_percentage = 100
|
51
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
52
|
+
@my_plugin.file_to_create_on_failure = 'kmm.txt'
|
53
|
+
|
54
|
+
expect(File).to receive(:open).with('kmm.txt', 'w')
|
55
|
+
@my_plugin.report path_a
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'creates default status file upon failure' do
|
59
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
60
|
+
|
61
|
+
@my_plugin.minimum_class_coverage_percentage = 60
|
62
|
+
|
63
|
+
expect(File).to receive(:open).with('danger_jacoco_failure_status_file.txt', 'w')
|
64
|
+
@my_plugin.report path_a
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'does _not_ create status file upon success' do
|
68
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
69
|
+
|
70
|
+
@my_plugin.minimum_class_coverage_percentage = 40
|
71
|
+
@my_plugin.file_to_create_on_failure = 'kmm.txt'
|
72
|
+
|
73
|
+
expect(File).to_not receive(:open).with('kmm.txt', 'w')
|
74
|
+
@my_plugin.report path_a
|
75
|
+
end
|
76
|
+
|
46
77
|
it 'test regex class coverage' do
|
47
78
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
48
79
|
|
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.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Malinskiy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-09-
|
12
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: danger-plugin-api
|