simplecov-lcov 0.8.0 → 0.9.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: a02bb3733cd050cf8c6bb7390937c12a6658cf3d31d824a3a24d5769f0f475d6
4
- data.tar.gz: 866c5bd282a2ba4727118755795d1da6f812b0b17c3de99276615883b3bcb0c0
3
+ metadata.gz: 2b45d40f2e63cf73546dffac6367bca70c09688796964f90bc25cbfef0f8a5eb
4
+ data.tar.gz: feecf0f73ff209b3b2a0bdae343167b637de0ee3a0567101f72021824309b901
5
5
  SHA512:
6
- metadata.gz: cded646d4f8e1e1a785032ee6d2a796a49e58d55563aee0677276d1f784fcabada077a0790ceda1fd0b569f71618526efa9da6d4165f0c49c49e67a07297acdc
7
- data.tar.gz: 349765f559c2a6e42a66be7a75d4b20f8ec8613114e338f3bb749bf1b2eec52f9e6d0ebfb6af18515e43e3c7a0af82aed9becba0241119b1beeed09762f77c1e
6
+ metadata.gz: 6d3c37479930114eba475e68b05a32b9991e531fd217cffc4ba85ec15d17839b9e43366c81c780cf6ec71252cbc64e6cdc30356ab8c441cac2976e7e7d0875ab
7
+ data.tar.gz: d5b74cf7218a792a1081cfe62187ccea6c7a4ea42649b67f052ae0ec25253f418ce93cd1ac2c8234b5ca03ebcced96e8b210d0d88bf992620303e7cba49f3eae
data/.coveralls.yml CHANGED
@@ -1 +1,8 @@
1
- service_name: travis-ci
1
+ service_name: github
2
+ service_job_id: $GITHUB_RUN_ID
3
+ service_pull_request: $GITHUB_EVENT_NAME
4
+ service_branch: $GITHUB_REF_NAME
5
+ service_event_type: $GITHUB_EVENT_NAME
6
+
7
+ # SimpleCovの結果を直接使用
8
+ coverage_dir: coverage
@@ -18,7 +18,7 @@ module SimpleCovLcov
18
18
  end
19
19
 
20
20
  def single_report_path
21
- @single_report_path || File.join(output_directory, lcov_file_name)
21
+ @single_report_path ||= File.join(output_directory, lcov_file_name)
22
22
  end
23
23
 
24
24
  def lcov_file_name
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SimpleCov
4
+ module Lcov
5
+ VERSION = '0.9.0'
6
+ end
7
+ end
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'pathname'
3
+ require_relative 'simplecov/lcov/version'
3
4
  require_relative 'simple_cov_lcov/configuration'
4
5
 
5
6
  fail 'simplecov-lcov requires simplecov' unless defined?(SimpleCov)
@@ -85,9 +86,12 @@ module SimpleCov
85
86
  filename = file.filename.gsub("#{SimpleCov.root}/", './')
86
87
  pieces = []
87
88
  pieces << "SF:#{filename}"
88
- pieces << format_lines(file)
89
+ lines = format_lines(file)
90
+ pieces << lines if lines.length > 0
91
+ pieces << "LF:#{file.lines.count(&:coverage)}"
92
+ pieces << "LH:#{file.lines.count(&:covered?)}"
89
93
 
90
- if SimpleCov.branch_coverage?
94
+ if SimpleCov.respond_to?(:branch_coverage?) && SimpleCov.branch_coverage?
91
95
  branch_data = format_branches(file)
92
96
  pieces << branch_data if branch_data.length > 0
93
97
  pieces << "BRF:#{file.total_branches.length}"
@@ -1,14 +1,15 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: simplecov-lcov 0.7.0 ruby lib
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/simplecov/lcov/version"
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = "simplecov-lcov".freeze
6
- s.version = "0.8.0"
7
+ s.version = SimpleCov::Lcov::VERSION
7
8
 
8
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
10
  s.require_paths = ["lib".freeze]
10
11
  s.authors = ["fortissimo1997".freeze]
11
- s.date = "2020-02-18"
12
+ s.date = Time.now.strftime("%Y-%m-%d")
12
13
  s.description = "Custom SimpleCov formatter to generate a lcov style coverage.".freeze
13
14
  s.email = "fortissimo1997@gmail.com".freeze
14
15
  s.extra_rdoc_files = [
@@ -20,18 +21,19 @@ Gem::Specification.new do |s|
20
21
  ".document",
21
22
  ".rspec",
22
23
  ".tachikoma.yml",
23
- ".travis.yml",
24
24
  "Gemfile",
25
25
  "LICENSE.txt",
26
26
  "README.markdown",
27
27
  "Rakefile",
28
- "VERSION",
28
+ "lib/simplecov/lcov/version.rb",
29
29
  "lib/simple_cov_lcov/configuration.rb",
30
30
  "lib/simplecov-lcov.rb",
31
31
  "simplecov-lcov.gemspec",
32
32
  "spec/configuration_spec.rb",
33
33
  "spec/fixtures/app/models/user.rb",
34
34
  "spec/fixtures/hoge.rb",
35
+ "spec/fixtures/lcov/spec-fixtures-blank.rb.branch.lcov",
36
+ "spec/fixtures/lcov/spec-fixtures-blank.rb.lcov",
35
37
  "spec/fixtures/lcov/spec-fixtures-app-models-user.rb.branch.lcov",
36
38
  "spec/fixtures/lcov/spec-fixtures-app-models-user.rb.lcov",
37
39
  "spec/fixtures/lcov/spec-fixtures-hoge.rb.branch.lcov",
@@ -41,37 +43,15 @@ Gem::Specification.new do |s|
41
43
  ]
42
44
  s.homepage = "http://github.com/fortissimo1997/simplecov-lcov".freeze
43
45
  s.licenses = ["MIT".freeze]
44
- s.rubygems_version = "3.0.3".freeze
46
+ s.rubygems_version = "3.7.1".freeze
45
47
  s.summary = "Custom SimpleCov formatter to generate a lcov style coverage.".freeze
46
48
 
47
- if s.respond_to? :specification_version then
48
- s.specification_version = 4
49
-
50
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
52
- s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
53
- s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
54
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
55
- s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.18"])
56
- s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
57
- s.add_development_dependency(%q<activesupport>.freeze, [">= 0"])
58
- else
59
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
60
- s.add_dependency(%q<rdoc>.freeze, [">= 0"])
61
- s.add_dependency(%q<bundler>.freeze, [">= 0"])
62
- s.add_dependency(%q<rake>.freeze, [">= 0"])
63
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.18"])
64
- s.add_dependency(%q<coveralls>.freeze, [">= 0"])
65
- s.add_dependency(%q<activesupport>.freeze, [">= 0"])
66
- end
67
- else
68
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
69
- s.add_dependency(%q<rdoc>.freeze, [">= 0"])
70
- s.add_dependency(%q<bundler>.freeze, [">= 0"])
71
- s.add_dependency(%q<rake>.freeze, [">= 0"])
72
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.18"])
73
- s.add_dependency(%q<coveralls>.freeze, [">= 0"])
74
- s.add_dependency(%q<activesupport>.freeze, [">= 0"])
75
- end
49
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
50
+ s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
51
+ s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
52
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
53
+ s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.18"])
54
+ s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
55
+ s.add_development_dependency(%q<activesupport>.freeze, [">= 0"])
76
56
  end
77
57
 
@@ -12,6 +12,8 @@ DA:22,1
12
12
  DA:23,1
13
13
  DA:24,1
14
14
  DA:25,1
15
+ LF:13
16
+ LH:12
15
17
  BRF:0
16
18
  BRH:0
17
19
  end_of_record
@@ -12,4 +12,6 @@ DA:22,1
12
12
  DA:23,1
13
13
  DA:24,1
14
14
  DA:25,1
15
+ LF:13
16
+ LH:12
15
17
  end_of_record
@@ -0,0 +1,6 @@
1
+ SF:./spec/fixtures/blank.rb
2
+ LF:0
3
+ LH:0
4
+ BRF:0
5
+ BRH:0
6
+ end_of_record
@@ -0,0 +1,4 @@
1
+ SF:./spec/fixtures/blank.rb
2
+ LF:0
3
+ LH:0
4
+ end_of_record
@@ -9,6 +9,8 @@ DA:14,1
9
9
  DA:15,0
10
10
  DA:19,1
11
11
  DA:20,1
12
+ LF:10
13
+ LH:9
12
14
  BRDA:10,0,1,1
13
15
  BRDA:10,0,2,-
14
16
  BRF:2
@@ -9,4 +9,6 @@ DA:14,1
9
9
  DA:15,0
10
10
  DA:19,1
11
11
  DA:20,1
12
+ LF:10
13
+ LH:9
12
14
  end_of_record
@@ -13,6 +13,7 @@ module SimpleCov::Formatter
13
13
 
14
14
  load 'fixtures/app/models/user.rb'
15
15
  load 'fixtures/hoge.rb'
16
+ load 'fixtures/blank.rb'
16
17
  end
17
18
 
18
19
  describe '#format' do
@@ -48,29 +49,84 @@ module SimpleCov::Formatter
48
49
  it { expect(File.read(output_path)).to eq(fixture) }
49
50
  end
50
51
 
51
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5")
52
- describe 'branch coverage enabled' do
53
- let(:branch_coverage_enabled) { true }
54
-
55
- describe 'spec-fixtures-hoge.rb.branch.lcov' do
56
- let(:output_path) {
57
- File.join(LcovFormatter.config.output_directory, 'spec-fixtures-hoge.rb.lcov')
58
- }
59
- let(:fixture) {
60
- File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-hoge.rb.branch.lcov")
61
- }
62
- it { expect(File.read(output_path)).to eq(fixture) }
63
- end
64
-
65
- describe 'spec-fixtures-app-models-user.rb.branch.lcov' do
66
- let(:output_path) {
67
- File.join(LcovFormatter.config.output_directory, 'spec-fixtures-app-models-user.rb.lcov')
68
- }
69
- let(:fixture) {
70
- File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-app-models-user.rb.branch.lcov")
71
- }
72
- it { expect(File.read(output_path)).to eq(fixture) }
73
- end
52
+ describe 'spec-fixtures-blank.rb.lcov' do
53
+ let(:output_path) {
54
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-blank.rb.lcov')
55
+ }
56
+ let(:fixture) {
57
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-blank.rb.lcov")
58
+ }
59
+ it { expect(File.read(output_path)).to eq(fixture) }
60
+ end
61
+
62
+ describe 'branch coverage enabled' do
63
+ let(:branch_coverage_enabled) { true }
64
+
65
+ describe 'spec-fixtures-hoge.rb.branch.lcov' do
66
+ let(:output_path) {
67
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-hoge.rb.lcov')
68
+ }
69
+ let(:fixture) {
70
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-hoge.rb.branch.lcov")
71
+ }
72
+ it { expect(File.read(output_path)).to eq(fixture) }
73
+ end
74
+
75
+ describe 'spec-fixtures-app-models-user.rb.branch.lcov' do
76
+ let(:output_path) {
77
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-app-models-user.rb.lcov')
78
+ }
79
+ let(:fixture) {
80
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-app-models-user.rb.branch.lcov")
81
+ }
82
+ it { expect(File.read(output_path)).to eq(fixture) }
83
+ end
84
+
85
+ describe 'spec-fixtures-blank.rb.branch.lcov' do
86
+ let(:output_path) {
87
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-blank.rb.lcov')
88
+ }
89
+ let(:fixture) {
90
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-blank.rb.branch.lcov")
91
+ }
92
+ it { expect(File.read(output_path)).to eq(fixture) }
93
+ end
94
+ end
95
+
96
+ context 'SimpleCov.branch_coverage? is missing' do
97
+ before do
98
+ allow(SimpleCov).to receive(:branch_coverage?).and_return(false)
99
+ LcovFormatter.new.format(simplecov_result)
100
+ end
101
+
102
+ describe 'spec-fixtures-hoge.rb.lcov' do
103
+ let(:output_path) {
104
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-hoge.rb.lcov')
105
+ }
106
+ let(:fixture) {
107
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-hoge.rb.lcov")
108
+ }
109
+ it { expect(File.read(output_path)).to eq(fixture) }
110
+ end
111
+
112
+ describe 'spec-fixtures-app-models-user.rb.lcov' do
113
+ let(:output_path) {
114
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-app-models-user.rb.lcov')
115
+ }
116
+ let(:fixture) {
117
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-app-models-user.rb.lcov")
118
+ }
119
+ it { expect(File.read(output_path)).to eq(fixture) }
120
+ end
121
+
122
+ describe 'spec-fixtures-blank.rb.lcov' do
123
+ let(:output_path) {
124
+ File.join(LcovFormatter.config.output_directory, 'spec-fixtures-blank.rb.lcov')
125
+ }
126
+ let(:fixture) {
127
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-blank.rb.lcov")
128
+ }
129
+ it { expect(File.read(output_path)).to eq(fixture) }
74
130
  end
75
131
  end
76
132
  end
@@ -95,8 +151,12 @@ module SimpleCov::Formatter
95
151
  let(:fixture_of_user) {
96
152
  File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-app-models-user.rb.lcov")
97
153
  }
154
+ let(:fixture_of_blank) {
155
+ File.read("#{File.dirname(__FILE__)}/fixtures/lcov/spec-fixtures-blank.rb.lcov")
156
+ }
98
157
  it { expect(File.read(output_path)).to match(fixture_of_hoge) }
99
158
  it { expect(File.read(output_path)).to match(fixture_of_user) }
159
+ it { expect(File.read(output_path)).to match(fixture_of_blank) }
100
160
  end
101
161
  end
102
162
  end
data/spec/spec_helper.rb CHANGED
@@ -29,13 +29,13 @@ require 'simplecov-lcov'
29
29
  # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
30
30
 
31
31
  RSpec.configure do |config|
32
- config.before(:each) do
33
- if Dir.exist?(SimpleCov::Formatter::LcovFormatter.config.output_directory)
34
- FileUtils
35
- .remove_dir(
36
- SimpleCov::Formatter::LcovFormatter.config.output_directory,
37
- true
38
- )
39
- end
40
- end
32
+ # config.before(:each) do
33
+ # if Dir.exist?(SimpleCov::Formatter::LcovFormatter.config.output_directory)
34
+ # FileUtils
35
+ # .remove_dir(
36
+ # SimpleCov::Formatter::LcovFormatter.config.output_directory,
37
+ # true
38
+ # )
39
+ # end
40
+ # end
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-lcov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fortissimo1997
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2025-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -120,20 +120,21 @@ files:
120
120
  - ".document"
121
121
  - ".rspec"
122
122
  - ".tachikoma.yml"
123
- - ".travis.yml"
124
123
  - Gemfile
125
124
  - LICENSE.txt
126
125
  - README.markdown
127
126
  - Rakefile
128
- - VERSION
129
127
  - lib/simple_cov_lcov/configuration.rb
130
128
  - lib/simplecov-lcov.rb
129
+ - lib/simplecov/lcov/version.rb
131
130
  - simplecov-lcov.gemspec
132
131
  - spec/configuration_spec.rb
133
132
  - spec/fixtures/app/models/user.rb
134
133
  - spec/fixtures/hoge.rb
135
134
  - spec/fixtures/lcov/spec-fixtures-app-models-user.rb.branch.lcov
136
135
  - spec/fixtures/lcov/spec-fixtures-app-models-user.rb.lcov
136
+ - spec/fixtures/lcov/spec-fixtures-blank.rb.branch.lcov
137
+ - spec/fixtures/lcov/spec-fixtures-blank.rb.lcov
137
138
  - spec/fixtures/lcov/spec-fixtures-hoge.rb.branch.lcov
138
139
  - spec/fixtures/lcov/spec-fixtures-hoge.rb.lcov
139
140
  - spec/simplecov-lcov_spec.rb
@@ -142,7 +143,7 @@ homepage: http://github.com/fortissimo1997/simplecov-lcov
142
143
  licenses:
143
144
  - MIT
144
145
  metadata: {}
145
- post_install_message:
146
+ post_install_message:
146
147
  rdoc_options: []
147
148
  require_paths:
148
149
  - lib
@@ -157,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  - !ruby/object:Gem::Version
158
159
  version: '0'
159
160
  requirements: []
160
- rubygems_version: 3.1.2
161
- signing_key:
161
+ rubygems_version: 3.5.22
162
+ signing_key:
162
163
  specification_version: 4
163
164
  summary: Custom SimpleCov formatter to generate a lcov style coverage.
164
165
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - ruby-2.4.2
4
- - ruby-2.5.0
5
- - ruby-head
6
- env:
7
- - "COVERAGE=true"
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.8.0