danger-shroud 0.0.4 → 0.0.6
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 +10 -0
- data/.github/workflows/publish.yml +6 -3
- data/Gemfile.lock +101 -68
- data/README.md +34 -5
- data/lib/shroud/gem_version.rb +1 -1
- data/lib/shroud/plugin.rb +93 -18
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f975c92a31f10bca3fc2a6172d1a22234a54efb953ba177618eb57bcf5b41d4d
|
4
|
+
data.tar.gz: fc40d2e2393708e0d19716fc7adb9f9495c253756f7b623831217db663729b7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a39b278261fb7162d399b37ba70ae72522578e6a5438f48f90fef71e8cf9b8cc59fcf6cfa1285814d0ff93f14cffa48269dbd527dcfa9647abc9d81f1ebc9bd8
|
7
|
+
data.tar.gz: 2575bf0d9b1d91827e658565051e359808ed55bc7f6615e759084063fc5aebac9939e853ae8d45f58f50eb826e6238d14fc732ac60bb3d975fc4d358d0b2fc9e
|
@@ -4,6 +4,9 @@ on:
|
|
4
4
|
push:
|
5
5
|
branches: [ "master" ]
|
6
6
|
|
7
|
+
env:
|
8
|
+
RUBY_VERSION: 2.7.2
|
9
|
+
|
7
10
|
jobs:
|
8
11
|
build:
|
9
12
|
name: Build + Publish
|
@@ -14,10 +17,10 @@ jobs:
|
|
14
17
|
|
15
18
|
steps:
|
16
19
|
- uses: actions/checkout@v3
|
17
|
-
- name: Set up Ruby
|
18
|
-
uses:
|
20
|
+
- name: Set up Ruby ${{ env.RUBY_VERSION }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
19
22
|
with:
|
20
|
-
ruby-version:
|
23
|
+
ruby-version: ${{ env.RUBY_VERSION }}
|
21
24
|
|
22
25
|
- name: Publish to RubyGems
|
23
26
|
run: |
|
data/Gemfile.lock
CHANGED
@@ -1,56 +1,78 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-shroud (0.0.
|
4
|
+
danger-shroud (0.0.6)
|
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.
|
12
|
-
public_suffix (>= 2.0.2, <
|
13
|
-
ast (2.4.
|
14
|
-
claide (1.0
|
11
|
+
addressable (2.8.1)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
ast (2.4.2)
|
14
|
+
claide (1.1.0)
|
15
15
|
claide-plugins (0.9.2)
|
16
16
|
cork
|
17
17
|
nap
|
18
18
|
open4 (~> 1.3)
|
19
|
-
coderay (1.1.
|
19
|
+
coderay (1.1.3)
|
20
20
|
colored2 (3.1.2)
|
21
21
|
cork (0.3.0)
|
22
22
|
colored2 (~> 3.1)
|
23
|
-
danger (
|
23
|
+
danger (9.1.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 (
|
28
|
+
faraday (>= 0.9.0, < 2.0)
|
29
29
|
faraday-http-cache (~> 2.0)
|
30
|
-
git (~> 1.
|
31
|
-
kramdown (~> 2.
|
30
|
+
git (~> 1.7)
|
31
|
+
kramdown (~> 2.3)
|
32
32
|
kramdown-parser-gfm (~> 1.0)
|
33
33
|
no_proxy_fix
|
34
|
-
octokit (~>
|
35
|
-
terminal-table (
|
34
|
+
octokit (~> 5.0)
|
35
|
+
terminal-table (>= 1, < 4)
|
36
36
|
danger-plugin-api (1.0.0)
|
37
37
|
danger (> 2.0)
|
38
|
-
diff-lcs (1.
|
39
|
-
faraday (
|
40
|
-
|
41
|
-
|
42
|
-
faraday (~>
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
diff-lcs (1.5.0)
|
39
|
+
faraday (1.10.2)
|
40
|
+
faraday-em_http (~> 1.0)
|
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)
|
50
|
+
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
|
+
faraday-http-cache (2.4.1)
|
55
|
+
faraday (>= 0.8)
|
56
|
+
faraday-httpclient (1.0.1)
|
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)
|
64
|
+
ffi (1.15.5)
|
65
|
+
formatador (1.1.0)
|
66
|
+
git (1.12.0)
|
67
|
+
addressable (~> 2.8)
|
46
68
|
rchardet (~> 1.8)
|
47
|
-
guard (2.
|
69
|
+
guard (2.18.0)
|
48
70
|
formatador (>= 0.2.4)
|
49
71
|
listen (>= 2.7, < 4.0)
|
50
72
|
lumberjack (>= 1.0.12, < 2.0)
|
51
73
|
nenv (~> 0.1)
|
52
74
|
notiffany (~> 0.0)
|
53
|
-
pry (>= 0.
|
75
|
+
pry (>= 0.13.0)
|
54
76
|
shellany (~> 0.0)
|
55
77
|
thor (>= 0.18.1)
|
56
78
|
guard-compat (1.2.1)
|
@@ -58,76 +80,87 @@ GEM
|
|
58
80
|
guard (~> 2.1)
|
59
81
|
guard-compat (~> 1.1)
|
60
82
|
rspec (>= 2.99.0, < 4.0)
|
61
|
-
|
62
|
-
kramdown (2.
|
83
|
+
json (2.6.3)
|
84
|
+
kramdown (2.4.0)
|
63
85
|
rexml
|
64
86
|
kramdown-parser-gfm (1.1.0)
|
65
87
|
kramdown (~> 2.0)
|
66
88
|
listen (3.0.7)
|
67
89
|
rb-fsevent (>= 0.9.3)
|
68
90
|
rb-inotify (>= 0.9.7)
|
69
|
-
lumberjack (1.
|
70
|
-
method_source (0.
|
91
|
+
lumberjack (1.2.8)
|
92
|
+
method_source (1.0.0)
|
71
93
|
mini_portile2 (2.8.0)
|
72
|
-
multipart-post (2.
|
94
|
+
multipart-post (2.2.3)
|
73
95
|
nap (1.1.0)
|
74
96
|
nenv (0.3.0)
|
75
97
|
no_proxy_fix (0.1.2)
|
76
|
-
nokogiri (1.13.
|
98
|
+
nokogiri (1.13.10)
|
77
99
|
mini_portile2 (~> 2.8.0)
|
78
100
|
racc (~> 1.4)
|
79
|
-
|
101
|
+
nokogiri (1.13.10-arm64-darwin)
|
102
|
+
racc (~> 1.4)
|
103
|
+
notiffany (0.1.3)
|
80
104
|
nenv (~> 0.1)
|
81
105
|
shellany (~> 0.0)
|
82
|
-
octokit (
|
83
|
-
faraday (>=
|
84
|
-
sawyer (~> 0.
|
106
|
+
octokit (5.6.1)
|
107
|
+
faraday (>= 1, < 3)
|
108
|
+
sawyer (~> 0.9)
|
85
109
|
open4 (1.3.4)
|
86
|
-
parallel (1.
|
87
|
-
parser (
|
88
|
-
ast (~> 2.4.
|
89
|
-
pry (0.
|
90
|
-
coderay (~> 1.1
|
91
|
-
method_source (~>
|
92
|
-
public_suffix (
|
93
|
-
racc (1.6.
|
94
|
-
rainbow (3.
|
95
|
-
rake (13.0.
|
96
|
-
rb-fsevent (0.
|
97
|
-
rb-inotify (0.10.
|
110
|
+
parallel (1.22.1)
|
111
|
+
parser (3.1.3.0)
|
112
|
+
ast (~> 2.4.1)
|
113
|
+
pry (0.14.1)
|
114
|
+
coderay (~> 1.1)
|
115
|
+
method_source (~> 1.0)
|
116
|
+
public_suffix (5.0.1)
|
117
|
+
racc (1.6.1)
|
118
|
+
rainbow (3.1.1)
|
119
|
+
rake (13.0.6)
|
120
|
+
rb-fsevent (0.11.2)
|
121
|
+
rb-inotify (0.10.1)
|
98
122
|
ffi (~> 1.0)
|
99
123
|
rchardet (1.8.0)
|
124
|
+
regexp_parser (2.6.1)
|
100
125
|
rexml (3.2.5)
|
101
|
-
rspec (3.
|
102
|
-
rspec-core (~> 3.
|
103
|
-
rspec-expectations (~> 3.
|
104
|
-
rspec-mocks (~> 3.
|
105
|
-
rspec-core (3.
|
106
|
-
rspec-support (~> 3.
|
107
|
-
rspec-expectations (3.
|
126
|
+
rspec (3.12.0)
|
127
|
+
rspec-core (~> 3.12.0)
|
128
|
+
rspec-expectations (~> 3.12.0)
|
129
|
+
rspec-mocks (~> 3.12.0)
|
130
|
+
rspec-core (3.12.0)
|
131
|
+
rspec-support (~> 3.12.0)
|
132
|
+
rspec-expectations (3.12.0)
|
108
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
-
rspec-support (~> 3.
|
110
|
-
rspec-mocks (3.
|
134
|
+
rspec-support (~> 3.12.0)
|
135
|
+
rspec-mocks (3.12.0)
|
111
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
-
rspec-support (~> 3.
|
113
|
-
rspec-support (3.
|
114
|
-
rubocop (
|
115
|
-
|
137
|
+
rspec-support (~> 3.12.0)
|
138
|
+
rspec-support (3.12.0)
|
139
|
+
rubocop (1.40.0)
|
140
|
+
json (~> 2.3)
|
116
141
|
parallel (~> 1.10)
|
117
|
-
parser (>= 2.
|
142
|
+
parser (>= 3.1.2.1)
|
118
143
|
rainbow (>= 2.2.2, < 4.0)
|
144
|
+
regexp_parser (>= 1.8, < 3.0)
|
145
|
+
rexml (>= 3.2.5, < 4.0)
|
146
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
119
147
|
ruby-progressbar (~> 1.7)
|
120
|
-
unicode-display_width (>= 1.4.0, <
|
121
|
-
|
122
|
-
|
148
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
149
|
+
rubocop-ast (1.24.0)
|
150
|
+
parser (>= 3.1.1.0)
|
151
|
+
ruby-progressbar (1.11.0)
|
152
|
+
ruby2_keywords (0.0.5)
|
153
|
+
sawyer (0.9.2)
|
123
154
|
addressable (>= 2.3.5)
|
124
|
-
faraday (
|
155
|
+
faraday (>= 0.17.3, < 3)
|
125
156
|
shellany (0.0.1)
|
126
|
-
terminal-table (
|
127
|
-
unicode-display_width (
|
128
|
-
thor (
|
129
|
-
unicode-display_width (
|
130
|
-
|
157
|
+
terminal-table (3.0.2)
|
158
|
+
unicode-display_width (>= 1.1.1, < 3)
|
159
|
+
thor (1.2.1)
|
160
|
+
unicode-display_width (2.3.0)
|
161
|
+
webrick (1.7.0)
|
162
|
+
yard (0.9.28)
|
163
|
+
webrick (~> 1.7.0)
|
131
164
|
|
132
165
|
PLATFORMS
|
133
166
|
ruby
|
@@ -145,4 +178,4 @@ DEPENDENCIES
|
|
145
178
|
yard
|
146
179
|
|
147
180
|
BUNDLED WITH
|
148
|
-
2.
|
181
|
+
2.3.18
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# danger-shroud
|
2
2
|
|
3
|
-
A danger plugin for enforcing code coverage coverage via a Jacoco coverage
|
3
|
+
A danger plugin for enforcing code coverage coverage via a Kover or Jacoco coverage report.
|
4
4
|
|
5
5
|
![Shroud Banner Image](images/bannerImage.png)
|
6
6
|
|
@@ -12,7 +12,36 @@ Add this line to your application's Gemfile:
|
|
12
12
|
gem 'danger-shroud'
|
13
13
|
```
|
14
14
|
|
15
|
-
## Usage
|
15
|
+
## Usage Kover
|
16
|
+
|
17
|
+
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
|
+
|
19
|
+
Running shroud with default values:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# Report coverage of modified files, fail if either total
|
23
|
+
# project coverage or any modified file's coverage is under 90%
|
24
|
+
shroud.reportKover 'Module Name', 'path/to/kover/report.xml'
|
25
|
+
```
|
26
|
+
|
27
|
+
Running shroud with custom coverage thresholds:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# Report coverage of modified files, fail if total project coverage is under 80%,
|
31
|
+
# or if any modified file's coverage is under 95%
|
32
|
+
shroud.reportKover 'Module Name', 'path/to/kover/report.xml', 80, 95
|
33
|
+
```
|
34
|
+
|
35
|
+
Warn on builds instead of fail:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# 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
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
## Usage Jacoco
|
16
45
|
|
17
46
|
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.
|
18
47
|
|
@@ -21,7 +50,7 @@ Running shroud with default values:
|
|
21
50
|
```ruby
|
22
51
|
# Report coverage of modified files, fail if either total
|
23
52
|
# project coverage or any modified file's coverage is under 90%
|
24
|
-
shroud.
|
53
|
+
shroud.reportJacoco 'Module Name', 'path/to/jacoco/report.xml'
|
25
54
|
```
|
26
55
|
|
27
56
|
Running shroud with custom coverage thresholds:
|
@@ -29,7 +58,7 @@ Running shroud with custom coverage thresholds:
|
|
29
58
|
```ruby
|
30
59
|
# Report coverage of modified files, fail if total project coverage is under 80%,
|
31
60
|
# or if any modified file's coverage is under 95%
|
32
|
-
shroud.
|
61
|
+
shroud.reportJacoco 'Module Name', 'path/to/jacoco/report.xml', 80, 95
|
33
62
|
```
|
34
63
|
|
35
64
|
Warn on builds instead of fail:
|
@@ -37,7 +66,7 @@ Warn on builds instead of fail:
|
|
37
66
|
```ruby
|
38
67
|
# Report coverage of modified files the same as the above example, except the
|
39
68
|
# builds will only warn instead of fail if below thresholds
|
40
|
-
shroud.
|
69
|
+
shroud.reportJacoco 'Module Name', 'path/to/jacoco/report.xml', 80, 95, false
|
41
70
|
```
|
42
71
|
|
43
72
|
|
data/lib/shroud/gem_version.rb
CHANGED
data/lib/shroud/plugin.rb
CHANGED
@@ -2,33 +2,53 @@ require 'nokogiri'
|
|
2
2
|
|
3
3
|
module Danger
|
4
4
|
|
5
|
-
# Parse a Jacoco report to enforce code coverage on CI. Results are passed out as a table in markdown.
|
5
|
+
# Parse a Kover or Jacoco report to enforce code coverage on CI. Results are passed out as a table in markdown.
|
6
6
|
#
|
7
|
-
# Shroud depends on having a Jacoco coverage report generated for your project.
|
8
|
-
# [jacoco-android-gradle-plugin](https://github.com/arturdm/jacoco-android-gradle-plugin) works well.
|
7
|
+
# Shroud depends on having a Kover or Jacoco coverage report generated for your project.
|
9
8
|
#
|
10
|
-
#
|
9
|
+
#
|
10
|
+
# @example Running Shroud with default values for Kover
|
11
11
|
#
|
12
12
|
# # Report coverage of modified files, fail if either total project coverage
|
13
13
|
# # or any modified file's coverage is under 90%
|
14
|
-
# shroud.
|
14
|
+
# shroud.reportKover 'Project Name', 'path/to/kover/report.xml'
|
15
15
|
#
|
16
|
-
# @example Running
|
16
|
+
# @example Running Shroud with custom coverage thresholds for Kover
|
17
17
|
#
|
18
18
|
# # Report coverage of modified files, fail if total project coverage is under 80%,
|
19
19
|
# # or if any modified file's coverage is under 95%
|
20
|
-
# shroud.
|
20
|
+
# shroud.reportKover 'Project Name', 'path/to/kover/report.xml', 80, 95
|
21
21
|
#
|
22
|
-
# @example Warn on builds instead of fail
|
22
|
+
# @example Warn on builds instead of fail for Kover
|
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.
|
26
|
+
# shroud.reportKover 'Project Name', 'path/to/kover/report.xml', 80, 95, false
|
27
|
+
#
|
28
|
+
# @example Running Shroud with default values for Jacoco
|
29
|
+
#
|
30
|
+
# # Report coverage of modified files, fail if either total project coverage
|
31
|
+
# # or any modified file's coverage is under 90%
|
32
|
+
# shroud.reportJacoco 'Project Name', 'path/to/jacoco/report.xml'
|
33
|
+
#
|
34
|
+
# @example Running Shroud with custom coverage thresholds for Jacoco
|
35
|
+
#
|
36
|
+
# # Report coverage of modified files, fail if total project coverage is under 80%,
|
37
|
+
# # or if any modified file's coverage is under 95%
|
38
|
+
# shroud.reportJacoco 'Project Name', 'path/to/jacoco/report.xml', 80, 95
|
39
|
+
#
|
40
|
+
# @example Warn on builds instead of fail for Jacoco
|
41
|
+
#
|
42
|
+
# # Report coverage of modified files the same as the above example, except the
|
43
|
+
# # builds will only warn instead of fail if below thresholds
|
44
|
+
# shroud.reportJacoco 'Project Name', 'path/to/jacoco/report.xml', 80, 95, false
|
27
45
|
#
|
28
|
-
# @tags android, jacoco, coverage
|
46
|
+
# @tags android, kover, jacoco, coverage
|
29
47
|
#
|
30
48
|
class DangerShroud < Plugin
|
31
49
|
|
50
|
+
# <b>DEPRECATED:</b> Please use <tt>reportJacoco</tt> or <tt>reportKover</tt> instead.
|
51
|
+
#
|
32
52
|
# Report coverage on diffed files, as well as overall coverage.
|
33
53
|
#
|
34
54
|
# @param [String] file
|
@@ -48,8 +68,63 @@ module Danger
|
|
48
68
|
#
|
49
69
|
# @return [void]
|
50
70
|
def report(file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderThreshold = true)
|
71
|
+
warn "[DEPRECATION] `report` is deprecated. Please use `reportJacoco` or `reportKover` instead."
|
72
|
+
reportJacoco('Project', file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderThreshold = true)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Report coverage on diffed files, as well as overall coverage.
|
76
|
+
#
|
77
|
+
# @param [String] moduleName
|
78
|
+
# the display name of the project or module
|
79
|
+
#
|
80
|
+
# @param [String] file
|
81
|
+
# file path to a Jacoco xml coverage report.
|
82
|
+
#
|
83
|
+
# @param [Integer] totalProjectThreshold
|
84
|
+
# defines the required percentage of total project coverage for a passing build.
|
85
|
+
# default 90.
|
86
|
+
#
|
87
|
+
# @param [Integer] modifiedFileThreshold
|
88
|
+
# defines the required percentage of files modified in a PR for a passing build.
|
89
|
+
# default 90.
|
90
|
+
#
|
91
|
+
# @param [Boolean] failIfUnderThreshold
|
92
|
+
# if true, will fail builds that are under the provided thresholds. if false, will only warn.
|
93
|
+
# default true.
|
94
|
+
#
|
95
|
+
# @return [void]
|
96
|
+
def reportJacoco(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderThreshold = true)
|
97
|
+
internalReport('Jacoco', moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderThreshold)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Report coverage on diffed files, as well as overall coverage.
|
101
|
+
#
|
102
|
+
# @param [String] moduleName
|
103
|
+
# the display name of the project or module
|
104
|
+
#
|
105
|
+
# @param [String] file
|
106
|
+
# file path to a Kover xml coverage report.
|
107
|
+
#
|
108
|
+
# @param [Integer] totalProjectThreshold
|
109
|
+
# defines the required percentage of total project coverage for a passing build.
|
110
|
+
# default 90.
|
111
|
+
#
|
112
|
+
# @param [Integer] modifiedFileThreshold
|
113
|
+
# defines the required percentage of files modified in a PR for a passing build.
|
114
|
+
# default 90.
|
115
|
+
#
|
116
|
+
# @param [Boolean] failIfUnderThreshold
|
117
|
+
# if true, will fail builds that are under the provided thresholds. if false, will only warn.
|
118
|
+
# default true.
|
119
|
+
#
|
120
|
+
# @return [void]
|
121
|
+
def reportKover(moduleName, file, totalProjectThreshold = 90, modifiedFileThreshold = 90, failIfUnderThreshold = true)
|
122
|
+
internalReport('Kover', moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderThreshold)
|
123
|
+
end
|
124
|
+
|
125
|
+
private def internalReport(reportType, moduleName, file, totalProjectThreshold, modifiedFileThreshold, failIfUnderThreshold)
|
51
126
|
raise "Please specify file name." if file.empty?
|
52
|
-
raise "No
|
127
|
+
raise "No #{reportType} xml report found at #{file}" unless File.exist? file
|
53
128
|
rawXml = File.read(file)
|
54
129
|
parsedXml = Nokogiri::XML.parse(rawXml)
|
55
130
|
totalInstructionCoverage = parsedXml.xpath("/report/counter[@type='INSTRUCTION']")
|
@@ -62,8 +137,8 @@ module Danger
|
|
62
137
|
touchedFileNames = @dangerfile.git.modified_files.map { |file| File.basename(file) }
|
63
138
|
touchedFileNames += @dangerfile.git.added_files.map { |file| File.basename(file) }
|
64
139
|
|
65
|
-
# used to later report files that were modified but not included in the
|
66
|
-
|
140
|
+
# used to later report files that were modified but not included in the report
|
141
|
+
fileNamesNotInReport = []
|
67
142
|
|
68
143
|
# hash for keeping track of coverage per filename: {filename => coverage percent}
|
69
144
|
touchedFilesHash = {}
|
@@ -80,16 +155,16 @@ module Danger
|
|
80
155
|
end
|
81
156
|
touchedFilesHash[touchedFileName] = (covered.to_f / (missed + covered)) * 100
|
82
157
|
else
|
83
|
-
|
158
|
+
fileNamesNotInReport << touchedFileName
|
84
159
|
end
|
85
160
|
end
|
86
161
|
|
87
162
|
puts "Here are unreported files"
|
88
|
-
puts
|
163
|
+
puts fileNamesNotInReport.to_s
|
89
164
|
puts "Here is the touched files coverage hash"
|
90
165
|
puts touchedFilesHash
|
91
166
|
|
92
|
-
output = "## 🧛
|
167
|
+
output = "## 🧛 #{moduleName} Code Coverage: **`#{'%.2f' % coveragePercent}%`**\n"
|
93
168
|
|
94
169
|
output << "### Coverage of Modified Files:\n"
|
95
170
|
output << "File | Coverage\n"
|
@@ -111,11 +186,11 @@ module Danger
|
|
111
186
|
end
|
112
187
|
|
113
188
|
output << "### Modified Files Not Found In Coverage Report:\n"
|
114
|
-
|
189
|
+
fileNamesNotInReport.sort.each do |unreportedFileName|
|
115
190
|
output << "#{unreportedFileName}\n"
|
116
191
|
end
|
117
192
|
|
118
|
-
output << '> Codebase cunningly covered by count [Shroud 🧛](https://github.com/livefront/
|
193
|
+
output << '> Codebase cunningly covered by count [Shroud 🧛](https://github.com/livefront/danger-shroud)'
|
119
194
|
markdown output
|
120
195
|
|
121
196
|
# warn or fail if total coverage is under specified threshold
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrewhaisting
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -171,6 +171,7 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- ".github/dependabot.yml"
|
174
175
|
- ".github/workflows/ci.yml"
|
175
176
|
- ".github/workflows/publish.yml"
|
176
177
|
- ".gitignore"
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
- !ruby/object:Gem::Version
|
209
210
|
version: '0'
|
210
211
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.1.4
|
212
213
|
signing_key:
|
213
214
|
specification_version: 4
|
214
215
|
summary: A danger plugin for enforcing code coverage via a Jacoco coverage report.
|