covered 0.13.0 → 0.14.1
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/.github/workflows/development.yml +45 -0
- data/.github/workflows/documentation.yml +34 -0
- data/examples/coverage/.DS_Store +0 -0
- data/examples/coverage/erb/.covered.db +0 -0
- data/lib/covered/capture.rb +7 -3
- data/lib/covered/coveralls.rb +2 -0
- data/lib/covered/markdown_summary.rb +100 -0
- data/lib/covered/persist.rb +2 -2
- data/lib/covered/policy.rb +7 -1
- data/lib/covered/source.rb +18 -8
- data/lib/covered/summary.rb +2 -2
- data/lib/covered/version.rb +1 -1
- data/media/.DS_Store +0 -0
- data.tar.gz.sig +0 -0
- metadata +72 -56
- metadata.gz.sig +0 -0
- data/.editorconfig +0 -6
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -19
- data/Gemfile +0 -8
- data/README.md +0 -132
- data/Rakefile +0 -13
- data/covered.gemspec +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65050cba58d4c4af27b6361adb1e398d7cc17190f5cd9f437b75ebe551fd47d9
|
4
|
+
data.tar.gz: 9e27906a329ce6748ef8023ba4ef7e14747ca612516052396369cd23798ae2be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e15acaf1a9ccf76fca83a1fe9c2b0d5189b32ce60e9b2583b0f87a5c8296575f1669d96b9dddffaf9e9cc7d5ebd2192f675665c6f55ef73176eeb50bf2251d
|
7
|
+
data.tar.gz: 64e9dff68ef4a4efee7e903aff00ce60358a3c15853e487009c56828bffa1f510a2d0dd762b08973fc58ccccb948179aa5787badd4ffed07a094d1ccaaf5a721
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
name: Development
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: ${{matrix.ruby}} on ${{matrix.os}}
|
8
|
+
runs-on: ${{matrix.os}}-latest
|
9
|
+
continue-on-error: ${{matrix.experimental}}
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
os:
|
14
|
+
- ubuntu
|
15
|
+
- macos
|
16
|
+
|
17
|
+
ruby:
|
18
|
+
- "2.6"
|
19
|
+
- "2.7"
|
20
|
+
- "3.0"
|
21
|
+
|
22
|
+
experimental: [false]
|
23
|
+
env: [""]
|
24
|
+
|
25
|
+
include:
|
26
|
+
- os: ubuntu
|
27
|
+
ruby: truffleruby
|
28
|
+
experimental: true
|
29
|
+
- os: ubuntu
|
30
|
+
ruby: jruby
|
31
|
+
experimental: true
|
32
|
+
- os: ubuntu
|
33
|
+
ruby: head
|
34
|
+
experimental: true
|
35
|
+
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v2
|
38
|
+
- uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: ${{matrix.ruby}}
|
41
|
+
bundler-cache: true
|
42
|
+
|
43
|
+
- name: Run tests
|
44
|
+
timeout-minutes: 5
|
45
|
+
run: ${{matrix.env}} bundle exec rspec
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Documentation
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
env:
|
9
|
+
BUNDLE_WITH: maintenance
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
deploy:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 3.1
|
21
|
+
bundler-cache: true
|
22
|
+
|
23
|
+
- name: Installing packages
|
24
|
+
run: sudo apt-get install wget
|
25
|
+
|
26
|
+
- name: Prepare GitHub Pages
|
27
|
+
run: bundle exec bake github:pages:prepare --directory docs
|
28
|
+
|
29
|
+
- name: Generate documentation
|
30
|
+
timeout-minutes: 5
|
31
|
+
run: bundle exec bake utopia:project:static --force no
|
32
|
+
|
33
|
+
- name: Deploy GitHub Pages
|
34
|
+
run: bundle exec bake github:pages:commit --directory docs
|
Binary file
|
Binary file
|
data/lib/covered/capture.rb
CHANGED
@@ -28,9 +28,13 @@ module Covered
|
|
28
28
|
super(output)
|
29
29
|
|
30
30
|
begin
|
31
|
-
@trace = TracePoint.new(:line, :call, :c_call) do |
|
32
|
-
if
|
33
|
-
|
31
|
+
@trace = TracePoint.new(:line, :call, :c_call) do |trace|
|
32
|
+
if trace.event == :call
|
33
|
+
# Ruby doesn't always mark call-sites in sub-expressions, so we use this approach to compute a call site and mark it:
|
34
|
+
location = caller_locations(2, 1).first
|
35
|
+
@output.mark(location.path, location.lineno, 1)
|
36
|
+
elsif path = trace.path
|
37
|
+
@output.mark(path, trace.lineno, 1)
|
34
38
|
end
|
35
39
|
end
|
36
40
|
rescue
|
data/lib/covered/coveralls.rb
CHANGED
@@ -60,6 +60,8 @@ module Covered
|
|
60
60
|
return {"service_name" => @service, "service_job_id" => @job_id}
|
61
61
|
elsif job_id = ENV['TRAVIS_JOB_ID']
|
62
62
|
return {"service_name" => "travis-ci", "service_job_id" => job_id}
|
63
|
+
elsif token = ENV['GITHUB_TOKEN']
|
64
|
+
return {"service_name" => "github", "repo_token" => token}
|
63
65
|
else
|
64
66
|
warn "#{self.class} can't detect service! Please specify COVERALLS_REPO_TOKEN."
|
65
67
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'statistics'
|
22
|
+
require_relative 'wrapper'
|
23
|
+
|
24
|
+
require 'console/output'
|
25
|
+
|
26
|
+
module Covered
|
27
|
+
class MarkdownSummary
|
28
|
+
def initialize(threshold: 1.0)
|
29
|
+
@threshold = threshold
|
30
|
+
end
|
31
|
+
|
32
|
+
def each(wrapper)
|
33
|
+
statistics = Statistics.new
|
34
|
+
|
35
|
+
wrapper.each do |coverage|
|
36
|
+
statistics << coverage
|
37
|
+
|
38
|
+
if @threshold.nil? or coverage.ratio < @threshold
|
39
|
+
yield coverage
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
return statistics
|
44
|
+
end
|
45
|
+
|
46
|
+
def print_annotations(output, coverage, line, line_offset)
|
47
|
+
if annotations = coverage.annotations[line_offset]
|
48
|
+
prefix = "#{line_offset}|".rjust(8) + "*|".rjust(8)
|
49
|
+
output.write prefix
|
50
|
+
|
51
|
+
output.write line.match(/^\s+/)
|
52
|
+
output.puts "\# #{annotations.join(", ")}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_line_header(output)
|
57
|
+
output.puts "Line|".rjust(8) + "Hits|".rjust(8)
|
58
|
+
end
|
59
|
+
|
60
|
+
def print_line(output, line, line_offset, count)
|
61
|
+
prefix = "#{line_offset}|".rjust(8) + "#{count}|".rjust(8)
|
62
|
+
|
63
|
+
output.write prefix
|
64
|
+
output.write line
|
65
|
+
|
66
|
+
# If there was no newline at end of file, we add one:
|
67
|
+
unless line.end_with?($/)
|
68
|
+
output.puts
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# A coverage array gives, for each line, the number of line execution by the interpreter. A nil value means coverage is disabled for this line (lines like else and end).
|
73
|
+
def call(wrapper, output = $stdout)
|
74
|
+
output.puts '# Coverage Report'
|
75
|
+
output.puts
|
76
|
+
|
77
|
+
ordered = []
|
78
|
+
buffer = StringIO.new
|
79
|
+
|
80
|
+
statistics = self.each(wrapper) do |coverage|
|
81
|
+
ordered << coverage unless coverage.complete?
|
82
|
+
end
|
83
|
+
|
84
|
+
statistics.print(output)
|
85
|
+
|
86
|
+
if ordered.any?
|
87
|
+
output.puts "", "\#\# Least Coverage:", ""
|
88
|
+
ordered.sort_by!(&:missing_count).reverse!
|
89
|
+
|
90
|
+
ordered.first(5).each do |coverage|
|
91
|
+
path = wrapper.relative_path(coverage.path)
|
92
|
+
|
93
|
+
output.puts "- `#{path}`: #{coverage.missing_count} lines not executed!"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
output.print(buffer.string)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/lib/covered/persist.rb
CHANGED
@@ -63,7 +63,7 @@ module Covered
|
|
63
63
|
return unless File.exist?(@path)
|
64
64
|
|
65
65
|
# Load existing coverage information and mark all files:
|
66
|
-
File.open(@path, "
|
66
|
+
File.open(@path, "rb") do |file|
|
67
67
|
file.flock(File::LOCK_SH)
|
68
68
|
|
69
69
|
make_unpacker(file).each(&self.method(:apply))
|
@@ -72,7 +72,7 @@ module Covered
|
|
72
72
|
|
73
73
|
def save!(path = @path)
|
74
74
|
# Dump all coverage:
|
75
|
-
File.open(@path, "
|
75
|
+
File.open(@path, "wb") do |file|
|
76
76
|
file.flock(File::LOCK_EX)
|
77
77
|
|
78
78
|
packer = make_packer(file)
|
data/lib/covered/policy.rb
CHANGED
@@ -102,7 +102,7 @@ module Covered
|
|
102
102
|
begin
|
103
103
|
klass = Covered.const_get(@name)
|
104
104
|
rescue NameError
|
105
|
-
require_relative
|
105
|
+
require_relative(snake_case(@name))
|
106
106
|
end
|
107
107
|
|
108
108
|
klass = Covered.const_get(@name)
|
@@ -117,6 +117,12 @@ module Covered
|
|
117
117
|
def to_s
|
118
118
|
"\#<#{self.class} loading #{@name}>"
|
119
119
|
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def snake_case(name)
|
124
|
+
name.gsub(/(.+)(?=[A-Z\z])/){$1 + '_'}.downcase
|
125
|
+
end
|
120
126
|
end
|
121
127
|
|
122
128
|
def reports!(coverage = ENV['COVERAGE'])
|
data/lib/covered/source.rb
CHANGED
@@ -35,10 +35,16 @@ module Covered
|
|
35
35
|
@annotations = {}
|
36
36
|
|
37
37
|
begin
|
38
|
-
@trace = TracePoint.new(:script_compiled) do |
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
@trace = TracePoint.new(:script_compiled) do |trace|
|
39
|
+
instruction_sequence = trace.instruction_sequence
|
40
|
+
|
41
|
+
# We only track source files which begin at line 1, as these represent whole files instead of monkey patches.
|
42
|
+
if instruction_sequence.first_lineno <= 1
|
43
|
+
# Extract the source path and source itself and save it for later:
|
44
|
+
if path = instruction_sequence.path and source = trace.eval_script
|
45
|
+
@mutex.synchronize do
|
46
|
+
@paths[path] = source
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -73,13 +79,17 @@ module Covered
|
|
73
79
|
def expand(node, coverage, level = 0)
|
74
80
|
if node.is_a? Parser::AST::Node
|
75
81
|
if ignore?(node)
|
76
|
-
coverage.annotate(node.location.line, "ignoring #{node.type}")
|
82
|
+
# coverage.annotate(node.location.line, "ignoring #{node.type}")
|
77
83
|
else
|
78
84
|
if executable?(node)
|
79
|
-
# coverage.annotate(node.
|
85
|
+
# coverage.annotate(node.location.line, "executable #{node.type}")
|
80
86
|
coverage.counts[node.location.line] ||= 0
|
81
|
-
|
82
|
-
# coverage.annotate(node.
|
87
|
+
elsif node.location
|
88
|
+
# coverage.annotate(node.location.line, "not executable #{node.type}") rescue nil
|
89
|
+
end
|
90
|
+
|
91
|
+
if node.type == :send
|
92
|
+
# coverage.annotate(node.location.line, "ignoring #{node.type} children")
|
83
93
|
end
|
84
94
|
|
85
95
|
expand(node.children, coverage, level + 1)
|
data/lib/covered/summary.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
require_relative 'statistics'
|
22
22
|
require_relative 'wrapper'
|
23
23
|
|
24
|
-
require '
|
24
|
+
require 'console/terminal'
|
25
25
|
|
26
26
|
module Covered
|
27
27
|
class Summary
|
@@ -30,7 +30,7 @@ module Covered
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def terminal(output)
|
33
|
-
|
33
|
+
Console::Terminal.for(output).tap do |terminal|
|
34
34
|
terminal[:path] ||= terminal.style(nil, nil, :bold, :underline)
|
35
35
|
terminal[:brief_path] ||= terminal.style(:yellow)
|
36
36
|
|
data/lib/covered/version.rb
CHANGED
data/media/.DS_Store
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,59 +1,90 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
|
8
|
+
- Cyril Roelandt
|
9
|
+
- Shannon Skipper
|
10
|
+
- chocolateboy
|
11
|
+
autorequire:
|
9
12
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
13
|
+
cert_chain:
|
14
|
+
- |
|
15
|
+
-----BEGIN CERTIFICATE-----
|
16
|
+
MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
|
17
|
+
ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
|
18
|
+
MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
|
19
|
+
aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
|
20
|
+
AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
|
21
|
+
xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
|
22
|
+
eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
|
23
|
+
L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
|
24
|
+
9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
|
25
|
+
E/mljo4zEVKhlTWpJklMIhr55ZRrSarKFuW7en0+tpJrfsYiAmXMJNi4XAYJH7uL
|
26
|
+
rgJuJwSaa/dMz+VmUoo7VKtSfCoOI+6v5/z0sK3oT6sG6ZwyI47DBq2XqNC6tnAj
|
27
|
+
w+XmCywiTQrFzMMAvcA7rPI4F0nU1rZId51rOvvfxaONp+wgTi4P8owZLw0/j0m4
|
28
|
+
8C20DYi6EYx4AHDXiLpElWh3AgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8E
|
29
|
+
BAMCBLAwHQYDVR0OBBYEFB6ZaeWKxQjGTI+pmz7cKRmMIywwMC4GA1UdEQQnMCWB
|
30
|
+
I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWB
|
31
|
+
I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEB
|
32
|
+
CwUAA4IBgQBVoM+pu3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
|
33
|
+
9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
|
34
|
+
vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
|
35
|
+
x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
|
36
|
+
bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
|
37
|
+
Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
|
38
|
+
y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
|
39
|
+
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
40
|
+
HiLJ8VOFx6w=
|
41
|
+
-----END CERTIFICATE-----
|
42
|
+
date: 2022-06-11 00:00:00.000000000 Z
|
12
43
|
dependencies:
|
13
44
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
45
|
+
name: async-rest
|
15
46
|
requirement: !ruby/object:Gem::Requirement
|
16
47
|
requirements:
|
17
|
-
- - "
|
48
|
+
- - ">="
|
18
49
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
50
|
+
version: '0'
|
20
51
|
type: :runtime
|
21
52
|
prerelease: false
|
22
53
|
version_requirements: !ruby/object:Gem::Requirement
|
23
54
|
requirements:
|
24
|
-
- - "
|
55
|
+
- - ">="
|
25
56
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
57
|
+
version: '0'
|
27
58
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
59
|
+
name: console
|
29
60
|
requirement: !ruby/object:Gem::Requirement
|
30
61
|
requirements:
|
31
|
-
- - "
|
62
|
+
- - "~>"
|
32
63
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
64
|
+
version: '1.0'
|
34
65
|
type: :runtime
|
35
66
|
prerelease: false
|
36
67
|
version_requirements: !ruby/object:Gem::Requirement
|
37
68
|
requirements:
|
38
|
-
- - "
|
69
|
+
- - "~>"
|
39
70
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
71
|
+
version: '1.0'
|
41
72
|
- !ruby/object:Gem::Dependency
|
42
73
|
name: msgpack
|
43
74
|
requirement: !ruby/object:Gem::Requirement
|
44
75
|
requirements:
|
45
|
-
- - "
|
76
|
+
- - "~>"
|
46
77
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
78
|
+
version: '1.0'
|
48
79
|
type: :runtime
|
49
80
|
prerelease: false
|
50
81
|
version_requirements: !ruby/object:Gem::Requirement
|
51
82
|
requirements:
|
52
|
-
- - "
|
83
|
+
- - "~>"
|
53
84
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
85
|
+
version: '1.0'
|
55
86
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
87
|
+
name: parser
|
57
88
|
requirement: !ruby/object:Gem::Requirement
|
58
89
|
requirements:
|
59
90
|
- - ">="
|
@@ -66,20 +97,6 @@ dependencies:
|
|
66
97
|
- - ">="
|
67
98
|
- !ruby/object:Gem::Version
|
68
99
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: trenni
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.6'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.6'
|
83
100
|
- !ruby/object:Gem::Dependency
|
84
101
|
name: bundler
|
85
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +112,19 @@ dependencies:
|
|
95
112
|
- !ruby/object:Gem::Version
|
96
113
|
version: '0'
|
97
114
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
115
|
+
name: minitest
|
99
116
|
requirement: !ruby/object:Gem::Requirement
|
100
117
|
requirements:
|
101
118
|
- - "~>"
|
102
119
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
120
|
+
version: '5.0'
|
104
121
|
type: :development
|
105
122
|
prerelease: false
|
106
123
|
version_requirements: !ruby/object:Gem::Requirement
|
107
124
|
requirements:
|
108
125
|
- - "~>"
|
109
126
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
127
|
+
version: '5.0'
|
111
128
|
- !ruby/object:Gem::Dependency
|
112
129
|
name: rspec
|
113
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,35 +140,30 @@ dependencies:
|
|
123
140
|
- !ruby/object:Gem::Version
|
124
141
|
version: '3.6'
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
143
|
+
name: trenni
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
128
145
|
requirements:
|
129
|
-
- - "
|
146
|
+
- - "~>"
|
130
147
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
148
|
+
version: '3.6'
|
132
149
|
type: :development
|
133
150
|
prerelease: false
|
134
151
|
version_requirements: !ruby/object:Gem::Requirement
|
135
152
|
requirements:
|
136
|
-
- - "
|
153
|
+
- - "~>"
|
137
154
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
139
|
-
description:
|
155
|
+
version: '3.6'
|
156
|
+
description:
|
140
157
|
email:
|
141
|
-
- samuel.williams@oriontransfer.co.nz
|
142
158
|
executables: []
|
143
159
|
extensions: []
|
144
160
|
extra_rdoc_files: []
|
145
161
|
files:
|
146
|
-
- ".
|
147
|
-
- ".
|
148
|
-
-
|
149
|
-
- ".travis.yml"
|
150
|
-
- Gemfile
|
151
|
-
- README.md
|
152
|
-
- Rakefile
|
153
|
-
- covered.gemspec
|
162
|
+
- ".github/workflows/development.yml"
|
163
|
+
- ".github/workflows/documentation.yml"
|
164
|
+
- examples/coverage/.DS_Store
|
154
165
|
- examples/coverage/covered.rb
|
166
|
+
- examples/coverage/erb/.covered.db
|
155
167
|
- examples/coverage/erb/coverage.rb
|
156
168
|
- examples/coverage/erb/template.erb
|
157
169
|
- examples/coverage/parser.rb
|
@@ -163,6 +175,7 @@ files:
|
|
163
175
|
- lib/covered/coverage.rb
|
164
176
|
- lib/covered/coveralls.rb
|
165
177
|
- lib/covered/files.rb
|
178
|
+
- lib/covered/markdown_summary.rb
|
166
179
|
- lib/covered/minitest.rb
|
167
180
|
- lib/covered/persist.rb
|
168
181
|
- lib/covered/policy.rb
|
@@ -173,11 +186,14 @@ files:
|
|
173
186
|
- lib/covered/summary.rb
|
174
187
|
- lib/covered/version.rb
|
175
188
|
- lib/covered/wrapper.rb
|
189
|
+
- media/.DS_Store
|
176
190
|
- media/example.png
|
177
191
|
homepage: https://github.com/ioquatix/covered
|
178
|
-
licenses:
|
179
|
-
|
180
|
-
|
192
|
+
licenses:
|
193
|
+
- MIT
|
194
|
+
metadata:
|
195
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
196
|
+
post_install_message:
|
181
197
|
rdoc_options: []
|
182
198
|
require_paths:
|
183
199
|
- lib
|
@@ -192,8 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
208
|
- !ruby/object:Gem::Version
|
193
209
|
version: '0'
|
194
210
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
-
signing_key:
|
211
|
+
rubygems_version: 3.1.6
|
212
|
+
signing_key:
|
197
213
|
specification_version: 4
|
198
214
|
summary: A modern approach to code coverage.
|
199
215
|
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: xenial
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
matrix:
|
6
|
-
include:
|
7
|
-
- rvm: 2.3
|
8
|
-
- rvm: 2.4
|
9
|
-
- rvm: 2.5
|
10
|
-
- rvm: 2.6
|
11
|
-
- rvm: 2.6
|
12
|
-
env: COVERAGE=PartialSummary,Coveralls
|
13
|
-
- rvm: ruby-head
|
14
|
-
- rvm: jruby-head
|
15
|
-
- rvm: truffleruby
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: jruby-head
|
19
|
-
- rvm: truffleruby
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
# Covered [![Build Status](https://travis-ci.com/ioquatix/covered.svg)](https://travis-ci.com/ioquatix/covered) [![Coverage Status](https://coveralls.io/repos/github/ioquatix/covered/badge.svg)](https://coveralls.io/github/ioquatix/covered)
|
2
|
-
|
3
|
-
Covered uses modern Ruby features to generate comprehensive coverage, including support for templates which are compiled into Ruby.
|
4
|
-
|
5
|
-
- Incremental coverage - if you run your full test suite, and the run a subset, it will still report the correct coverage - so you can incrementally work on improving coverage.
|
6
|
-
- Integration with RSpec, Minitest, Travis & Coveralls - no need to configure anything - out of the box support for these platforms.
|
7
|
-
- Supports coverage of views - templates compiled to Ruby code can be tracked for coverage reporting.
|
8
|
-
|
9
|
-
![Screenshot](media/example.png)
|
10
|
-
|
11
|
-
## Motivation
|
12
|
-
|
13
|
-
Existing Ruby coverage tools are unable to handle `eval`ed code. This is because the `coverage` module built into Ruby doesn't expose the necessary hooks to capture it. Using the [parser] gem allows us to do our own source code analysis to compute executable lines, thus making it possible to compute coverage for "templates".
|
14
|
-
|
15
|
-
It's still tricky to do it correctly, but it is feasible now to compute coverage of web application "views" by using this technique. This gem is an exploration to see what is possible.
|
16
|
-
|
17
|
-
[parser]: https://github.com/whitequark/parser
|
18
|
-
|
19
|
-
## Installation
|
20
|
-
|
21
|
-
Add this line to your application's `Gemfile`:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
gem 'covered'
|
25
|
-
```
|
26
|
-
|
27
|
-
### RSpec Integration
|
28
|
-
|
29
|
-
In your `spec/spec_helper.rb` add the following before loading any other code:
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
require 'covered/rspec'
|
33
|
-
```
|
34
|
-
|
35
|
-
Ensure that you have a `.rspec` file with `--require spec_helper`:
|
36
|
-
|
37
|
-
```
|
38
|
-
--require spec_helper
|
39
|
-
--format documentation
|
40
|
-
--warnings
|
41
|
-
```
|
42
|
-
|
43
|
-
### Minitest Integration
|
44
|
-
|
45
|
-
In your `test/test_helper.rb` add the following before loading any other code:
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
require 'covered/minitest'
|
49
|
-
require 'minitest/autorun'
|
50
|
-
```
|
51
|
-
|
52
|
-
In your test files, e.g. `test/dummy_test.rb` add the following at the top:
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
require_relative 'test_helper'
|
56
|
-
```
|
57
|
-
|
58
|
-
## Usage
|
59
|
-
|
60
|
-
When running `rspec`, you can specify the kind of coverage analysis you would like:
|
61
|
-
|
62
|
-
```
|
63
|
-
COVERAGE=Summary rspec
|
64
|
-
```
|
65
|
-
|
66
|
-
If no `COVERAGE` is specified, coverage tracking will be disabled.
|
67
|
-
|
68
|
-
### Partial Summary
|
69
|
-
|
70
|
-
```
|
71
|
-
COVERAGE=PartialSummary rspec
|
72
|
-
```
|
73
|
-
|
74
|
-
This report only shows snippets of source code with incomplete coverage.
|
75
|
-
|
76
|
-
### Brief Summary
|
77
|
-
|
78
|
-
```
|
79
|
-
COVERAGE=BriefSummary rspec
|
80
|
-
```
|
81
|
-
|
82
|
-
This report lists several files in order of least coverage.l
|
83
|
-
|
84
|
-
### Coveralls/Travis Integration
|
85
|
-
|
86
|
-
You can send coverage information to [Coveralls](https://coveralls.io) by editing your `.travis.yml` file:
|
87
|
-
|
88
|
-
```
|
89
|
-
matrix:
|
90
|
-
include:
|
91
|
-
- rvm: 2.6
|
92
|
-
env: COVERAGE=PartialSummary,Coveralls
|
93
|
-
```
|
94
|
-
|
95
|
-
This will print out a brief report and then upload the coverage data. This integrates transparently with Travis.
|
96
|
-
|
97
|
-
## See Also
|
98
|
-
|
99
|
-
- [coveralls-ruby](https://github.com/lemurheavy/coveralls-ruby) – the official Coveralls implementation for Ruby.
|
100
|
-
- [simplecov](https://github.com/colszowka/simplecov) – one of the original coverage implementations for Ruby, uses the built-in `coverage` library.
|
101
|
-
|
102
|
-
## Contributing
|
103
|
-
|
104
|
-
1. Fork it
|
105
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
106
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
107
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
108
|
-
5. Create new Pull Request
|
109
|
-
|
110
|
-
## License
|
111
|
-
|
112
|
-
Released under the MIT license.
|
113
|
-
|
114
|
-
Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
115
|
-
|
116
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
117
|
-
of this software and associated documentation files (the "Software"), to deal
|
118
|
-
in the Software without restriction, including without limitation the rights
|
119
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
120
|
-
copies of the Software, and to permit persons to whom the Software is
|
121
|
-
furnished to do so, subject to the following conditions:
|
122
|
-
|
123
|
-
The above copyright notice and this permission notice shall be included in
|
124
|
-
all copies or substantial portions of the Software.
|
125
|
-
|
126
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
127
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
128
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
129
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
130
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
131
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
132
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
# For RSpec
|
5
|
-
RSpec::Core::RakeTask.new(:spec)
|
6
|
-
|
7
|
-
# For Minitest
|
8
|
-
require 'rake/testtask'
|
9
|
-
Rake::TestTask.new(:test) do |task|
|
10
|
-
task.pattern = "test/*_test.rb"
|
11
|
-
end
|
12
|
-
|
13
|
-
task :default => :spec
|
data/covered.gemspec
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative "lib/covered/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "covered"
|
6
|
-
spec.version = Covered::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "A modern approach to code coverage."
|
11
|
-
spec.homepage = "https://github.com/ioquatix/covered"
|
12
|
-
|
13
|
-
# Specify which files should be added to the gem when it is released.
|
14
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
15
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
-
end
|
17
|
-
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency "event", "~> 1.5"
|
22
|
-
spec.add_dependency "parser"
|
23
|
-
spec.add_dependency "msgpack"
|
24
|
-
|
25
|
-
spec.add_dependency "async-rest"
|
26
|
-
|
27
|
-
spec.add_development_dependency "trenni", "~> 3.6"
|
28
|
-
|
29
|
-
spec.add_development_dependency "bundler"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
-
spec.add_development_dependency "rspec", "~> 3.6"
|
32
|
-
spec.add_development_dependency "minitest"
|
33
|
-
end
|