undercover 0.4.7 → 0.5.0
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 +2 -3
- data/.rubocop.yml +2 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +8 -2
- data/Gemfile +11 -0
- data/lib/undercover/changeset.rb +2 -2
- data/lib/undercover/formatter.rb +6 -6
- data/lib/undercover/result.rb +5 -5
- data/lib/undercover/version.rb +1 -1
- data/undercover.gemspec +5 -16
- metadata +20 -131
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2a988ce8b2ef9451615675538b268f4d663cb141288a646b2604785ea92dc6
|
4
|
+
data.tar.gz: 6822d32d0b2000e711194c0d595b2f69dcaa3020740db9613be8f6fceea1e4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ada6a585eee4ff30f9a520dde96f0b3b74bd11ab05a9e7857b356da7c00519e81d36dda12ddd4c7afde81b23cb73bc1c88a35f2f559f1cf9a638c42eab48052
|
7
|
+
data.tar.gz: 6c846695987c6126e7db5c7c363e44756f57aaf34374157bd35c0e723469f705a625244e90818a39b07e5626df8b34f248796405f95a5c9ed884e4760af304f3
|
data/.github/workflows/ruby.yml
CHANGED
@@ -5,7 +5,7 @@ jobs:
|
|
5
5
|
runs-on: ubuntu-latest
|
6
6
|
strategy:
|
7
7
|
matrix:
|
8
|
-
ruby: ['3.
|
8
|
+
ruby: ['3.3', '3.0']
|
9
9
|
steps:
|
10
10
|
- uses: actions/checkout@v3
|
11
11
|
with:
|
@@ -16,8 +16,7 @@ jobs:
|
|
16
16
|
ruby-version: ${{ matrix.ruby }}
|
17
17
|
- name: Build and test with Rake
|
18
18
|
run: |
|
19
|
-
gem install bundler -
|
20
|
-
gem install undercover --no-doc
|
19
|
+
gem install bundler undercover --no-doc
|
21
20
|
bundle install --jobs 4 --retry 3
|
22
21
|
bundle exec rake
|
23
22
|
- name: undercover (local)
|
data/.rubocop.yml
CHANGED
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.3.0
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
# [0.
|
9
|
+
# [0.5.0] - 2024-01-09
|
10
|
+
### Changed
|
11
|
+
- Drop ruby 2.x support, require ruby 3.x in gemspec
|
12
|
+
- Dev dependency updates
|
13
|
+
|
14
|
+
# [0.4.7] - 2024-01-08
|
10
15
|
### Fixed
|
11
16
|
- [Update of one-line block is ignored](https://github.com/grodowski/undercover/pull/207) by [@lizhangyuh](https://github.com/lizhangyuh)
|
12
17
|
|
@@ -123,7 +128,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
123
128
|
### Added
|
124
129
|
- First release of `undercover` 🎉
|
125
130
|
|
126
|
-
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.
|
131
|
+
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.5.0...HEAD
|
132
|
+
[0.5.0]: https://github.com/grodowski/undercover/compare/v0.4.7...v0.5.0
|
127
133
|
[0.4.7]: https://github.com/grodowski/undercover/compare/v0.4.6...v0.4.7
|
128
134
|
[0.4.6]: https://github.com/grodowski/undercover/compare/v0.4.5...v0.4.6
|
129
135
|
[0.4.5]: https://github.com/grodowski/undercover/compare/v0.4.4...v0.4.5
|
data/Gemfile
CHANGED
data/lib/undercover/changeset.rb
CHANGED
@@ -56,10 +56,10 @@ module Undercover
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# TODO: refactor to a standalone validator (depending on changeset AND lcov)
|
59
|
-
# TODO: add specs
|
60
59
|
def validate(lcov_report_path)
|
61
60
|
return :no_changes if files.empty?
|
62
|
-
|
61
|
+
|
62
|
+
:stale_coverage if last_modified > File.mtime(lcov_report_path)
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
data/lib/undercover/formatter.rb
CHANGED
@@ -17,21 +17,21 @@ module Undercover
|
|
17
17
|
def formatted_warnings
|
18
18
|
@results.map.with_index(1) do |res, idx|
|
19
19
|
"🚨 #{idx}) node `#{res.node.name}` type: #{res.node.human_name},\n" +
|
20
|
-
(' ' * pad_size) + "loc: #{res.file_path_with_lines}," \
|
21
|
-
"
|
20
|
+
(' ' * pad_size) + "loc: #{res.file_path_with_lines}, " \
|
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
|
-
"#{Rainbow('undercover').bold.green}: ✅ No coverage" \
|
28
|
-
'
|
27
|
+
"#{Rainbow('undercover').bold.green}: ✅ No coverage " \
|
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
|
-
'
|
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
|
data/lib/undercover/result.rb
CHANGED
@@ -54,7 +54,7 @@ module Undercover
|
|
54
54
|
lines[ln] = 0
|
55
55
|
end
|
56
56
|
end
|
57
|
-
return 1.0 if lines.keys.
|
57
|
+
return 1.0 if lines.keys.empty?
|
58
58
|
|
59
59
|
(lines.values.sum.to_f / lines.keys.size).round(4)
|
60
60
|
end
|
@@ -84,7 +84,7 @@ module Undercover
|
|
84
84
|
pad = node.last_line.to_s.length
|
85
85
|
pretty_print_lines.map do |covered, (num, line)|
|
86
86
|
formatted_line = "#{num.to_s.rjust(pad)}: #{line}"
|
87
|
-
if line.strip.
|
87
|
+
if line.strip.empty?
|
88
88
|
Rainbow(formatted_line).darkgray.dark
|
89
89
|
elsif covered.nil?
|
90
90
|
Rainbow(formatted_line).darkgray.dark + \
|
@@ -107,8 +107,8 @@ module Undercover
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def inspect
|
110
|
-
"#<Undercover::Report::Result:#{object_id}" \
|
111
|
-
"
|
110
|
+
"#<Undercover::Report::Result:#{object_id} " \
|
111
|
+
"name: #{node.name}, coverage: #{coverage_f}>"
|
112
112
|
end
|
113
113
|
alias to_s inspect
|
114
114
|
|
@@ -119,7 +119,7 @@ module Undercover
|
|
119
119
|
branches = coverage.select { |cov| cov.size == 4 && cov[0] == line_number }
|
120
120
|
count_covered = branches.count { |cov| cov[3].positive? }
|
121
121
|
|
122
|
-
return '' if branches.
|
122
|
+
return '' if branches.empty?
|
123
123
|
|
124
124
|
if count_covered < branches.size
|
125
125
|
Rainbow(' branches: ').italic.darkgray.dark + \
|
data/lib/undercover/version.rb
CHANGED
data/undercover.gemspec
CHANGED
@@ -4,15 +4,14 @@ lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'undercover/version'
|
6
6
|
|
7
|
-
# rubocop:disable Metrics/BlockLength
|
8
7
|
Gem::Specification.new do |spec|
|
9
8
|
spec.name = 'undercover'
|
10
9
|
spec.version = Undercover::VERSION
|
11
10
|
spec.authors = ['Jan Grodowski']
|
12
11
|
spec.email = ['jgrodowski@gmail.com']
|
13
12
|
|
14
|
-
spec.summary = 'Actionable code coverage - detects untested' \
|
15
|
-
'
|
13
|
+
spec.summary = 'Actionable code coverage - detects untested ' \
|
14
|
+
'code blocks in recent changes'
|
16
15
|
spec.homepage = 'https://github.com/grodowski/undercover'
|
17
16
|
spec.license = 'MIT'
|
18
17
|
spec.metadata = {
|
@@ -26,20 +25,10 @@ Gem::Specification.new do |spec|
|
|
26
25
|
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
27
26
|
spec.require_paths = ['lib']
|
28
27
|
|
29
|
-
spec.required_ruby_version = '>=
|
28
|
+
spec.required_ruby_version = '>= 3.0.0'
|
30
29
|
|
30
|
+
spec.add_dependency 'bigdecimal'
|
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.
|
34
|
-
|
35
|
-
spec.add_development_dependency 'bundler'
|
36
|
-
spec.add_development_dependency 'pry'
|
37
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
38
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
|
-
spec.add_development_dependency 'rubocop', '~> 1.28.2'
|
40
|
-
spec.add_development_dependency 'simplecov'
|
41
|
-
spec.add_development_dependency 'simplecov-html'
|
42
|
-
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
|
43
|
-
spec.add_development_dependency 'timecop'
|
33
|
+
spec.add_dependency 'rugged', '>= 0.27', '< 1.8'
|
44
34
|
end
|
45
|
-
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: undercover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Grodowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: imagen
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +67,7 @@ dependencies:
|
|
53
67
|
version: '0.27'
|
54
68
|
- - "<"
|
55
69
|
- !ruby/object:Gem::Version
|
56
|
-
version: '1.
|
70
|
+
version: '1.8'
|
57
71
|
type: :runtime
|
58
72
|
prerelease: false
|
59
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,133 +77,7 @@ dependencies:
|
|
63
77
|
version: '0.27'
|
64
78
|
- - "<"
|
65
79
|
- !ruby/object:Gem::Version
|
66
|
-
version: '1.
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: bundler
|
69
|
-
requirement: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: '0'
|
74
|
-
type: :development
|
75
|
-
prerelease: false
|
76
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '0'
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: pry
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - ">="
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '0'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: rake
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '13.0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '13.0'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: rspec
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - "~>"
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: '3.0'
|
116
|
-
type: :development
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - "~>"
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '3.0'
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
name: rubocop
|
125
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: 1.28.2
|
130
|
-
type: :development
|
131
|
-
prerelease: false
|
132
|
-
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - "~>"
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: 1.28.2
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: simplecov
|
139
|
-
requirement: !ruby/object:Gem::Requirement
|
140
|
-
requirements:
|
141
|
-
- - ">="
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '0'
|
144
|
-
type: :development
|
145
|
-
prerelease: false
|
146
|
-
version_requirements: !ruby/object:Gem::Requirement
|
147
|
-
requirements:
|
148
|
-
- - ">="
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: '0'
|
151
|
-
- !ruby/object:Gem::Dependency
|
152
|
-
name: simplecov-html
|
153
|
-
requirement: !ruby/object:Gem::Requirement
|
154
|
-
requirements:
|
155
|
-
- - ">="
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
type: :development
|
159
|
-
prerelease: false
|
160
|
-
version_requirements: !ruby/object:Gem::Requirement
|
161
|
-
requirements:
|
162
|
-
- - ">="
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version: '0'
|
165
|
-
- !ruby/object:Gem::Dependency
|
166
|
-
name: simplecov-lcov
|
167
|
-
requirement: !ruby/object:Gem::Requirement
|
168
|
-
requirements:
|
169
|
-
- - "~>"
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: '0.8'
|
172
|
-
type: :development
|
173
|
-
prerelease: false
|
174
|
-
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
requirements:
|
176
|
-
- - "~>"
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: '0.8'
|
179
|
-
- !ruby/object:Gem::Dependency
|
180
|
-
name: timecop
|
181
|
-
requirement: !ruby/object:Gem::Requirement
|
182
|
-
requirements:
|
183
|
-
- - ">="
|
184
|
-
- !ruby/object:Gem::Version
|
185
|
-
version: '0'
|
186
|
-
type: :development
|
187
|
-
prerelease: false
|
188
|
-
version_requirements: !ruby/object:Gem::Requirement
|
189
|
-
requirements:
|
190
|
-
- - ">="
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
version: '0'
|
80
|
+
version: '1.8'
|
193
81
|
description:
|
194
82
|
email:
|
195
83
|
- jgrodowski@gmail.com
|
@@ -205,6 +93,7 @@ files:
|
|
205
93
|
- ".overcommit.yml"
|
206
94
|
- ".rspec"
|
207
95
|
- ".rubocop.yml"
|
96
|
+
- ".tool-versions"
|
208
97
|
- CHANGELOG.md
|
209
98
|
- Gemfile
|
210
99
|
- LICENSE.txt
|
@@ -240,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
129
|
requirements:
|
241
130
|
- - ">="
|
242
131
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
132
|
+
version: 3.0.0
|
244
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
134
|
requirements:
|
246
135
|
- - ">="
|