danger-kover 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/danger-kover-0.0.3.gem +0 -0
- data/danger-kover-0.0.4.gem +0 -0
- data/lib/kover/gem_version.rb +1 -1
- data/lib/kover/plugin.rb +52 -25
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1cbf44af41b300b520376b5a926a694936ceb469340cd7a0de06efc0d0e7b8e
|
4
|
+
data.tar.gz: 04eb0e742c15937f5b7edd6b5a0e3174e900e3a3777ce8f93a8527081e3f630e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a891c1fe7627631ecdf0d67f5c233aaab0b7f25cab395fc603db83d7f26e99f3ebeeadbbdf1263fe47004428ad4b2e74675bd722787f9a3b5d9adabc2478d737
|
7
|
+
data.tar.gz: 6f46c114ea07714b695e6fae674a8711e069b0fc7960d156ce854e45a156fd08c79f14a6ea697073f5b87b3cb66f12abdada896a8dc4716b1d8833d2b732cb3c
|
Binary file
|
Binary file
|
data/lib/kover/gem_version.rb
CHANGED
data/lib/kover/plugin.rb
CHANGED
@@ -60,6 +60,26 @@ module Danger
|
|
60
60
|
@fail_if_under_threshold ||= true
|
61
61
|
end
|
62
62
|
|
63
|
+
# Show plugin repository link.
|
64
|
+
# @return [Boolean]
|
65
|
+
attr_accessor :link_repository
|
66
|
+
|
67
|
+
# A getter for `link_repository`, returning `true` by default.
|
68
|
+
# @return [Boolean]
|
69
|
+
def link_repository
|
70
|
+
@link_repository ||= true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show not found files in report count.
|
74
|
+
# @return [Boolean]
|
75
|
+
attr_accessor :count_not_found
|
76
|
+
|
77
|
+
# A getter for `count_not_found`, returning `true` by default.
|
78
|
+
# @return [Boolean]
|
79
|
+
def count_not_found
|
80
|
+
@count_not_found ||= true
|
81
|
+
end
|
82
|
+
|
63
83
|
# Report coverage on diffed files, as well as overall coverage.
|
64
84
|
#
|
65
85
|
# @param [String] moduleName
|
@@ -109,51 +129,58 @@ module Danger
|
|
109
129
|
|
110
130
|
puts "Here are unreported files"
|
111
131
|
puts fileNamesNotInReport.to_s
|
132
|
+
|
112
133
|
puts "Here is the touched files coverage hash"
|
113
134
|
puts touchedFilesHash
|
114
135
|
|
115
|
-
output = "
|
136
|
+
output = "### 🎯 #{moduleName} Code Coverage: **`#{'%.2f' % coveragePercent}%`**\n\n"
|
116
137
|
|
117
138
|
if touchedFilesHash.empty?
|
118
|
-
output << "The new and
|
139
|
+
output << "The new and updated files are not part of this module coverage report 👀.\n"
|
119
140
|
else
|
120
|
-
output << "
|
141
|
+
output << "**Modified files:**\n\n"
|
121
142
|
output << "File | Coverage\n"
|
122
143
|
output << ":-----|:-----:\n"
|
123
144
|
end
|
124
145
|
|
125
|
-
#
|
146
|
+
# Go through each file:
|
126
147
|
touchedFilesHash.sort.each do |fileName, coveragePercent|
|
127
148
|
output << "`#{fileName}` | **`#{'%.2f' % coveragePercent}%`**\n"
|
128
149
|
|
129
|
-
#
|
130
|
-
if (coveragePercent
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
else
|
135
|
-
warn warningMessage
|
136
|
-
end
|
150
|
+
# Check file coverage
|
151
|
+
if (coveragePercent == 0)
|
152
|
+
advise("Oops! #{fileName} does not have any test coverage.")
|
153
|
+
elsif (coveragePercent < file_threshold)
|
154
|
+
advise("Oops! #{fileName} is under #{file_threshold}% coverage.")
|
137
155
|
end
|
138
156
|
end
|
139
157
|
|
140
|
-
|
141
|
-
|
142
|
-
|
158
|
+
if (count_not_found)
|
159
|
+
output << "\n\n"
|
160
|
+
output << "Number of files not found in coverage report: #{fileNamesNotInReport.size}."
|
161
|
+
end
|
143
162
|
|
144
|
-
|
163
|
+
if (link_repository)
|
164
|
+
output << "\n\n"
|
165
|
+
output << 'Code coverage by [danger-kover](https://github.com/JCarlosR/danger-kover).'
|
166
|
+
end
|
167
|
+
|
145
168
|
markdown output
|
146
169
|
|
147
|
-
#
|
148
|
-
if (coveragePercent < total_threshold)
|
149
|
-
|
150
|
-
|
151
|
-
if (fail_if_under_threshold)
|
152
|
-
fail totalCoverageWarning
|
153
|
-
else
|
154
|
-
warn totalCoverageWarning
|
155
|
-
end
|
170
|
+
# Check total coverage
|
171
|
+
if (coveragePercent < total_threshold)
|
172
|
+
advise("Oops! The module #{moduleName} codebase is under #{total_threshold}% coverage.")
|
156
173
|
end
|
157
174
|
end
|
175
|
+
|
176
|
+
# Warn or fail, depending on the `fail_if_under_threshold` flag.
|
177
|
+
private def advise(message)
|
178
|
+
if (fail_if_under_threshold)
|
179
|
+
fail message
|
180
|
+
else
|
181
|
+
warn message
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
158
185
|
end
|
159
186
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-kover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrewhaisting
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -184,6 +184,8 @@ files:
|
|
184
184
|
- Rakefile
|
185
185
|
- danger-kover-0.0.1.gem
|
186
186
|
- danger-kover-0.0.2.gem
|
187
|
+
- danger-kover-0.0.3.gem
|
188
|
+
- danger-kover-0.0.4.gem
|
187
189
|
- danger-kover.gemspec
|
188
190
|
- images/bannerImage.png
|
189
191
|
- lib/danger_plugin.rb
|