uncov 0.4.0 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 397cffc8dced395da502cb60cc2136da4cb7f886ab0dc53636d8d3dd886b263b
4
- data.tar.gz: 9d73dc0cbf0467f131d470f4ee486013daf64f2e73980749ffcad09ccb8fced7
3
+ metadata.gz: 60ed1a2dd6520f9df75c5cc77e4b8b7b59d7ea61c6ae16c2e1ecad8bf86ae17a
4
+ data.tar.gz: 73bc05c3c969b1c8f2e7853f79aa96c2e793958c06bb0b0b3f4f6d03588501ca
5
5
  SHA512:
6
- metadata.gz: 5407ea15f650d927ec5887b5d1d0530caea5cefa92d3f9bbde1e0895de820cae5cf415d61a223af834d2265d717ac1ba4984b8e18ed547915ad55e1b86d04406
7
- data.tar.gz: 21c9b8dc0af1213f24167b0a0442550444cb58fb3af667d8612951818a3301cd33c981d6151a3c69579a726a30057b62102c2f3fc207ffa56da3078495172d3f
6
+ metadata.gz: 860d74da20e5c28b665829510cfc0e2e0aef47f1ba179a7e6d4fd0038740bdbe8b60b6ae471e15c1677d06a6fea62609ec543328034a5de58d55249d7dcee713
7
+ data.tar.gz: '0927a3a3c86100b376d92766ff6f7311797bb6345407948e418a4366a40231f38db1b9486934f1278f36b2977407fb5cf36935cac89a98f9841be991e504aa47'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2025-05-10: [v0.4.2](https://github.com/mpapis/uncov/releases/tag/v0.4.2)
4
+
5
+ ### Patch
6
+
7
+ - [#42](https://github.com/mpapis/uncov/pull/42): Fix calculating relevant and covered lines, by [@mpapis](https://github.com/mpapis)
8
+
9
+
10
+
11
+ ## 2025-05-05: [v0.4.1](https://github.com/mpapis/uncov/releases/tag/v0.4.1)
12
+
13
+ ### Patch
14
+
15
+ - [#40](https://github.com/mpapis/uncov/pull/40): Ignore removed git diff files, by [@mpapis](https://github.com/mpapis)
16
+
17
+
18
+
3
19
  ## 2025-05-05: [v0.4.0](https://github.com/mpapis/uncov/releases/tag/v0.4.0)
4
20
 
5
21
  ### Minor
data/README.md CHANGED
@@ -31,7 +31,7 @@ Basic usage:
31
31
  uncov
32
32
  ```
33
33
 
34
- Display configuration options:
34
+ ### Display configuration options
35
35
  ```bash
36
36
  $ uncov -h
37
37
  Usage: uncov [options]
@@ -45,7 +45,7 @@ Usage: uncov [options]
45
45
  --debug Get some insights, default: false
46
46
  -v, --version Show version
47
47
  -h, --help Print this help
48
- uncov 0.3.0 by Michal Papis <mpapis@gmail.com>
48
+ uncov 0.4.2 by Michal Papis <mpapis@gmail.com>
49
49
  ```
50
50
 
51
51
 
@@ -10,7 +10,7 @@ module Uncov::Finder::GitDiff
10
10
 
11
11
  def files
12
12
  git_diff.filter_map do |file_diff|
13
- [file_diff.path, changed_lines(file_diff)] if relevant_file?(file_diff.path)
13
+ [file_diff.path, changed_lines(file_diff)] if relevant_file?(file_diff.path) && File.exist?(file_diff.path)
14
14
  end.to_h
15
15
  end
16
16
 
@@ -28,6 +28,8 @@ module Uncov::Report::DiffLines
28
28
  end
29
29
 
30
30
  def add_context(finder, file_name, lines_hash)
31
+ return if Uncov.configuration.context.zero?
32
+
31
33
  line_numbers =
32
34
  lines_hash.filter_map do |line_number, line|
33
35
  line_number if line.uncov?
@@ -6,11 +6,15 @@ class Uncov::Report::File::Line < Uncov::Struct.new(:number, :content, :simple_c
6
6
  simple_cov == false && !no_cov
7
7
  end
8
8
 
9
+ def covered?
10
+ simple_cov == true && !no_cov
11
+ end
12
+
9
13
  def display?
10
14
  uncov? || context
11
15
  end
12
16
 
13
17
  def relevant?
14
- !no_cov
18
+ [false, true].include?(simple_cov) && !no_cov
15
19
  end
16
20
  end
@@ -26,7 +26,7 @@ class Uncov::Report::File < Uncov::Struct.new(:file_name, :lines, :git)
26
26
 
27
27
  def covered_lines
28
28
  cache(:covered_lines) do
29
- lines.reject(&:uncov?)
29
+ lines.select(&:covered?)
30
30
  end
31
31
  end
32
32
 
data/lib/uncov/report.rb CHANGED
@@ -34,7 +34,7 @@ class Uncov::Report < Uncov::Struct.new(:files)
34
34
  if files.empty?
35
35
  100.0
36
36
  else
37
- files.sum(&:coverage) / files.size
37
+ (files.sum(&:coverage) / files.size).round(2)
38
38
  end
39
39
  end
40
40
  end
data/lib/uncov/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uncov
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uncov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Papis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-05 00:00:00.000000000 Z
11
+ date: 2025-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize