undercover 0.4.5 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +26 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +15 -1
- data/README.md +10 -6
- data/lib/undercover/lcov_parser.rb +18 -0
- data/lib/undercover/result.rb +1 -1
- data/lib/undercover/version.rb +1 -1
- data/undercover.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208a99638c9f105ea5a9abde3de88efc756e4ca9f739246488b55a80a7118276
|
4
|
+
data.tar.gz: c1a5926972f1404a0adbf570ef7b28678fb48ecbabe29f8b65469b09a2b4a25c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69937cd20c436a78a403ba4b12eb52d727120771060de928617b81bcfa8c8010c2ef3af64ea0b986d9655b32934e70e33c9482b5d8b68b2149462c3933e143f7
|
7
|
+
data.tar.gz: 9fe21bbb6cf9af2b45f51033eedb1fe75d744b6611c677c65c4052373251166ce54b870dc53f94b8b564aa7839963e3b038be3f36181a7a78c034583f209e9e8
|
data/.github/workflows/ruby.yml
CHANGED
@@ -5,17 +5,39 @@ jobs:
|
|
5
5
|
runs-on: ubuntu-latest
|
6
6
|
strategy:
|
7
7
|
matrix:
|
8
|
-
ruby: ['3.
|
8
|
+
ruby: ['3.2', '3.0', '2.7']
|
9
9
|
steps:
|
10
|
-
- uses: actions/checkout@
|
10
|
+
- uses: actions/checkout@v3
|
11
|
+
with:
|
12
|
+
fetch-depth: 0 # fetch all since test fixtures depend on history
|
11
13
|
- name: Set up Ruby ${{ matrix.ruby }}
|
12
14
|
uses: ruby/setup-ruby@v1
|
13
15
|
with:
|
14
16
|
ruby-version: ${{ matrix.ruby }}
|
15
17
|
- name: Build and test with Rake
|
16
18
|
run: |
|
17
|
-
gem install bundler
|
19
|
+
gem install bundler -v 2.4.22
|
20
|
+
gem install undercover --no-doc
|
18
21
|
bundle install --jobs 4 --retry 3
|
19
22
|
bundle exec rake
|
20
|
-
|
23
|
+
- name: undercover (local)
|
24
|
+
run: |
|
25
|
+
git fetch --update-head-ok origin master:master
|
21
26
|
undercover --compare master
|
27
|
+
- uses: actions/upload-artifact@v3
|
28
|
+
with:
|
29
|
+
name: undercover.lcov
|
30
|
+
path: coverage/lcov/undercover.lcov
|
31
|
+
coverage:
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
needs: build
|
34
|
+
steps:
|
35
|
+
- uses: actions/download-artifact@v3
|
36
|
+
with:
|
37
|
+
name: undercover.lcov
|
38
|
+
- name: Upload coverage
|
39
|
+
run: |
|
40
|
+
ruby -e "$(curl -s https://undercover-ci.com/uploader.rb)" -- \
|
41
|
+
--repo grodowski/undercover \
|
42
|
+
--commit $GITHUB_SHA \
|
43
|
+
--lcov /home/runner/work/undercover/undercover/undercover.lcov
|
data/.rubocop.yml
CHANGED
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.7] - 2022-07-28
|
10
|
+
### Fixed
|
11
|
+
- [Update of one-line block is ignored](https://github.com/grodowski/undercover/pull/207) by [@lizhangyuh](https://github.com/lizhangyuh)
|
12
|
+
|
13
|
+
# [0.4.6] - 2023-04-21
|
14
|
+
### Added
|
15
|
+
- #total_coverage and #total_branch_coverage in the LcovParser
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- Drop support for ruby < 2.7
|
19
|
+
- Test coverage with both local `undercover` and Undercover GitHub App for demo purposes
|
20
|
+
|
9
21
|
# [0.4.5] - 2022-07-28
|
10
22
|
### Changed
|
11
23
|
- Update `rugged` dependency to `< 1.6`
|
@@ -111,7 +123,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
111
123
|
### Added
|
112
124
|
- First release of `undercover` 🎉
|
113
125
|
|
114
|
-
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.4.
|
126
|
+
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.4.7...HEAD
|
127
|
+
[0.4.7]: https://github.com/grodowski/undercover/compare/v0.4.6...v0.4.7
|
128
|
+
[0.4.6]: https://github.com/grodowski/undercover/compare/v0.4.5...v0.4.6
|
115
129
|
[0.4.5]: https://github.com/grodowski/undercover/compare/v0.4.4...v0.4.5
|
116
130
|
[0.4.4]: https://github.com/grodowski/undercover/compare/v0.4.3...v0.4.4
|
117
131
|
[0.4.3]: https://github.com/grodowski/undercover/compare/v0.4.1...v0.4.3
|
data/README.md
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
-
|
1
|
+
![logo](https://github.com/grodowski/undercover/assets/4991698/c4bf038b-4472-4406-8f1f-5ddc812908d6)
|
2
2
|
|
3
|
-
|
3
|
+
`undercover` warns about methods, classes and blocks that **were changed without tests**, to help you easily find untested code and reduce the number of bugs. It does so by analysing data from git diffs, code structure and SimpleCov coverage reports.
|
4
4
|
|
5
|
-
|
5
|
+
Works with any Ruby CI pipeline as well as locally as a CLI.
|
6
|
+
|
7
|
+
- Visit **[https://undercover-ci.com](https://undercover-ci.com)** to set up code review checks with the GitHub App, or use one of the [CI integrations](#code-review-integrations)
|
6
8
|
- Learn how to find untested code changes locally with the [CLI](#usage)
|
7
9
|
|
10
|
+
|
11
|
+
[![Build Status](https://github.com/grodowski/undercover/actions/workflows/ruby.yml/badge.svg)](https://github.com/grodowski/undercover/actions)
|
12
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/b403feed68a18c072ec5/maintainability)](https://codeclimate.com/github/grodowski/undercover/maintainability)
|
13
|
+
![Downloads](https://img.shields.io/gem/dt/undercover)
|
14
|
+
|
8
15
|
A sample output of `undercover` ran before a commit may look like this:
|
9
16
|
|
10
17
|
![screenshot warning](docs/screenshot_warnings.png)
|
@@ -13,9 +20,6 @@ And like this, given that specs were added:
|
|
13
20
|
|
14
21
|
![screenshot success](docs/screenshot_success.png)
|
15
22
|
|
16
|
-
[![Build Status](https://action-badges.now.sh/grodowski/undercover)](https://github.com/grodowski/undercover/actions)
|
17
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/b403feed68a18c072ec5/maintainability)](https://codeclimate.com/github/grodowski/undercover/maintainability)
|
18
|
-
|
19
23
|
## Installation
|
20
24
|
|
21
25
|
Add this line to your application's Gemfile:
|
@@ -29,6 +29,24 @@ module Undercover
|
|
29
29
|
coverage || []
|
30
30
|
end
|
31
31
|
|
32
|
+
def total_coverage
|
33
|
+
all_lines = source_files.values.flatten(1)
|
34
|
+
return 0 if all_lines.empty?
|
35
|
+
|
36
|
+
all_lines = all_lines.select { _1.size == 2 }
|
37
|
+
total_f = all_lines.select { |_line_no, hits| hits.positive? }.size.to_f / all_lines.size
|
38
|
+
total_f.round(3)
|
39
|
+
end
|
40
|
+
|
41
|
+
def total_branch_coverage
|
42
|
+
all_lines = source_files.values.flatten(1)
|
43
|
+
return 0 if all_lines.empty?
|
44
|
+
|
45
|
+
all_branches = all_lines.select { _1.size == 4 }
|
46
|
+
total_f = all_branches.select { |_l_no, _block_no, _br_no, hits| hits.positive? }.size.to_f / all_branches.size
|
47
|
+
total_f.round(3)
|
48
|
+
end
|
49
|
+
|
32
50
|
private
|
33
51
|
|
34
52
|
# rubocop:disable Metrics/MethodLength, Style/SpecialGlobalVars, Metrics/AbcSize
|
data/lib/undercover/result.rb
CHANGED
@@ -13,7 +13,7 @@ module Undercover
|
|
13
13
|
def initialize(node, file_cov, file_path)
|
14
14
|
@node = node
|
15
15
|
@coverage = file_cov.select do |ln, _|
|
16
|
-
ln > first_line && ln < last_line
|
16
|
+
first_line == last_line ? ln == first_line : ln > first_line && ln < last_line
|
17
17
|
end
|
18
18
|
@file_path = file_path
|
19
19
|
@flagged = false
|
data/lib/undercover/version.rb
CHANGED
data/undercover.gemspec
CHANGED
@@ -26,11 +26,11 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
|
-
spec.required_ruby_version = '>= 2.
|
29
|
+
spec.required_ruby_version = '>= 2.7.0'
|
30
30
|
|
31
31
|
spec.add_dependency 'imagen', '>= 0.1.8'
|
32
32
|
spec.add_dependency 'rainbow', '>= 2.1', '< 4.0'
|
33
|
-
spec.add_dependency 'rugged', '>= 0.27', '< 1.
|
33
|
+
spec.add_dependency 'rugged', '>= 0.27', '< 1.7'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'bundler'
|
36
36
|
spec.add_development_dependency 'pry'
|
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.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Grodowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-08 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.
|
56
|
+
version: '1.7'
|
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.
|
66
|
+
version: '1.7'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: bundler
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,14 +240,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: 2.
|
243
|
+
version: 2.7.0
|
244
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
245
|
requirements:
|
246
246
|
- - ">="
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
|
-
rubygems_version: 3.
|
250
|
+
rubygems_version: 3.5.4
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: Actionable code coverage - detects untested code blocks in recent changes
|