covered 0.20.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/covered/capture.rb +14 -3
- data/lib/covered/config.rb +1 -1
- data/lib/covered/files.rb +9 -4
- data/lib/covered/summary.rb +53 -53
- data/lib/covered/sus.rb +1 -1
- data/lib/covered/version.rb +2 -2
- data/license.md +0 -1
- data/readme.md +14 -35
- data.tar.gz.sig +0 -0
- metadata +4 -61
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f81a87dfa60bac921785b65464dac44223ea3a449fc4701e205dd0f8d8bfece0
|
4
|
+
data.tar.gz: 7812cbe1c1622620bcc2b8dfcc70e9a97eda3cbb84dc5bea7291ce62009f5ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93b23c3c8ceecffbfb48d1739d0d4fc039f9e0ac90037f0414fb0ee660509d003d52e3618d3bc6ef6151ef4161e81de95e96c780868bac016ad1e7c4fe4ab709
|
7
|
+
data.tar.gz: e933d87ab654a06c99e11ea505c520ed89f60741241dc18246dca8fb6ff7266c3ddb5fa1b47c45f246de2cc5cd1325d165767a31e5e8ec63e57835138e2b6297
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/covered/capture.rb
CHANGED
@@ -21,15 +21,26 @@ module Covered
|
|
21
21
|
::Coverage.result(stop: false, clear: true)
|
22
22
|
end
|
23
23
|
|
24
|
+
EVAL_PATHS = {
|
25
|
+
"(eval)" => true,
|
26
|
+
"(irb)" => true,
|
27
|
+
"eval" => true
|
28
|
+
}
|
29
|
+
|
24
30
|
def finish
|
25
31
|
results = ::Coverage.result
|
26
32
|
|
27
33
|
results.each do |path, result|
|
28
|
-
|
34
|
+
next if EVAL_PATHS.include?(path)
|
35
|
+
|
29
36
|
path = self.expand_path(path)
|
30
37
|
|
31
|
-
|
32
|
-
|
38
|
+
# Skip files which don't exist. This can happen if `eval` is used with an invalid/incorrect path.
|
39
|
+
if File.exist?(path)
|
40
|
+
@output.mark(path, 1, result[:lines])
|
41
|
+
else
|
42
|
+
# warn "Skipping coverage for #{path.inspect} because it doesn't exist!"
|
43
|
+
# Ignore.
|
33
44
|
end
|
34
45
|
end
|
35
46
|
|
data/lib/covered/config.rb
CHANGED
data/lib/covered/files.rb
CHANGED
@@ -34,10 +34,15 @@ module Covered
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def mark(lineno, value = 1)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
# As currently implemented, @counts is base-zero rather than base-one.
|
38
|
+
# Line numbers generally start at line 1, so the first line, line 1, is at index 1. This means that index[0] is usually nil.
|
39
|
+
Array(value).each_with_index do |value, index|
|
40
|
+
offset = lineno + index
|
41
|
+
if @counts[offset]
|
42
|
+
@counts[offset] += value
|
43
|
+
else
|
44
|
+
@counts[offset] = value
|
45
|
+
end
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
data/lib/covered/summary.rb
CHANGED
@@ -29,6 +29,7 @@ module Covered
|
|
29
29
|
terminal[:ignored_code] ||= terminal.style(nil, nil, :faint)
|
30
30
|
|
31
31
|
terminal[:annotations] ||= terminal.style(:blue)
|
32
|
+
terminal[:error] ||= terminal.style(:red)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -82,36 +83,49 @@ module Covered
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
86
|
+
def print_coverage(terminal, coverage)
|
87
|
+
line_offset = 1
|
88
|
+
counts = coverage.counts
|
89
|
+
|
90
|
+
coverage.read do |file|
|
91
|
+
print_line_header(terminal)
|
92
|
+
|
93
|
+
file.each_line do |line|
|
94
|
+
count = counts[line_offset]
|
95
|
+
|
96
|
+
print_annotations(terminal, coverage, line, line_offset)
|
97
|
+
|
98
|
+
print_line(terminal, line, line_offset, count)
|
99
|
+
|
100
|
+
line_offset += 1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def print_error(terminal, error)
|
106
|
+
terminal.puts "Error: #{error.message}", style: :error
|
107
|
+
terminal.puts error.backtrace
|
108
|
+
end
|
109
|
+
|
85
110
|
# A coverage array gives, for each line, the number of line execution by the interpreter. A nil value means coverage is finishd for this line (lines like else and end).
|
86
|
-
def call(wrapper, output = $stdout)
|
111
|
+
def call(wrapper, output = $stdout, **options)
|
87
112
|
terminal = self.terminal(output)
|
88
113
|
|
89
114
|
statistics = self.each(wrapper) do |coverage|
|
90
|
-
line_offset = 1
|
91
|
-
|
92
115
|
path = wrapper.relative_path(coverage.path)
|
93
116
|
terminal.puts ""
|
94
117
|
terminal.puts path, style: :path
|
95
118
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
file.each_line do |line|
|
102
|
-
count = counts[line_offset]
|
103
|
-
|
104
|
-
print_annotations(terminal, coverage, line, line_offset)
|
105
|
-
|
106
|
-
print_line(terminal, line, line_offset, count)
|
107
|
-
|
108
|
-
line_offset += 1
|
109
|
-
end
|
119
|
+
begin
|
120
|
+
print_coverage(terminal, coverage, **options)
|
121
|
+
rescue => error
|
122
|
+
print_error(terminal, error)
|
110
123
|
end
|
111
124
|
|
112
125
|
coverage.print(output)
|
113
126
|
end
|
114
127
|
|
128
|
+
terminal.puts
|
115
129
|
statistics.print(output)
|
116
130
|
end
|
117
131
|
end
|
@@ -150,49 +164,35 @@ module Covered
|
|
150
164
|
end
|
151
165
|
|
152
166
|
class PartialSummary < Summary
|
153
|
-
def
|
154
|
-
|
167
|
+
def print_coverage(terminal, coverage, before: 4, after: 4)
|
168
|
+
return if coverage.zero?
|
155
169
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
terminal
|
162
|
-
|
163
|
-
counts = coverage.counts
|
164
|
-
last_line = nil
|
170
|
+
line_offset = 1
|
171
|
+
counts = coverage.counts
|
172
|
+
last_line = nil
|
173
|
+
|
174
|
+
coverage.read do |file|
|
175
|
+
print_line_header(terminal)
|
165
176
|
|
166
|
-
|
167
|
-
|
177
|
+
file.each_line do |line|
|
178
|
+
range = Range.new([line_offset - before, 0].max, line_offset+after)
|
168
179
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
count = counts[line_offset]
|
175
|
-
|
176
|
-
if last_line and last_line != line_offset-1
|
177
|
-
terminal.puts ":".rjust(16)
|
178
|
-
end
|
179
|
-
|
180
|
-
print_annotations(terminal, coverage, line, line_offset)
|
181
|
-
print_line(terminal, line, line_offset, count)
|
182
|
-
|
183
|
-
last_line = line_offset
|
184
|
-
end
|
185
|
-
|
186
|
-
line_offset += 1
|
180
|
+
if counts[range]&.include?(0)
|
181
|
+
count = counts[line_offset]
|
182
|
+
|
183
|
+
if last_line and last_line != line_offset-1
|
184
|
+
terminal.puts ":".rjust(16)
|
187
185
|
end
|
186
|
+
|
187
|
+
print_annotations(terminal, coverage, line, line_offset)
|
188
|
+
print_line(terminal, line, line_offset, count)
|
189
|
+
|
190
|
+
last_line = line_offset
|
188
191
|
end
|
192
|
+
|
193
|
+
line_offset += 1
|
189
194
|
end
|
190
|
-
|
191
|
-
coverage.print(output)
|
192
195
|
end
|
193
|
-
|
194
|
-
terminal.puts
|
195
|
-
statistics.print(output)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
data/lib/covered/sus.rb
CHANGED
data/lib/covered/version.rb
CHANGED
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -61,6 +61,10 @@ When running `rspec`, you can specify the kind of coverage analysis you would li
|
|
61
61
|
|
62
62
|
If no `COVERAGE` is specified, coverage tracking will be finishd.
|
63
63
|
|
64
|
+
### Template Coverage
|
65
|
+
|
66
|
+
Covered supports coverage of templates which are compiled into Ruby code. This is only supported on Ruby 3.2+ due to enhancements in the coverage interface.
|
67
|
+
|
64
68
|
### Partial Summary
|
65
69
|
|
66
70
|
COVERAGE=PartialSummary rspec
|
@@ -73,17 +77,6 @@ This report only shows snippets of source code with incomplete coverage.
|
|
73
77
|
|
74
78
|
This report lists several files in order of least coverage.l
|
75
79
|
|
76
|
-
### Coveralls/Travis Integration
|
77
|
-
|
78
|
-
You can send coverage information to [Coveralls](https://coveralls.io) by editing your `.travis.yml` file:
|
79
|
-
|
80
|
-
matrix:
|
81
|
-
include:
|
82
|
-
- rvm: 2.6
|
83
|
-
env: COVERAGE=PartialSummary,Coveralls
|
84
|
-
|
85
|
-
This will print out a brief report and then upload the coverage data. This integrates transparently with Travis.
|
86
|
-
|
87
80
|
## See Also
|
88
81
|
|
89
82
|
- [coveralls-ruby](https://github.com/lemurheavy/coveralls-ruby) – the official Coveralls implementation for Ruby.
|
@@ -91,32 +84,18 @@ This will print out a brief report and then upload the coverage data. This integ
|
|
91
84
|
|
92
85
|
## Contributing
|
93
86
|
|
94
|
-
|
95
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
96
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
97
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
98
|
-
5. Create new Pull Request
|
99
|
-
|
100
|
-
## License
|
87
|
+
We welcome contributions to this project.
|
101
88
|
|
102
|
-
|
89
|
+
1. Fork it.
|
90
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
91
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
92
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
93
|
+
5. Create new Pull Request.
|
103
94
|
|
104
|
-
|
95
|
+
### Developer Certificate of Origin
|
105
96
|
|
106
|
-
|
107
|
-
of this software and associated documentation files (the "Software"), to deal
|
108
|
-
in the Software without restriction, including without limitation the rights
|
109
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
110
|
-
copies of the Software, and to permit persons to whom the Software is
|
111
|
-
furnished to do so, subject to the following conditions:
|
97
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
112
98
|
|
113
|
-
|
114
|
-
all copies or substantial portions of the Software.
|
99
|
+
### Contributor Covenant
|
115
100
|
|
116
|
-
|
117
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
118
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
119
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
120
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
121
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
122
|
-
THE SOFTWARE.
|
101
|
+
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -10,7 +10,6 @@ authors:
|
|
10
10
|
- Felix Yan
|
11
11
|
- Shannon Skipper
|
12
12
|
- Stephen Ierodiaconou
|
13
|
-
- chocolateboy
|
14
13
|
autorequire:
|
15
14
|
bindir: bin
|
16
15
|
cert_chain:
|
@@ -43,7 +42,7 @@ cert_chain:
|
|
43
42
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
44
43
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
45
44
|
-----END CERTIFICATE-----
|
46
|
-
date: 2023-
|
45
|
+
date: 2023-06-30 00:00:00.000000000 Z
|
47
46
|
dependencies:
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: console
|
@@ -73,62 +72,6 @@ dependencies:
|
|
73
72
|
- - "~>"
|
74
73
|
- !ruby/object:Gem::Version
|
75
74
|
version: '1.0'
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: bundler
|
78
|
-
requirement: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: rspec
|
92
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.6'
|
97
|
-
type: :development
|
98
|
-
prerelease: false
|
99
|
-
version_requirements: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '3.6'
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
name: sus
|
106
|
-
requirement: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.14'
|
111
|
-
type: :development
|
112
|
-
prerelease: false
|
113
|
-
version_requirements: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.14'
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
name: trenni
|
120
|
-
requirement: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.6'
|
125
|
-
type: :development
|
126
|
-
prerelease: false
|
127
|
-
version_requirements: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '3.6'
|
132
75
|
description:
|
133
76
|
email:
|
134
77
|
executables: []
|
@@ -169,14 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
112
|
requirements:
|
170
113
|
- - ">="
|
171
114
|
- !ruby/object:Gem::Version
|
172
|
-
version: '3.
|
115
|
+
version: '3.0'
|
173
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
117
|
requirements:
|
175
118
|
- - ">="
|
176
119
|
- !ruby/object:Gem::Version
|
177
120
|
version: '0'
|
178
121
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.2.33
|
180
123
|
signing_key:
|
181
124
|
specification_version: 4
|
182
125
|
summary: A modern approach to code coverage.
|
metadata.gz.sig
CHANGED
Binary file
|