undercover 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +10 -1
- data/README.md +0 -2
- data/lib/undercover/cli.rb +21 -1
- data/lib/undercover/options.rb +17 -3
- data/lib/undercover/result.rb +1 -1
- data/lib/undercover/simplecov_result_adapter.rb +2 -0
- data/lib/undercover/version.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b415f8a7947dbd35f4e15bb97a14f54c5384a89a2362d5bd26767ea233505ad6
|
4
|
+
data.tar.gz: b196b2c82dec2a3914d8ba6255b488b7dcd5c26ccf82a9672ff63c61ee4dbcca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9641af92eec955168c06ee73fcba81525a443e7eabdc44304dc6b17e25d98f469461ddc80db4c325d469ef45a4ce3387954863161dff4faa7963b0c3f8da40c
|
7
|
+
data.tar.gz: fe32c17ed7508581e96dc908eb50579e692f95f1956cd68d72c2c20a961047f12eccaafabae9892a9f1506dd5847218e90d15971696d2e3d9879c104fc105dd7
|
data/.github/workflows/ruby.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
ruby 3.4.2
|
2
|
-
nodejs
|
2
|
+
nodejs v24.4.0
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
# [0.7.3] - 2025-07-13
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Improve Options#parse with glob braces support, strip quotes properly from .undercover config files
|
13
|
+
- Fix Result#coverage_f to support ignored branches
|
14
|
+
- Fix error parsing JSON coverage with branch coverage disabled ([#231](https://github.com/grodowski/undercover/issues/231))
|
15
|
+
- Fixed NoMethodError and Errno::ENOENT that were occurring when coverage report doesn't exist ([#232](https://github.com/grodowski/undercover/issues/232))
|
16
|
+
|
9
17
|
# [0.7.2] - 2025-07-07
|
10
18
|
|
11
19
|
### Fixed
|
@@ -172,7 +180,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
172
180
|
### Added
|
173
181
|
- First release of `undercover` 🎉
|
174
182
|
|
175
|
-
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.7.
|
183
|
+
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.7.3...HEAD
|
184
|
+
[0.7.3]: https://github.com/grodowski/undercover/compare/v0.7.2...v0.7.3
|
176
185
|
[0.7.2]: https://github.com/grodowski/undercover/compare/v0.7.1...v0.7.2
|
177
186
|
[0.7.1]: https://github.com/grodowski/undercover/compare/v0.7.0...v0.7.1
|
178
187
|
[0.7.0]: https://github.com/grodowski/undercover/compare/v0.6.6...v0.7.0
|
data/README.md
CHANGED
data/lib/undercover/cli.rb
CHANGED
@@ -22,9 +22,29 @@ module Undercover
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.run_report(opts)
|
25
|
+
coverage_path = opts.simplecov_resultset || opts.lcov
|
26
|
+
return handle_missing_coverage_path(opts) if coverage_path.nil?
|
27
|
+
return handle_missing_file(coverage_path) unless File.exist?(coverage_path)
|
28
|
+
|
25
29
|
report = Undercover::Report.new(changeset(opts), opts).build
|
30
|
+
handle_report_validation(report, coverage_path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.handle_missing_coverage_path(opts)
|
34
|
+
puts Rainbow('❌ ERROR: No coverage report found. Checked default paths:').red
|
35
|
+
puts Rainbow(' - ./coverage/coverage.json (SimpleCov)').red
|
36
|
+
puts Rainbow(" - ./coverage/lcov/#{Pathname.new(File.expand_path(opts.path)).split.last}.lcov (LCOV)").red
|
37
|
+
puts Rainbow('Set a custom path with --lcov or --simplecov option').red
|
38
|
+
1
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.handle_missing_file(coverage_path)
|
42
|
+
puts Rainbow("❌ ERROR: Coverage report not found at: #{coverage_path}").red
|
43
|
+
1
|
44
|
+
end
|
26
45
|
|
27
|
-
|
46
|
+
def self.handle_report_validation(report, coverage_path)
|
47
|
+
error = report.validate(coverage_path)
|
28
48
|
if error
|
29
49
|
puts(WARNINGS_TO_S[error])
|
30
50
|
return 0 if error == :no_changes
|
data/lib/undercover/options.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'pathname'
|
5
|
+
require 'shellwords'
|
5
6
|
|
6
7
|
module Undercover
|
7
8
|
class Options # rubocop:disable Metrics/ClassLength
|
@@ -104,13 +105,26 @@ module Undercover
|
|
104
105
|
def args_from_options_file(path)
|
105
106
|
return [] unless File.exist?(path)
|
106
107
|
|
107
|
-
File.read(path).split(
|
108
|
+
File.read(path).split("\n").flat_map { parse_line(_1) }
|
108
109
|
end
|
109
110
|
|
110
111
|
def project_options_file
|
111
112
|
'./.undercover'
|
112
113
|
end
|
113
114
|
|
115
|
+
def parse_line(line)
|
116
|
+
line = line.strip
|
117
|
+
return [] if line.empty? || line.start_with?('#')
|
118
|
+
|
119
|
+
Shellwords.split(line)
|
120
|
+
end
|
121
|
+
|
122
|
+
def split_comma_separated_with_braces(input)
|
123
|
+
return [] if input.empty?
|
124
|
+
|
125
|
+
input.split(/,(?![^{]*})/).map(&:strip) # split on commas that are not inside braces
|
126
|
+
end
|
127
|
+
|
114
128
|
def lcov_path_option(parser)
|
115
129
|
parser.on('-l', '--lcov path', 'LCOV report file path') do |path|
|
116
130
|
self.lcov = path
|
@@ -175,12 +189,12 @@ module Undercover
|
|
175
189
|
desc = 'Include files matching specified glob patterns (comma separated). ' \
|
176
190
|
"Defaults to '#{DEFAULT_FILE_INCLUDE_GLOBS.join(',')}'"
|
177
191
|
parser.on('-f', '--include-files globs', desc) do |comma_separated_globs|
|
178
|
-
self.glob_allow_filters = comma_separated_globs
|
192
|
+
self.glob_allow_filters = split_comma_separated_with_braces(comma_separated_globs)
|
179
193
|
end
|
180
194
|
|
181
195
|
desc = 'Skip files matching specified glob patterns (comma separated). Empty by default.'
|
182
196
|
parser.on('-x', '--exclude-files globs', desc) do |comma_separated_globs|
|
183
|
-
self.glob_reject_filters = comma_separated_globs
|
197
|
+
self.glob_reject_filters = split_comma_separated_with_braces(comma_separated_globs)
|
184
198
|
end
|
185
199
|
end
|
186
200
|
end
|
data/lib/undercover/result.rb
CHANGED
@@ -35,6 +35,8 @@ module Undercover
|
|
35
35
|
lines = source_file['lines'].map.with_index do |line_coverage, idx|
|
36
36
|
[idx + 1, line_coverage] if line_coverage
|
37
37
|
end.compact
|
38
|
+
return lines unless source_file['branches']
|
39
|
+
|
38
40
|
branch_idx = 0
|
39
41
|
branches = source_file['branches'].map do |branch|
|
40
42
|
branch_idx += 1
|
data/lib/undercover/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: undercover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Grodowski
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-07-
|
10
|
+
date: 2025-07-13 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: base64
|