danger-shroud 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +1 -1
- data/Gemfile.lock +26 -50
- data/README.md +44 -7
- data/lib/shroud/gem_version.rb +1 -1
- data/lib/shroud/plugin.rb +29 -17
- 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: 234c6bbce9b759a9a8b744c477e5b0f90ab40d742830635a6ff284f85b1b1015
|
4
|
+
data.tar.gz: 21e54c40b94bdd7d4989516d5287279427888f07efc48475e6f754908f0b72c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ad01b61dfe54625578c9e8b8b26f0520cffcee3d63e5f7275a1a45c332e503f4c2d0d254fb6619e35e9d20d51fc982d917e370be23668ed82f3293343b77fa5
|
7
|
+
data.tar.gz: c5403ff85b292d6ad451ae73998e9fff69e76c462e260bf4dd8d918bc519fb88ff1fc38bde541421b25145eabbf70e96a04ceb4b1f26559b91f2f7fb53d30ef4
|
data/.github/dependabot.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-shroud (0.0.
|
4
|
+
danger-shroud (0.0.7)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
nokogiri
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.8.
|
11
|
+
addressable (2.8.4)
|
12
12
|
public_suffix (>= 2.0.2, < 6.0)
|
13
13
|
ast (2.4.2)
|
14
14
|
claide (1.1.0)
|
@@ -20,12 +20,12 @@ GEM
|
|
20
20
|
colored2 (3.1.2)
|
21
21
|
cork (0.3.0)
|
22
22
|
colored2 (~> 3.1)
|
23
|
-
danger (9.
|
23
|
+
danger (9.2.0)
|
24
24
|
claide (~> 1.0)
|
25
25
|
claide-plugins (>= 0.9.2)
|
26
26
|
colored2 (~> 3.1)
|
27
27
|
cork (~> 0.1)
|
28
|
-
faraday (>= 0.9.0, <
|
28
|
+
faraday (>= 0.9.0, < 3.0)
|
29
29
|
faraday-http-cache (~> 2.0)
|
30
30
|
git (~> 1.7)
|
31
31
|
kramdown (~> 2.3)
|
@@ -36,34 +36,15 @@ GEM
|
|
36
36
|
danger-plugin-api (1.0.0)
|
37
37
|
danger (> 2.0)
|
38
38
|
diff-lcs (1.5.0)
|
39
|
-
faraday (
|
40
|
-
faraday-
|
41
|
-
faraday-em_synchrony (~> 1.0)
|
42
|
-
faraday-excon (~> 1.1)
|
43
|
-
faraday-httpclient (~> 1.0)
|
44
|
-
faraday-multipart (~> 1.0)
|
45
|
-
faraday-net_http (~> 1.0)
|
46
|
-
faraday-net_http_persistent (~> 1.0)
|
47
|
-
faraday-patron (~> 1.0)
|
48
|
-
faraday-rack (~> 1.0)
|
49
|
-
faraday-retry (~> 1.0)
|
39
|
+
faraday (2.7.4)
|
40
|
+
faraday-net_http (>= 2.0, < 3.1)
|
50
41
|
ruby2_keywords (>= 0.0.4)
|
51
|
-
faraday-em_http (1.0.0)
|
52
|
-
faraday-em_synchrony (1.0.0)
|
53
|
-
faraday-excon (1.1.0)
|
54
42
|
faraday-http-cache (2.4.1)
|
55
43
|
faraday (>= 0.8)
|
56
|
-
faraday-
|
57
|
-
faraday-multipart (1.0.4)
|
58
|
-
multipart-post (~> 2)
|
59
|
-
faraday-net_http (1.0.1)
|
60
|
-
faraday-net_http_persistent (1.2.0)
|
61
|
-
faraday-patron (1.0.0)
|
62
|
-
faraday-rack (1.0.0)
|
63
|
-
faraday-retry (1.0.3)
|
44
|
+
faraday-net_http (3.0.2)
|
64
45
|
ffi (1.15.5)
|
65
46
|
formatador (1.1.0)
|
66
|
-
git (1.
|
47
|
+
git (1.18.0)
|
67
48
|
addressable (~> 2.8)
|
68
49
|
rchardet (~> 1.8)
|
69
50
|
guard (2.18.0)
|
@@ -90,16 +71,13 @@ GEM
|
|
90
71
|
rb-inotify (>= 0.9.7)
|
91
72
|
lumberjack (1.2.8)
|
92
73
|
method_source (1.0.0)
|
93
|
-
mini_portile2 (2.8.
|
94
|
-
multipart-post (2.2.3)
|
74
|
+
mini_portile2 (2.8.1)
|
95
75
|
nap (1.1.0)
|
96
76
|
nenv (0.3.0)
|
97
77
|
no_proxy_fix (0.1.2)
|
98
|
-
nokogiri (1.
|
78
|
+
nokogiri (1.14.3)
|
99
79
|
mini_portile2 (~> 2.8.0)
|
100
80
|
racc (~> 1.4)
|
101
|
-
nokogiri (1.13.10-arm64-darwin)
|
102
|
-
racc (~> 1.4)
|
103
81
|
notiffany (0.1.3)
|
104
82
|
nenv (~> 0.1)
|
105
83
|
shellany (~> 0.0)
|
@@ -108,47 +86,47 @@ GEM
|
|
108
86
|
sawyer (~> 0.9)
|
109
87
|
open4 (1.3.4)
|
110
88
|
parallel (1.22.1)
|
111
|
-
parser (3.
|
89
|
+
parser (3.2.2.0)
|
112
90
|
ast (~> 2.4.1)
|
113
|
-
pry (0.14.
|
91
|
+
pry (0.14.2)
|
114
92
|
coderay (~> 1.1)
|
115
93
|
method_source (~> 1.0)
|
116
94
|
public_suffix (5.0.1)
|
117
|
-
racc (1.6.
|
95
|
+
racc (1.6.2)
|
118
96
|
rainbow (3.1.1)
|
119
97
|
rake (13.0.6)
|
120
98
|
rb-fsevent (0.11.2)
|
121
99
|
rb-inotify (0.10.1)
|
122
100
|
ffi (~> 1.0)
|
123
101
|
rchardet (1.8.0)
|
124
|
-
regexp_parser (2.
|
102
|
+
regexp_parser (2.8.0)
|
125
103
|
rexml (3.2.5)
|
126
104
|
rspec (3.12.0)
|
127
105
|
rspec-core (~> 3.12.0)
|
128
106
|
rspec-expectations (~> 3.12.0)
|
129
107
|
rspec-mocks (~> 3.12.0)
|
130
|
-
rspec-core (3.12.
|
108
|
+
rspec-core (3.12.1)
|
131
109
|
rspec-support (~> 3.12.0)
|
132
|
-
rspec-expectations (3.12.
|
110
|
+
rspec-expectations (3.12.2)
|
133
111
|
diff-lcs (>= 1.2.0, < 2.0)
|
134
112
|
rspec-support (~> 3.12.0)
|
135
|
-
rspec-mocks (3.12.
|
113
|
+
rspec-mocks (3.12.5)
|
136
114
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
115
|
rspec-support (~> 3.12.0)
|
138
116
|
rspec-support (3.12.0)
|
139
|
-
rubocop (1.
|
117
|
+
rubocop (1.50.2)
|
140
118
|
json (~> 2.3)
|
141
119
|
parallel (~> 1.10)
|
142
|
-
parser (>= 3.
|
120
|
+
parser (>= 3.2.0.0)
|
143
121
|
rainbow (>= 2.2.2, < 4.0)
|
144
122
|
regexp_parser (>= 1.8, < 3.0)
|
145
123
|
rexml (>= 3.2.5, < 4.0)
|
146
|
-
rubocop-ast (>= 1.
|
124
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
147
125
|
ruby-progressbar (~> 1.7)
|
148
|
-
unicode-display_width (>=
|
149
|
-
rubocop-ast (1.
|
150
|
-
parser (>= 3.
|
151
|
-
ruby-progressbar (1.
|
126
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
127
|
+
rubocop-ast (1.28.0)
|
128
|
+
parser (>= 3.2.1.0)
|
129
|
+
ruby-progressbar (1.13.0)
|
152
130
|
ruby2_keywords (0.0.5)
|
153
131
|
sawyer (0.9.2)
|
154
132
|
addressable (>= 2.3.5)
|
@@ -157,10 +135,8 @@ GEM
|
|
157
135
|
terminal-table (3.0.2)
|
158
136
|
unicode-display_width (>= 1.1.1, < 3)
|
159
137
|
thor (1.2.1)
|
160
|
-
unicode-display_width (2.
|
161
|
-
|
162
|
-
yard (0.9.28)
|
163
|
-
webrick (~> 1.7.0)
|
138
|
+
unicode-display_width (2.4.2)
|
139
|
+
yard (0.9.34)
|
164
140
|
|
165
141
|
PLATFORMS
|
166
142
|
ruby
|
data/README.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
|
2
|
+
- [danger-shroud](#danger-shroud)
|
3
|
+
- [Installation](#installation)
|
4
|
+
- [Usage Kover](#usage-kover)
|
5
|
+
- [Parameters](#parameters)
|
6
|
+
- [Examples](#examples)
|
7
|
+
- [Usage Jacoco](#usage-jacoco)
|
8
|
+
- [Parameters](#parameters-1)
|
9
|
+
- [Examples](#examples-1)
|
10
|
+
- [Development](#development)
|
11
|
+
|
1
12
|
# danger-shroud
|
2
13
|
|
3
14
|
A danger plugin for enforcing code coverage coverage via a Kover or Jacoco coverage report.
|
@@ -16,6 +27,21 @@ gem 'danger-shroud'
|
|
16
27
|
|
17
28
|
Shroud depends on having a Kover coverage report generated for your project. For Android projects, [kotlinx-kover](https://github.com/Kotlin/kotlinx-kover) works well.
|
18
29
|
|
30
|
+
### Parameters
|
31
|
+
|
32
|
+
You can use the following parameters to control how shroud operates:
|
33
|
+
|
34
|
+
Param | Type | Description | Example
|
35
|
+
---|---|---|---|
|
36
|
+
moduleName | String | the display name of the project or module |`'Module Name '`
|
37
|
+
file | String | file path to a Kover xml coverage report. | `'path/to/kover/report.xml'`
|
38
|
+
totalProjectThreshold | Integer | defines the required percentage of total project coverage for a passing build. | default `90`
|
39
|
+
modifiedFileThreshold | Integer | defines the required percentage of files modified in a PR for a passing build. | default `90`
|
40
|
+
failIfUnderProjectThreshold | Boolean | if true, will fail builds that are under the provided thresholds. if false, will only warn. | default `true`
|
41
|
+
failIfUnderFileThreshold | Boolean | if true, will fail builds that are under the provided thresholds. if false, will only warn. | default `true`
|
42
|
+
|
43
|
+
### Examples
|
44
|
+
|
19
45
|
Running shroud with default values:
|
20
46
|
|
21
47
|
```ruby
|
@@ -36,13 +62,27 @@ Warn on builds instead of fail:
|
|
36
62
|
|
37
63
|
```ruby
|
38
64
|
# Report coverage of modified files the same as the above example, except the
|
39
|
-
# builds will only warn instead of fail if below thresholds
|
40
|
-
shroud.reportKover 'Module Name', 'path/to/kover/report.xml', 80, 95, false
|
65
|
+
# builds will only warn instead of fail if below project thresholds
|
66
|
+
shroud.reportKover 'Module Name', 'path/to/kover/report.xml', 80, 95, false, false
|
41
67
|
```
|
42
68
|
|
43
|
-
|
44
69
|
## Usage Jacoco
|
45
70
|
|
71
|
+
### Parameters
|
72
|
+
|
73
|
+
You can use the following parameters to control how shroud operates:
|
74
|
+
|
75
|
+
Param | Type | Description | Example
|
76
|
+
---|---|---|---|
|
77
|
+
moduleName | String | the display name of the project or module |`'Module Name '`
|
78
|
+
file | String | file path to a Kover xml coverage report. | `'path/to/jacoco/report.xml'`
|
79
|
+
totalProjectThreshold | Integer | defines the required percentage of total project coverage for a passing build. | default `90`
|
80
|
+
modifiedFileThreshold | Integer | defines the required percentage of files modified in a PR for a passing build. | default `90`
|
81
|
+
failIfUnderProjectThreshold | Boolean | if true, will fail builds that are under the provided thresholds. if false, will only warn. | default `true`
|
82
|
+
failIfUnderFileThreshold | Boolean | if true, will fail builds that are under the provided thresholds. if false, will only warn. | default `true`
|
83
|
+
|
84
|
+
### Examples
|
85
|
+
|
46
86
|
Shroud depends on having a Jacoco coverage report generated for your project. For Android projects, [jacoco-android-gradle-plugin](https://github.com/arturdm/jacoco-android-gradle-plugin) works well.
|
47
87
|
|
48
88
|
Running shroud with default values:
|
@@ -66,12 +106,9 @@ Warn on builds instead of fail:
|
|
66
106
|
```ruby
|
67
107
|
# Report coverage of modified files the same as the above example, except the
|
68
108
|
# builds will only warn instead of fail if below thresholds
|
69
|
-
shroud.reportJacoco 'Module Name', 'path/to/jacoco/report.xml', 80, 95, false
|
109
|
+
shroud.reportJacoco 'Module Name', 'path/to/jacoco/report.xml', 80, 95, false, false
|
70
110
|
```
|
71
111
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
112
|
## Development
|
76
113
|
|
77
114
|
1. Clone this repo
|
data/lib/shroud/gem_version.rb
CHANGED
data/lib/shroud/plugin.rb
CHANGED
@@ -23,7 +23,7 @@ module Danger
|
|
23
23
|
#
|
24
24
|
# # Report coverage of modified files the same as the above example, except the
|
25
25
|
# # builds will only warn instead of fail if below thresholds
|
26
|
-
# shroud.reportKover 'Project Name', 'path/to/kover/report.xml', 80, 95, false
|
26
|
+
# shroud.reportKover 'Project Name', 'path/to/kover/report.xml', 80, 95, false, false
|
27
27
|
#
|
28
28
|
# @example Running Shroud with default values for Jacoco
|
29
29
|
#
|
@@ -41,7 +41,7 @@ module Danger
|
|
41
41
|
#
|
42
42
|
# # Report coverage of modified files the same as the above example, except the
|
43
43
|
# # builds will only warn instead of fail if below thresholds
|
44
|
-
# shroud.reportJacoco 'Project Name', 'path/to/jacoco/report.xml', 80, 95, false
|
44
|
+
# shroud.reportJacoco 'Project Name', 'path/to/jacoco/report.xml', 80, 95, false, false
|
45
45
|
#
|
46
46
|
# @tags android, kover, jacoco, coverage
|
47
47
|
#
|
@@ -62,14 +62,18 @@ module Danger
|
|
62
62
|
# defines the required percentage of files modified in a PR for a passing build.
|
63
63
|
# default 90.
|
64
64
|
#
|
65
|
-
# @param [Boolean]
|
66
|
-
# if true, will fail builds that are under the provided thresholds.
|
65
|
+
# @param [Boolean] failIfUnderProjectThreshold
|
66
|
+
# if true, will fail builds that are under the provided thresholds for the overall project. If false, will only warn.
|
67
|
+
# default true.
|
68
|
+
#
|
69
|
+
# @param [Boolean] failIfUnderFileThreshold
|
70
|
+
# if true, will fail builds that are under the provided thresholds per file. If false, will only warn.
|
67
71
|
# default true.
|
68
72
|
#
|
69
73
|
# @return [void]
|
70
|
-
def report(file, totalProjectThreshold = 90, modifiedFileThreshold = 90,
|
74
|
+
def report(file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderProjectThreshold = true, failIfUnderFileThreshold = failIfUnderProjectThreshold)
|
71
75
|
warn "[DEPRECATION] `report` is deprecated. Please use `reportJacoco` or `reportKover` instead."
|
72
|
-
reportJacoco('Project', file, totalProjectThreshold = 90, modifiedFileThreshold = 90,
|
76
|
+
reportJacoco('Project', file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderProjectThreshold, failIfUnderFileThreshold)
|
73
77
|
end
|
74
78
|
|
75
79
|
# Report coverage on diffed files, as well as overall coverage.
|
@@ -88,13 +92,17 @@ module Danger
|
|
88
92
|
# defines the required percentage of files modified in a PR for a passing build.
|
89
93
|
# default 90.
|
90
94
|
#
|
91
|
-
# @param [Boolean]
|
92
|
-
# if true, will fail builds that are under the provided thresholds.
|
95
|
+
# @param [Boolean] failIfUnderProjectThreshold
|
96
|
+
# if true, will fail builds that are under the provided thresholds for the overall project. If false, will only warn.
|
97
|
+
# default true.
|
98
|
+
#
|
99
|
+
# @param [Boolean] failIfUnderFileThreshold
|
100
|
+
# if true, will fail builds that are under the provided thresholds per file. If false, will only warn.
|
93
101
|
# default true.
|
94
102
|
#
|
95
103
|
# @return [void]
|
96
|
-
def reportJacoco(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90,
|
97
|
-
internalReport('Jacoco', moduleName, file, totalProjectThreshold, modifiedFileThreshold,
|
104
|
+
def reportJacoco(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderProjectThreshold = true, failIfUnderFileThreshold = false)
|
105
|
+
internalReport('Jacoco', moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderProjectThreshold, failIfUnderFileThreshold)
|
98
106
|
end
|
99
107
|
|
100
108
|
# Report coverage on diffed files, as well as overall coverage.
|
@@ -113,16 +121,20 @@ module Danger
|
|
113
121
|
# defines the required percentage of files modified in a PR for a passing build.
|
114
122
|
# default 90.
|
115
123
|
#
|
116
|
-
# @param [Boolean]
|
117
|
-
# if true, will fail builds that are under the provided thresholds.
|
124
|
+
# @param [Boolean] failIfUnderProjectThreshold
|
125
|
+
# if true, will fail builds that are under the provided thresholds for the overall project. If false, will only warn.
|
126
|
+
# default true.
|
127
|
+
#
|
128
|
+
# @param [Boolean] failIfUnderFileThreshold
|
129
|
+
# if true, will fail builds that are under the provided thresholds per file. If false, will only warn.
|
118
130
|
# default true.
|
119
131
|
#
|
120
132
|
# @return [void]
|
121
|
-
def reportKover(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90,
|
122
|
-
internalReport('Kover', moduleName, file, totalProjectThreshold, modifiedFileThreshold,
|
133
|
+
def reportKover(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderProjectThreshold = true, failIfUnderFileThreshold = failIfUnderProjectThreshold)
|
134
|
+
internalReport('Kover', moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderProjectThreshold, failIfUnderFileThreshold)
|
123
135
|
end
|
124
136
|
|
125
|
-
private def internalReport(reportType, moduleName, file, totalProjectThreshold, modifiedFileThreshold,
|
137
|
+
private def internalReport(reportType, moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderProjectThreshold, failIfUnderFileThreshold)
|
126
138
|
raise "Please specify file name." if file.empty?
|
127
139
|
raise "No #{reportType} xml report found at #{file}" unless File.exist? file
|
128
140
|
rawXml = File.read(file)
|
@@ -177,7 +189,7 @@ module Danger
|
|
177
189
|
# warn or fail if under specified file threshold:
|
178
190
|
if (coveragePercent < modifiedFileThreshold)
|
179
191
|
warningMessage = "Uh oh! #{fileName} is under #{modifiedFileThreshold}% coverage!"
|
180
|
-
if (
|
192
|
+
if (failIfUnderFileThreshold)
|
181
193
|
fail warningMessage
|
182
194
|
else
|
183
195
|
warn warningMessage
|
@@ -196,7 +208,7 @@ module Danger
|
|
196
208
|
# warn or fail if total coverage is under specified threshold
|
197
209
|
if (coveragePercent < totalProjectThreshold)
|
198
210
|
totalCoverageWarning = "Uh oh! Your project is under #{totalProjectThreshold}% coverage!"
|
199
|
-
if (
|
211
|
+
if (failIfUnderProjectThreshold)
|
200
212
|
fail totalCoverageWarning
|
201
213
|
else
|
202
214
|
warn totalCoverageWarning
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-shroud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrewhaisting
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|