danger-kover 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d51a8761be717a19d11d215d58100fe5301539ba8c76f40383deddc1f150063b
4
- data.tar.gz: d952a4b6a25b113718d10a48d5d42bb59baeb4c66cd2b2fea3a07932e5849ccd
3
+ metadata.gz: 44a53eb966b795cb6793ffa0d4f2be671a55fc2dd445e35dc473cdcea3d96382
4
+ data.tar.gz: 5d775bf7df1da1425092d1af297dd021d34a3f29940c3e973de70731361fb67e
5
5
  SHA512:
6
- metadata.gz: 52392f721abee9a2cd898482c0707f810df876cb0c961975d43c19acd5d1bb0f75cda2aea53d48392334149dd4b0366196266180c6fba7e0736790284024ff96
7
- data.tar.gz: 5a2e8efc9eb2f9e549d4f781f972c25de34dc8955301da17b090ce432cc423ecddd6e28419cbd723ff5042eec40e6ceb7d4c8e2c7c5d96846f353ed0a3ac013b
6
+ metadata.gz: d5de9eeb0965194cbbeadd598e2207808d51290b27ecb9747e9da44d0b61a320e97f033a2bea72822913bd072a44130a03d12a99bd16e40273375e90bdfe6236
7
+ data.tar.gz: c26878612b9780b6f9046afa40bf2500a1d0067c82fcebbd3393eb83290bdbca225ed29ff0fbd8d6f702f93515fd7583f4e0c71433f5d551b925a42c0015d66c
data/README.md CHANGED
@@ -54,3 +54,17 @@ This is a fork, based on [Shroud](https://github.com/livefront/danger-shroud).
54
54
  3. Run `bundle exec rake spec` to run the tests.
55
55
  4. Use `bundle exec guard` to automatically have tests run as you make changes.
56
56
  5. Make your changes.
57
+
58
+ ## Publishing
59
+
60
+ How to build a gem (make sure to update the version):
61
+
62
+ ```
63
+ gem build danger-kover.gemspec
64
+ ```
65
+
66
+ How to publish a gem:
67
+
68
+ ```
69
+ gem push danger-kover-VERSION.gem
70
+ ```
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module Kover
2
- VERSION = "0.0.2".freeze
2
+ VERSION = "0.0.4".freeze
3
3
  end
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 = "## 🎯 #{moduleName} Code Coverage: **`#{'%.2f' % coveragePercent}%`**\n"
135
+ output = "### 🎯 #{moduleName} Code Coverage: **`#{'%.2f' % coveragePercent}%`**\n"
116
136
 
117
137
  if touchedFilesHash.empty?
118
- output << "The new and modified files are not part of the Kover coverage report 👀.\n"
138
+ output << "The new and updated files are not part of this module coverage report 👀.\n"
119
139
  else
120
- output << "### Coverage of Modified Files:\n"
140
+ output << "**Modified files:**\n"
121
141
  output << "File | Coverage\n"
122
142
  output << ":-----|:-----:\n"
123
143
  end
124
144
 
125
- # go through each file:
145
+ # Go through each file:
126
146
  touchedFilesHash.sort.each do |fileName, coveragePercent|
127
147
  output << "`#{fileName}` | **`#{'%.2f' % coveragePercent}%`**\n"
128
148
 
129
- # warn or fail if under specified file threshold:
130
- if (coveragePercent < file_threshold)
131
- warningMessage = "Uh oh! #{fileName} is under #{file_threshold}% coverage!"
132
- if (fail_if_under_threshold)
133
- fail warningMessage
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
- output << "\n"
141
- output << "Number of files not found in coverage report: #{fileNamesNotInReport.size}."
142
- output << "\n\n"
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
- output << 'Code coverage by [danger-kover](https://github.com/JCarlosR/danger-kover).'
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
- # warn or fail if total coverage is under specified threshold
148
- if (coveragePercent < total_threshold)
149
- totalCoverageWarning = "Oops! The project codebase is under #{total_threshold}% coverage."
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.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrewhaisting
@@ -183,6 +183,8 @@ files:
183
183
  - README.md
184
184
  - Rakefile
185
185
  - danger-kover-0.0.1.gem
186
+ - danger-kover-0.0.2.gem
187
+ - danger-kover-0.0.3.gem
186
188
  - danger-kover.gemspec
187
189
  - images/bannerImage.png
188
190
  - lib/danger_plugin.rb