danger-jacoco 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jacoco/gem_version.rb +1 -1
- data/lib/jacoco/plugin.rb +11 -4
- data/spec/jacoco_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcd89ebcb13f3f1b65870f29978d0cc97a5ba32d93ff21f45e86f4555453138c
|
4
|
+
data.tar.gz: b2d8b2c4c2b4db6d575d63f5ac0a13091834a6a68e1eff219bfdc1ae79ddc10f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348de1e3cdc0382fec039843280c99caf44bf5ccc3dfdd6e370d069d64118a658e9512e5841f76902e63bb524b186d700d3504e50ee8eb0d5ba799ff685b5c94
|
7
|
+
data.tar.gz: f17d7321065b6e76433b1f3104bfecc775e26e2681df8d66835fbe880af24ec2988b02826b93f35e6ce7fcf18ec31690614534cd534f8c9247eb63a2b491cf82
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -59,7 +59,7 @@ module Danger
|
|
59
59
|
# Java => blah/blah/java/slashed_package/Source.java
|
60
60
|
# Kotlin => blah/blah/kotlin/slashed_package/Source.kt
|
61
61
|
#
|
62
|
-
def report(path, report_url = '', delimiter = %r{/java/|/kotlin/}, fail_no_coverage_data_found: true)
|
62
|
+
def report(path, report_url = '', delimiter = %r{/java/|/kotlin/|/scala/}, fail_no_coverage_data_found: true)
|
63
63
|
@fail_no_coverage_data_found = fail_no_coverage_data_found
|
64
64
|
|
65
65
|
setup
|
@@ -98,9 +98,7 @@ module Danger
|
|
98
98
|
counter = coverage_counter(jacoco_class)
|
99
99
|
unless counter.nil?
|
100
100
|
coverage = (counter.covered.fdiv(counter.covered + counter.missed) * 100).floor
|
101
|
-
required_coverage =
|
102
|
-
required_coverage = package_coverage(jacoco_class.name) if required_coverage.nil?
|
103
|
-
required_coverage = minimum_class_coverage_percentage if required_coverage.nil?
|
101
|
+
required_coverage = required_class_coverage(jacoco_class)
|
104
102
|
status = coverage_status(coverage, required_coverage)
|
105
103
|
|
106
104
|
report_result = {
|
@@ -113,6 +111,15 @@ module Danger
|
|
113
111
|
report_result
|
114
112
|
end
|
115
113
|
|
114
|
+
# Determines the required coverage for the class
|
115
|
+
def required_class_coverage(jacoco_class)
|
116
|
+
key = minimum_class_coverage_map.keys.detect { |k| jacoco_class.name.match(k) } || jacoco_class.name
|
117
|
+
required_coverage = minimum_class_coverage_map[key]
|
118
|
+
required_coverage = package_coverage(jacoco_class.name) if required_coverage.nil?
|
119
|
+
required_coverage = minimum_class_coverage_percentage if required_coverage.nil?
|
120
|
+
required_coverage
|
121
|
+
end
|
122
|
+
|
116
123
|
# it returns the most suitable coverage by package name to class or nil
|
117
124
|
def package_coverage(class_name)
|
118
125
|
path = class_name
|
data/spec/jacoco_spec.rb
CHANGED
@@ -43,6 +43,17 @@ module Danger
|
|
43
43
|
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 100% | :warning: |')
|
44
44
|
end
|
45
45
|
|
46
|
+
it 'test regex class coverage' do
|
47
|
+
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
48
|
+
|
49
|
+
@my_plugin.minimum_project_coverage_percentage = 50
|
50
|
+
@my_plugin.minimum_class_coverage_map = { '.*Repository' => 60 }
|
51
|
+
|
52
|
+
@my_plugin.report path_a
|
53
|
+
|
54
|
+
expect(@dangerfile.status_report[:markdowns][0].message).to include('| `com/example/CachedRepository` | 50% | 60% | :warning: |')
|
55
|
+
end
|
56
|
+
|
46
57
|
it 'test with package coverage' do
|
47
58
|
path_a = "#{File.dirname(__FILE__)}/fixtures/output_a.xml"
|
48
59
|
|
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.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Malinskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
223
|
+
rubygems_version: 3.3.26
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: A longer description of danger-jacoco.
|