undercover 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +6 -1
- data/lib/undercover.rb +7 -1
- data/lib/undercover/changeset.rb +2 -0
- data/lib/undercover/cli.rb +1 -0
- data/lib/undercover/formatter.rb +1 -0
- data/lib/undercover/result.rb +4 -4
- data/lib/undercover/version.rb +1 -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: 1eb3fb245f9d09808a19a1605fb6c70aac3c77cc8f52b8cc07b756ba33542ac3
|
4
|
+
data.tar.gz: d8895855e6e3e3c98446c43ce59e489ba5e2e79c5da6a2e091a195284462bff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b57b782e8e9258729c94d9455bf9c410cc51761ce97082550e7ed1eb78f38bb5fa8ccc6ed4678c64cb6f662ddf36f3d961d6856371026fe5d2fb5a57fce51fa4
|
7
|
+
data.tar.gz: 2748d7c27b2636323c15e08bbb27d7cf9d2ae58992f34e33afd79214d11adae7ba2180e383d26814271d2058c6bf16fb03d8ed552b6ef0376b497b10111532f1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.2.1] - 2018-09-26
|
10
|
+
### Fixed
|
11
|
+
- Bug in mapping changed lines to coverage results
|
12
|
+
|
9
13
|
## [0.2.0] - 2018-08-19
|
10
14
|
### Added
|
11
15
|
- This `CHANGELOG.md`
|
@@ -50,7 +54,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
50
54
|
### Added
|
51
55
|
- First release of `undercover` 🎉
|
52
56
|
|
53
|
-
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.2.
|
57
|
+
[Unreleased]: https://github.com/grodowski/undercover/compare/v0.2.1...HEAD
|
58
|
+
[0.2.1]: https://github.com/grodowski/undercover/compare/v0.2.0...v0.2.1
|
54
59
|
[0.2.0]: https://github.com/grodowski/undercover/compare/v0.1.7...v0.2.0
|
55
60
|
[0.1.7]: https://github.com/grodowski/undercover/compare/v0.1.6...v0.1.7
|
56
61
|
[0.1.6]: https://github.com/grodowski/undercover/compare/v0.1.5...v0.1.6
|
data/lib/undercover.rb
CHANGED
@@ -50,16 +50,21 @@ module Undercover
|
|
50
50
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
51
51
|
def build_warnings
|
52
52
|
flagged_results = Set.new
|
53
|
+
|
53
54
|
changeset.each_changed_line do |filepath, line_no|
|
54
55
|
dist_from_line_no = lambda do |res|
|
55
56
|
return BigDecimal::INFINITY if line_no < res.first_line
|
57
|
+
|
58
|
+
res_lines = res.first_line..res.last_line
|
59
|
+
return BigDecimal::INFINITY unless res_lines.cover?(line_no)
|
60
|
+
|
56
61
|
line_no - res.first_line
|
57
62
|
end
|
58
63
|
dist_from_line_no_sorter = lambda do |res1, res2|
|
59
64
|
dist_from_line_no[res1] <=> dist_from_line_no[res2]
|
60
65
|
end
|
61
|
-
|
62
66
|
next unless results[filepath]
|
67
|
+
|
63
68
|
res = results[filepath].min(&dist_from_line_no_sorter)
|
64
69
|
flagged_results << res if res&.uncovered?(line_no)
|
65
70
|
end
|
@@ -87,6 +92,7 @@ module Undercover
|
|
87
92
|
path = File.join(code_dir, relative_filename)
|
88
93
|
root_ast = Imagen::Node::Root.new.build_from_file(path)
|
89
94
|
next if root_ast.children.empty?
|
95
|
+
|
90
96
|
root_ast.children[0].find_all(match_all).each do |node|
|
91
97
|
yield(relative_filename, coverage, node)
|
92
98
|
end
|
data/lib/undercover/changeset.rb
CHANGED
@@ -38,6 +38,7 @@ module Undercover
|
|
38
38
|
mod = file_paths.map do |f|
|
39
39
|
path = File.join(repo.workdir, f)
|
40
40
|
next T_ZERO unless File.exist?(path)
|
41
|
+
|
41
42
|
File.mtime(path)
|
42
43
|
end.max
|
43
44
|
mod || T_ZERO
|
@@ -71,6 +72,7 @@ module Undercover
|
|
71
72
|
|
72
73
|
def compare_base_obj
|
73
74
|
return nil unless compare_base
|
75
|
+
|
74
76
|
repo.lookup(repo.merge_base(compare_base.to_s, head))
|
75
77
|
end
|
76
78
|
|
data/lib/undercover/cli.rb
CHANGED
data/lib/undercover/formatter.rb
CHANGED
data/lib/undercover/result.rb
CHANGED
@@ -51,10 +51,10 @@ module Undercover
|
|
51
51
|
cov_enum = coverage.each
|
52
52
|
cov_source_lines = (node.first_line..node.last_line).map do |line_no|
|
53
53
|
cov_line_no = begin
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
cov_enum.peek[0]
|
55
|
+
rescue StopIteration
|
56
|
+
-1
|
57
|
+
end
|
58
58
|
cov_enum.next[1] if cov_line_no == line_no
|
59
59
|
end
|
60
60
|
cov_source_lines.zip(node.source_lines_with_numbers)
|
data/lib/undercover/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Grodowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: imagen
|