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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34741f7a74c75b9b6c91597b849a7d543864809b0dc8ec505f80d31fc7ed8ba2
4
- data.tar.gz: 91a6589eac0676253c1c2c0ce3a8e0399c18cfd62b37e38aab06364397b1f4b9
3
+ metadata.gz: 1eb3fb245f9d09808a19a1605fb6c70aac3c77cc8f52b8cc07b756ba33542ac3
4
+ data.tar.gz: d8895855e6e3e3c98446c43ce59e489ba5e2e79c5da6a2e091a195284462bff9
5
5
  SHA512:
6
- metadata.gz: 6e2334be919b81fa7f186824da3a289cf4af15e875fb758aa93f1df1d7a1e8704082765a616a657c0f37efaa6d44640396cc8875ca9f39037902fe9ce5bb5f68
7
- data.tar.gz: 4272d22c6e46532c552a1a9f01f815ee2a5be257bc951e04afdb34a9c4a812fdf7b609231c3ad2f2463f9e293bc46fc7a40d3e869a12a9edf8aa722899d85384
6
+ metadata.gz: b57b782e8e9258729c94d9455bf9c410cc51761ce97082550e7ed1eb78f38bb5fa8ccc6ed4678c64cb6f662ddf36f3d961d6856371026fe5d2fb5a57fce51fa4
7
+ data.tar.gz: 2748d7c27b2636323c15e08bbb27d7cf9d2ae58992f34e33afd79214d11adae7ba2180e383d26814271d2058c6bf16fb03d8ed552b6ef0376b497b10111532f1
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.4.4
3
+ Exclude:
4
+ - spec/fixtures/**/*
3
5
 
4
6
  Style/RegexpLiteral:
5
7
  EnforcedStyle: slashes
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.0...HEAD
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
@@ -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
 
@@ -36,6 +36,7 @@ module Undercover
36
36
 
37
37
  def self.syntax_version(version)
38
38
  return unless version
39
+
39
40
  Imagen.parser_version = version
40
41
  end
41
42
 
@@ -8,6 +8,7 @@ module Undercover
8
8
 
9
9
  def to_s
10
10
  return success unless @results.any?
11
+
11
12
  ([warnings_header] + formatted_warnings).join("\n")
12
13
  end
13
14
 
@@ -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
- cov_enum.peek[0]
55
- rescue StopIteration
56
- -1
57
- end
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Undercover
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
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.0
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-08-19 00:00:00.000000000 Z
11
+ date: 2018-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: imagen