danger-kover 0.0.3 → 0.0.4
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/lib/kover/gem_version.rb +1 -1
- data/lib/kover/plugin.rb +51 -25
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44a53eb966b795cb6793ffa0d4f2be671a55fc2dd445e35dc473cdcea3d96382
|
4
|
+
data.tar.gz: 5d775bf7df1da1425092d1af297dd021d34a3f29940c3e973de70731361fb67e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5de9eeb0965194cbbeadd598e2207808d51290b27ecb9747e9da44d0b61a320e97f033a2bea72822913bd072a44130a03d12a99bd16e40273375e90bdfe6236
|
7
|
+
data.tar.gz: c26878612b9780b6f9046afa40bf2500a1d0067c82fcebbd3393eb83290bdbca225ed29ff0fbd8d6f702f93515fd7583f4e0c71433f5d551b925a42c0015d66c
|
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
|
@@ -112,48 +132,54 @@ module Danger
|
|
112
132
|
puts "Here is the touched files coverage hash"
|
113
133
|
puts touchedFilesHash
|
114
134
|
|
115
|
-
output = "
|
135
|
+
output = "### 🎯 #{moduleName} Code Coverage: **`#{'%.2f' % coveragePercent}%`**\n"
|
116
136
|
|
117
137
|
if touchedFilesHash.empty?
|
118
|
-
output << "The new and
|
138
|
+
output << "The new and updated files are not part of this module coverage report 👀.\n"
|
119
139
|
else
|
120
|
-
output << "
|
140
|
+
output << "**Modified files:**\n"
|
121
141
|
output << "File | Coverage\n"
|
122
142
|
output << ":-----|:-----:\n"
|
123
143
|
end
|
124
144
|
|
125
|
-
#
|
145
|
+
# Go through each file:
|
126
146
|
touchedFilesHash.sort.each do |fileName, coveragePercent|
|
127
147
|
output << "`#{fileName}` | **`#{'%.2f' % coveragePercent}%`**\n"
|
128
148
|
|
129
|
-
#
|
130
|
-
if (coveragePercent
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
else
|
135
|
-
warn warningMessage
|
136
|
-
end
|
149
|
+
# Check file coverage
|
150
|
+
if (coveragePercent == 0)
|
151
|
+
advise("Oops! #{fileName} does not have any test coverage.")
|
152
|
+
elsif (coveragePercent < file_threshold)
|
153
|
+
advise("Oops! #{fileName} is under #{file_threshold}% coverage.")
|
137
154
|
end
|
138
155
|
end
|
139
156
|
|
140
|
-
|
141
|
-
|
142
|
-
|
157
|
+
if (count_not_found)
|
158
|
+
output << "\n\n"
|
159
|
+
output << "Number of files not found in coverage report: #{fileNamesNotInReport.size}."
|
160
|
+
end
|
143
161
|
|
144
|
-
|
162
|
+
if (link_repository)
|
163
|
+
output << "\n\n"
|
164
|
+
output << 'Code coverage by [danger-kover](https://github.com/JCarlosR/danger-kover).'
|
165
|
+
end
|
166
|
+
|
145
167
|
markdown output
|
146
168
|
|
147
|
-
#
|
148
|
-
if (coveragePercent < total_threshold)
|
149
|
-
|
150
|
-
|
151
|
-
if (fail_if_under_threshold)
|
152
|
-
fail totalCoverageWarning
|
153
|
-
else
|
154
|
-
warn totalCoverageWarning
|
155
|
-
end
|
169
|
+
# Check total coverage
|
170
|
+
if (coveragePercent < total_threshold)
|
171
|
+
advise("Oops! The module #{moduleName} codebase is under #{total_threshold}% coverage.")
|
156
172
|
end
|
157
173
|
end
|
174
|
+
|
175
|
+
# Warn or fail, depending on the `fail_if_under_threshold` flag.
|
176
|
+
private def advise(message)
|
177
|
+
if (fail_if_under_threshold)
|
178
|
+
fail message
|
179
|
+
else
|
180
|
+
warn message
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
158
184
|
end
|
159
185
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrewhaisting
|
@@ -184,6 +184,7 @@ 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
|
187
188
|
- danger-kover.gemspec
|
188
189
|
- images/bannerImage.png
|
189
190
|
- lib/danger_plugin.rb
|