simplecov-compare 0.2.1 → 0.3.0

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: fb79a5feaecb5a4c62831915911854abfffc988d41bd52490bb0962d0b407409
4
- data.tar.gz: 7d213a106d6db184523a55eca5d28fa64ae1904477449fc43623547d0fc96137
3
+ metadata.gz: 5dea173251fa50dbc5c29fd2a6b2f7473f7d61c1379b53c29efaf46d8c4fe433
4
+ data.tar.gz: 890ab6dbdc3ab70ba1c2523addc70218bed3ae63061bc427168454ca123b60e9
5
5
  SHA512:
6
- metadata.gz: 23c9c047c87264bcba223481c09db29a27cd200cbc045a08f2b3470f355435e9df6945cfdcdf838c532d3e607346e9d0728d64798aa65ae5bb3a6882e9c1cf0c
7
- data.tar.gz: 3561beb0e23d81b779c4834029b215b82336f3faf2c967c55c448d2369b1ea16b1af1bb4d5f34696ab465ec9accecd096ff8578026559614752e31cb4df7436a
6
+ metadata.gz: 7a6f028853f8d7e6a03072478489d05590c6490f745c1c0ed6c14d7514b98b1b3018c9418517f256cda391ad0fffe633b0ea6c0ce2fe23a43fdcb87ac72052e7
7
+ data.tar.gz: 233b2d494935f2fd1534170913cf4b4a45d24cc1a8d1da992d2a4d86c4a4aaa3693e7eee12ec4cf40ddd43effd0e36c3453b818f7d017aafe086762e541a1068
data/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
1
1
  ## Current release (in development)
2
2
 
3
- ## 0.2.1 [2026-03-08]
3
+ ## 0.3.0 [2026-02-21]
4
+
5
+ * Update module casing to match SimpleCov project.
6
+
7
+ *Kevin Murphy*
8
+
9
+ ## 0.2.2 [2026-02-09]
10
+
11
+ * Expose and display total number of file differences.
12
+
13
+ *Kevin Murphy*
14
+
15
+ ## 0.2.1 [2026-02-08]
4
16
 
5
17
  * Increase Glamour line width word wrap.
6
18
 
7
19
  *Kevin Murphy*
8
20
 
9
- ## 0.2.0 [2026-03-08]
21
+ ## 0.2.0 [2026-02-08]
10
22
 
11
23
  * Markdown formatter shows the coverage before and after per file.
12
24
 
@@ -28,13 +40,13 @@
28
40
 
29
41
  *Kevin Murphy*
30
42
 
31
- ## 0.1.1 [2026-03-08]
43
+ ## 0.1.1 [2026-02-08]
32
44
 
33
45
  * Add checks that file paths are provided.
34
46
 
35
47
  *Kevin Murphy*
36
48
 
37
- ## 0.1.0 [2026-03-08]
49
+ ## 0.1.0 [2026-02-08]
38
50
 
39
51
  * Initial Release.
40
52
 
data/README.md CHANGED
@@ -58,4 +58,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
58
58
 
59
59
  ## Code of Conduct
60
60
 
61
- Everyone interacting in the Simplecov::Compare project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kevin-j-m]/simplecov-compare/blob/main/CODE_OF_CONDUCT.md).
61
+ Everyone interacting in the Simplecov::Compare project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kevin-j-m/simplecov-compare/blob/main/CODE_OF_CONDUCT.md).
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "../lib/simplecov/compare"
4
4
 
5
- Simplecov::Compare.report(
5
+ SimpleCov::Compare.report(
6
6
  base_path: ARGV[0],
7
7
  to_path: ARGV[1],
8
8
  )
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  class FileComparison
6
6
  def initialize(base, to:)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  class FileLine
6
6
  # https://github.com/simplecov-ruby/simplecov/blob/main/lib/simplecov/source_file/line.rb
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  class FileResult
6
6
  # https://github.com/simplecov-ruby/simplecov/blob/main/lib/simplecov/source_file.rb
@@ -48,7 +48,7 @@ module Simplecov
48
48
  end
49
49
 
50
50
  def same_file?(other)
51
- return false unless other.is_a?(Simplecov::Compare::FileResult)
51
+ return false unless other.is_a?(SimpleCov::Compare::FileResult)
52
52
 
53
53
  filename.to_s.downcase == other.filename.to_s.downcase
54
54
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  module Formatter
6
6
  class MarkdownFormatter
@@ -56,7 +56,7 @@ module Simplecov
56
56
  def file_differences(result_set_comparison)
57
57
  if result_set_comparison.file_differences?
58
58
  <<~FILE_DIFF
59
- ## File Differences
59
+ ## File Differences (#{result_set_comparison.num_file_differences})
60
60
 
61
61
  | File Name | Delta | From | To |
62
62
  | --------- | ----- | ---- | -- |
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "glamour"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  module Reporter
8
8
  class GlamourReporter
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  module Reporter
6
6
  class SimpleReporter
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "json"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  class ResultFile
8
8
  def initialize(file_path)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  class ResultSet
6
6
  # https://github.com/simplecov-ruby/simplecov/blob/main/lib/simplecov/file_list.rb
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
5
  class ResultSetComparison
6
6
  def initialize(base, to:)
@@ -42,6 +42,10 @@ module Simplecov
42
42
  !file_differences.empty?
43
43
  end
44
44
 
45
+ def num_file_differences
46
+ file_differences.size
47
+ end
48
+
45
49
  private
46
50
 
47
51
  def compare
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Simplecov
3
+ module SimpleCov
4
4
  module Compare
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ require_relative "compare/result_file"
11
11
  require_relative "compare/result_set"
12
12
  require_relative "compare/result_set_comparison"
13
13
 
14
- module Simplecov
14
+ module SimpleCov
15
15
  module Compare
16
16
  class NoPathError < StandardError
17
17
  def initialize(msg="Required path not provided")
@@ -1,4 +1,4 @@
1
- module Simplecov
1
+ module SimpleCov
2
2
  module Compare
3
3
  VERSION: String
4
4
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe FileComparison do
8
8
  describe "#same_file?" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe FileLine do
8
8
  describe "#irrelevant?" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe FileResult do
8
8
  describe "#lines" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  module Formatter
8
8
  describe MarkdownFormatter do
@@ -56,6 +56,7 @@ module Simplecov
56
56
  stubs { big_increase.new_num_relevant_lines }.with { 4 }
57
57
 
58
58
  stubs { comparison.file_differences }.with { [big_increase, small_decrease, big_decrease, small_increase] }
59
+ stubs { comparison.num_file_differences }.with { 4 }
59
60
 
60
61
  markdown_result = <<~MARKDOWN
61
62
  # Coverage Comparison
@@ -64,7 +65,7 @@ module Simplecov
64
65
 
65
66
  Coverage increased 9 points from 33% to 42%.
66
67
 
67
- ## File Differences
68
+ ## File Differences (4)
68
69
 
69
70
  | File Name | Delta | From | To |
70
71
  | --------- | ----- | ---- | -- |
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  module Reporter
8
8
  describe SimpleReporter do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe ResultFile do
8
8
  describe "#coverage_data" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe ResultSetComparison do
8
8
  describe "#original_lines_covered_percent" do
@@ -244,6 +244,24 @@ module Simplecov
244
244
  assert_equal false, comparison.file_differences?
245
245
  end
246
246
  end
247
+
248
+ describe "#num_file_differences" do
249
+ it "counts the number of differences found" do
250
+ base_file = Mocktail.of(FileResult)
251
+ stubs { base_file.lines_covered_percent }.with { 5 }
252
+ stubs { base_file.filename }.with { "base.rb" }
253
+
254
+ base = Mocktail.of(ResultSet)
255
+ stubs { base.files }.with { [base_file] }
256
+
257
+ other = Mocktail.of(ResultSet)
258
+ stubs { other.files }.with { [] }
259
+
260
+ comparison = ResultSetComparison.new(base, to: other)
261
+
262
+ assert_equal 1, comparison.num_file_differences
263
+ end
264
+ end
247
265
  end
248
266
  end
249
267
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- module Simplecov
5
+ module SimpleCov
6
6
  module Compare
7
7
  describe ResultSet do
8
8
  describe "#files" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- describe Simplecov::Compare do
5
+ describe SimpleCov::Compare do
6
6
  describe ".report" do
7
7
  it "outputs the difference in the two files" do
8
8
  expected_output = <<~EXPECTED_OUTPUT
@@ -12,7 +12,7 @@ describe Simplecov::Compare do
12
12
 
13
13
  Coverage increased 66.67 points from 0.0% to 66.67%.
14
14
 
15
- ## File Differences
15
+ ## File Differences (3)
16
16
 
17
17
  | File Name | Delta | From | To |
18
18
  | --------- | ----- | ---- | -- |
@@ -24,40 +24,39 @@ describe Simplecov::Compare do
24
24
  EXPECTED_OUTPUT
25
25
 
26
26
  assert_output(expected_output) do
27
- Simplecov::Compare.report(
27
+ SimpleCov::Compare.report(
28
28
  base_path: "test/fixtures/empty_resultset.json",
29
29
  to_path: "test/fixtures/sample_resultset.json",
30
- formatter_class: Simplecov::Compare::Formatter::MarkdownFormatter,
31
- reporter_class: Simplecov::Compare::Reporter::SimpleReporter,
30
+ formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
31
+ reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
32
32
  )
33
33
  end
34
34
  end
35
35
 
36
36
  it "raises an exception when no base path is provided" do
37
- assert_raises(Simplecov::Compare::NoPathError, "Base path not provided") do
38
- Simplecov::Compare.report(
37
+ assert_raises(SimpleCov::Compare::NoPathError, "Base path not provided") do
38
+ SimpleCov::Compare.report(
39
39
  base_path: nil,
40
40
  to_path: "test/fixtures/sample_resultset.json",
41
- formatter_class: Simplecov::Compare::Formatter::MarkdownFormatter,
42
- reporter_class: Simplecov::Compare::Reporter::SimpleReporter,
41
+ formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
42
+ reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
43
43
  )
44
44
  end
45
-
46
45
  end
47
46
 
48
47
  it "raises an exception when no to path is provided" do
49
- assert_raises(Simplecov::Compare::NoPathError, "To path not provided") do
50
- Simplecov::Compare.report(
48
+ assert_raises(SimpleCov::Compare::NoPathError, "To path not provided") do
49
+ SimpleCov::Compare.report(
51
50
  base_path: "test/fixtures/sample_resultset.json",
52
51
  to_path: nil,
53
- formatter_class: Simplecov::Compare::Formatter::MarkdownFormatter,
54
- reporter_class: Simplecov::Compare::Reporter::SimpleReporter,
52
+ formatter_class: SimpleCov::Compare::Formatter::MarkdownFormatter,
53
+ reporter_class: SimpleCov::Compare::Reporter::SimpleReporter,
55
54
  )
56
55
  end
57
56
  end
58
57
  end
59
58
 
60
59
  it "has a version number" do
61
- assert !Simplecov::Compare::VERSION.nil?
60
+ assert !SimpleCov::Compare::VERSION.nil?
62
61
  end
63
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Murphy