undercover 0.4.1 → 0.4.5

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: 04fa40baf15828da2f2adfb2e339448b601b474ca88c32258154cdf5a1d7464c
4
- data.tar.gz: d591475e8a41e993a9fe813d7fc56e40d0072f6d40db1941f9224db2baf7f3f8
3
+ metadata.gz: be85578654ccaecd6bd01497e0dc13014734f7cdec764b3b0d44180e671d620f
4
+ data.tar.gz: 463b56ed9848158127f1cfed4e6afa2ff086d576bffe4ab35615d075921ea6f3
5
5
  SHA512:
6
- metadata.gz: 3f22a3d8e54f6ae67a59c08191b49127edb2c8f243dabcdb5e781422a82e40b00b0f0c2dc0a25a0ba3c74dafa32fa9d0c1db62121394b0ef2cbc32dcb3325864
7
- data.tar.gz: 8578f0ac0e9100ab75c43c089db838b52658aed5c53b06c34d2935fd75964f406ee35e2e87c567a0b3cbdfb4af601acafc1d70db1271ae64e3a9224a0974ac65
6
+ metadata.gz: 110f9f33c17eed386663609af89e3dab7a27e611a984d09c46a385986a103b8d219bd87c6044bc418674616a62a14f1ba3aa4ae057bd065131d2d288f8c069ed
7
+ data.tar.gz: 4d26813749d77e5bb880cd61b062326e9e7e114f80ec01b5d07c947a8a2794d3e2402efea30593276f45581fec5e8e986691a963173e24f3cbfbfaf667d96d52
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "04:00"
8
+ open-pull-requests-limit: 10
9
+ ignore:
10
+ - dependency-name: rubocop
11
+ versions:
12
+ - 1.10.0
13
+ - 1.12.0
14
+ - 1.12.1
15
+ - 1.8.1
16
+ - 1.9.0
@@ -5,11 +5,11 @@ jobs:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
7
  matrix:
8
- ruby: ['3.0.x', '2.7.x', '2.6.x', '2.5.x']
8
+ ruby: ['3.1', '3.0', '2.7', '2.6', '2.5']
9
9
  steps:
10
10
  - uses: actions/checkout@v1
11
11
  - name: Set up Ruby ${{ matrix.ruby }}
12
- uses: actions/setup-ruby@v1
12
+ uses: ruby/setup-ruby@v1
13
13
  with:
14
14
  ruby-version: ${{ matrix.ruby }}
15
15
  - name: Build and test with Rake
data/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ # [0.4.5] - 2022-07-28
10
+ ### Changed
11
+ - Update `rugged` dependency to `< 1.6`
12
+
13
+ # [0.4.4] - 2021-11-29
14
+ ### Changed
15
+ - Dependency updates
16
+
17
+ # [0.4.3] - 2021-03-16
18
+ ### Fixed
19
+ - Branch coverage without line coverage marked as uncovered - fix by @GCorbel
20
+
9
21
  # [0.4.1] - 2021-03-11
10
22
  ### Fixed
11
23
  - Fix zero-division edge case resulting in NaN from Result#coverage_f
@@ -99,7 +111,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
111
  ### Added
100
112
  - First release of `undercover` 🎉
101
113
 
102
- [Unreleased]: https://github.com/grodowski/undercover/compare/v0.3.4...HEAD
114
+ [Unreleased]: https://github.com/grodowski/undercover/compare/v0.4.4...HEAD
115
+ [0.4.5]: https://github.com/grodowski/undercover/compare/v0.4.4...v0.4.5
116
+ [0.4.4]: https://github.com/grodowski/undercover/compare/v0.4.3...v0.4.4
117
+ [0.4.3]: https://github.com/grodowski/undercover/compare/v0.4.1...v0.4.3
103
118
  [0.4.1]: https://github.com/grodowski/undercover/compare/v0.4.0...v0.4.1
104
119
  [0.4.0]: https://github.com/grodowski/undercover/compare/v0.3.4...v0.4.0
105
120
  [0.3.4]: https://github.com/grodowski/undercover/compare/v0.3.3...v0.3.4
data/README.md CHANGED
@@ -124,6 +124,22 @@ The options set in the file can be overriden by passing arguments when invoking
124
124
 
125
125
  Options assume that the program is run from the top level of the project directory.
126
126
 
127
+ ### Ignoring/skipping coverage
128
+
129
+ Projects with low or nonexistent test coverage are likely to generate large numbers of warnings. While the default workflow would be to address them before the PR approval, your strategy might be different.
130
+
131
+ In order to acknowledge an untested change and remove the UndercoverCI warning with the intention to improve later (or never), you can wrap the code block with the `:nocov:` syntax, e.g.
132
+
133
+ ```rb
134
+ # :nocov:
135
+ def skip_this_method
136
+ never_reached
137
+ end
138
+ # :nocov:
139
+ ```
140
+
141
+ Read more about the `:nocov:` syntax in [SimpleCov's readme](https://github.com/simplecov-ruby/simplecov#ignoringskipping-code).
142
+
127
143
  ## Why?
128
144
 
129
145
  I wanted to create a tool to help others and myself ensure that tests are written for all the recent code changes. This should be useful for any ruby project, but especially those large or legacy codebases that lack testing (and we can't or don't want to invest in full test coverage).
@@ -10,8 +10,8 @@ module Undercover
10
10
 
11
11
  WARNINGS_TO_S = {
12
12
  stale_coverage: Rainbow('🚨 WARNING: Coverage data is older than your ' \
13
- 'latest changes and results might be incomplete. ' \
14
- 'Re-run tests to update').yellow,
13
+ 'latest changes and results might be incomplete. ' \
14
+ 'Re-run tests to update').yellow,
15
15
  no_changes: Rainbow('✅ No reportable changes').green
16
16
  }.freeze
17
17
  def self.run(args)
@@ -18,20 +18,20 @@ module Undercover
18
18
  @results.map.with_index(1) do |res, idx|
19
19
  "🚨 #{idx}) node `#{res.node.name}` type: #{res.node.human_name},\n" +
20
20
  (' ' * pad_size) + "loc: #{res.file_path_with_lines}," \
21
- " coverage: #{res.coverage_f * 100}%\n" +
21
+ " coverage: #{res.coverage_f * 100}%\n" +
22
22
  res.pretty_print
23
23
  end
24
24
  end
25
25
 
26
26
  def success
27
27
  "#{Rainbow('undercover').bold.green}: ✅ No coverage" \
28
- ' is missing in latest changes'
28
+ ' is missing in latest changes'
29
29
  end
30
30
 
31
31
  def warnings_header
32
32
  "#{Rainbow('undercover').bold.red}: " \
33
- '👮‍♂️ some methods have no test coverage! Please add specs for' \
34
- ' methods listed below'
33
+ '👮‍♂️ some methods have no test coverage! Please add specs for' \
34
+ ' methods listed below'
35
35
  end
36
36
 
37
37
  def pad_size
@@ -27,14 +27,18 @@ module Undercover
27
27
  @flagged
28
28
  end
29
29
 
30
+ # rubocop:disable Metrics/CyclomaticComplexity
30
31
  def uncovered?(line_no)
32
+ # check branch coverage for line_no
31
33
  coverage.each do |ln, _block, _branch, cov|
32
34
  return true if ln == line_no && cov && cov.zero?
33
35
  end
34
36
 
35
- line_cov = coverage.find { |ln, _cov| ln == line_no }
37
+ # check line coverage for line_no
38
+ line_cov = coverage.select { |cov| cov.size == 2 }.find { |ln, _cov| ln == line_no }
36
39
  line_cov && line_cov[1].zero?
37
40
  end
41
+ # rubocop:enable Metrics/CyclomaticComplexity
38
42
 
39
43
  # Method `coverage_f` returns the total coverage of this Undercover::Result
40
44
  # as a % value, taking into account missing branches. Line coverage will be counted
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Undercover
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.5'
5
5
  end
data/undercover.gemspec CHANGED
@@ -15,8 +15,11 @@ Gem::Specification.new do |spec|
15
15
  ' code blocks in recent changes'
16
16
  spec.homepage = 'https://github.com/grodowski/undercover'
17
17
  spec.license = 'MIT'
18
+ spec.metadata = {
19
+ 'rubygems_mfa_required' => 'true'
20
+ }
18
21
 
19
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
23
  f.match(/^(test|spec|features)\//)
21
24
  end
22
25
  spec.bindir = 'bin'
@@ -27,13 +30,13 @@ Gem::Specification.new do |spec|
27
30
 
28
31
  spec.add_dependency 'imagen', '>= 0.1.8'
29
32
  spec.add_dependency 'rainbow', '>= 2.1', '< 4.0'
30
- spec.add_dependency 'rugged', '>= 0.27', '< 1.2'
33
+ spec.add_dependency 'rugged', '>= 0.27', '< 1.6'
31
34
 
32
35
  spec.add_development_dependency 'bundler'
33
36
  spec.add_development_dependency 'pry'
34
37
  spec.add_development_dependency 'rake', '~> 13.0'
35
38
  spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'rubocop', '~> 1.11.0'
39
+ spec.add_development_dependency 'rubocop', '~> 1.28.2'
37
40
  spec.add_development_dependency 'simplecov'
38
41
  spec.add_development_dependency 'simplecov-html'
39
42
  spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undercover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Grodowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2022-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: imagen
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '0.27'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.2'
56
+ version: '1.6'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: '0.27'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.2'
66
+ version: '1.6'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -126,14 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 1.11.0
129
+ version: 1.28.2
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 1.11.0
136
+ version: 1.28.2
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: simplecov
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ dependencies:
190
190
  - - ">="
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
- description:
193
+ description:
194
194
  email:
195
195
  - jgrodowski@gmail.com
196
196
  executables:
@@ -199,6 +199,7 @@ extensions: []
199
199
  extra_rdoc_files: []
200
200
  files:
201
201
  - ".codebeatsettings"
202
+ - ".github/dependabot.yml"
202
203
  - ".github/workflows/ruby.yml"
203
204
  - ".gitignore"
204
205
  - ".overcommit.yml"
@@ -229,8 +230,9 @@ files:
229
230
  homepage: https://github.com/grodowski/undercover
230
231
  licenses:
231
232
  - MIT
232
- metadata: {}
233
- post_install_message:
233
+ metadata:
234
+ rubygems_mfa_required: 'true'
235
+ post_install_message:
234
236
  rdoc_options: []
235
237
  require_paths:
236
238
  - lib
@@ -245,8 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
247
  - !ruby/object:Gem::Version
246
248
  version: '0'
247
249
  requirements: []
248
- rubygems_version: 3.2.3
249
- signing_key:
250
+ rubygems_version: 3.2.32
251
+ signing_key:
250
252
  specification_version: 4
251
253
  summary: Actionable code coverage - detects untested code blocks in recent changes
252
254
  test_files: []