danger-jacoco 0.1.7 → 0.1.8
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 +10 -3
- data/spec/jacoco_spec.rb +11 -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: e27bdd91acf2d25a2fa8f0eb6e0a07e5375f6864d831d8ca3883437db5d95bd3
|
4
|
+
data.tar.gz: 4f5bfaf1bdecdf96e99044f0f63db762f52adbea608654b334f85e80588d3ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 873ab75273b2c8cdefcd3fe3fb524e5fe2173debfa4cc96c44a0b8a5ec5c2de3d8e0a4c89107467d2abff3976d6e7244fd14fa7c5e0fed6bbad6b0c3e25e2b53
|
7
|
+
data.tar.gz: ac8dba5b3af75092aa7e483f5d0fdde9780df01aa5f38cbc3b6f9f71cc29f182d8bf50398425991900b976406c32f16923cda9acbfb6c7c49287ed7f6f06d32c
|
data/lib/jacoco/gem_version.rb
CHANGED
data/lib/jacoco/plugin.rb
CHANGED
@@ -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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Malinskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|