covered 0.16.4 → 0.16.7
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/bake/covered/debug.rb +32 -0
- data/lib/covered/files.rb +1 -1
- data/lib/covered/minitest.rb +1 -1
- data/lib/covered/policy.rb +6 -2
- data/lib/covered/source.rb +24 -16
- data/lib/covered/sus.rb +48 -0
- data/lib/covered/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +34 -31
- metadata.gz.sig +0 -0
- data/lib/covered/coveralls.rb +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436b85ae993e96487c73e819e1e1e0757e7df176cd149a2955ba91a5ceee4783
|
4
|
+
data.tar.gz: d8cceb28e197c84eb2ea0ceb9408d767245aea73a5b869b323de204a97849ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb36d29bf09e34801c9577ac71608588afb22555aaca848d704bebe98ced5bcd9dda4de0b040410c790851f8eeb6d73c485b469b648d944d9825671222bb0262
|
7
|
+
data.tar.gz: 44ab811435ed81468be3da0cfb2100a15d62f0e934e19708d4cf898cd7bf0b7ff1655c069e11f5b2a65e05e07e454ba6a3f9b0b597295cf4b7156fcbf4c8013d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
def initialize(context)
|
3
|
+
super
|
4
|
+
|
5
|
+
require_relative '../../lib/covered'
|
6
|
+
end
|
7
|
+
|
8
|
+
# Debug the coverage of a file. Show which lines should be executable.
|
9
|
+
#
|
10
|
+
# @parameter paths [Array(String)] The paths to parse.
|
11
|
+
# @parameter execute [Boolean] Whether to execute the code.
|
12
|
+
def parse(paths: [], execute: false)
|
13
|
+
files = output = Covered::Files.new
|
14
|
+
output = Covered::Source.new(output)
|
15
|
+
|
16
|
+
paths.each do |path|
|
17
|
+
output.mark(path, 0, 0)
|
18
|
+
end
|
19
|
+
|
20
|
+
if execute
|
21
|
+
capture = Covered::Capture.new(output)
|
22
|
+
capture.enable
|
23
|
+
paths.each do |path|
|
24
|
+
load path
|
25
|
+
end
|
26
|
+
capture.disable
|
27
|
+
|
28
|
+
files.paths = files.paths.slice(*paths)
|
29
|
+
end
|
30
|
+
|
31
|
+
Covered::Summary.new.call(output, $stderr)
|
32
|
+
end
|
data/lib/covered/files.rb
CHANGED
data/lib/covered/minitest.rb
CHANGED
data/lib/covered/policy.rb
CHANGED
@@ -117,8 +117,12 @@ module Covered
|
|
117
117
|
|
118
118
|
private
|
119
119
|
|
120
|
-
def snake_case(
|
121
|
-
|
120
|
+
def snake_case(string)
|
121
|
+
return string.gsub(/::/, '/').
|
122
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
123
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
124
|
+
tr("-", "_").
|
125
|
+
downcase
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
data/lib/covered/source.rb
CHANGED
@@ -79,7 +79,7 @@ module Covered
|
|
79
79
|
ivasgn: true,
|
80
80
|
cvasgn: true,
|
81
81
|
gvasgn: true,
|
82
|
-
match_pattern: true
|
82
|
+
match_pattern: true,
|
83
83
|
}
|
84
84
|
|
85
85
|
def executable?(node)
|
@@ -88,34 +88,42 @@ module Covered
|
|
88
88
|
|
89
89
|
IGNORE = {
|
90
90
|
arg: true,
|
91
|
-
# Ruby doesn't appear to execute rescue lines.
|
92
|
-
rescue: true
|
93
91
|
}
|
94
92
|
|
95
93
|
def ignore?(node)
|
96
94
|
node.nil? || IGNORE[node.type]
|
97
95
|
end
|
98
96
|
|
97
|
+
IGNORE_CHILDREN = {
|
98
|
+
hash: true,
|
99
|
+
array: true,
|
100
|
+
}
|
101
|
+
|
102
|
+
def ignore_children?(node)
|
103
|
+
IGNORE_CHILDREN[node.type]
|
104
|
+
end
|
105
|
+
|
99
106
|
def expand(node, coverage, level = 0)
|
100
107
|
if node.is_a? Parser::AST::Node
|
101
108
|
if ignore?(node)
|
102
109
|
# coverage.annotate(node.location.line, "ignoring #{node.type}")
|
103
|
-
|
104
|
-
if node.
|
105
|
-
|
106
|
-
coverage.counts[node.location.selector.line] ||= 0
|
107
|
-
elsif executable?(node)
|
108
|
-
# coverage.annotate(node.location.line, "executable #{node.type}")
|
109
|
-
coverage.counts[node.location.line] ||= 0
|
110
|
-
# elsif location = node.location
|
111
|
-
# coverage.annotate(location.line, "not executable #{node.type}") rescue nil
|
110
|
+
elsif node.type == :begin
|
111
|
+
if last_child = node.children&.last
|
112
|
+
coverage.counts[last_child.location.line] ||= 0
|
112
113
|
end
|
113
114
|
|
114
|
-
# if node.type == :send
|
115
|
-
# coverage.annotate(node.location.line, "ignoring #{node.type} children")
|
116
|
-
# end
|
117
|
-
|
118
115
|
expand(node.children, coverage, level + 1)
|
116
|
+
elsif node.type == :send
|
117
|
+
coverage.counts[node.location.selector.line] ||= 0
|
118
|
+
elsif executable?(node)
|
119
|
+
# coverage.annotate(node.location.line, "executable #{node.type}")
|
120
|
+
coverage.counts[node.location.line] ||= 0
|
121
|
+
else
|
122
|
+
if ignore_children?(node)
|
123
|
+
# coverage.annotate(node.location.line, "ignoring #{node.type} children")
|
124
|
+
else
|
125
|
+
expand(node.children, coverage, level + 1)
|
126
|
+
end
|
119
127
|
end
|
120
128
|
elsif node.is_a? Array
|
121
129
|
node.each do |child|
|
data/lib/covered/sus.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright, 2019, 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
|
+
module Covered
|
22
|
+
module Sus
|
23
|
+
def initialize(...)
|
24
|
+
super
|
25
|
+
|
26
|
+
# Defer loading the coverage configuration unless we are actually running with coverage enabled to avoid performance cost/overhead.
|
27
|
+
if ENV['COVERAGE']
|
28
|
+
require_relative 'config'
|
29
|
+
|
30
|
+
@covered = Covered::Config.load(root: self.root)
|
31
|
+
if @covered.record?
|
32
|
+
@covered.enable
|
33
|
+
end
|
34
|
+
else
|
35
|
+
@covered = nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def after_tests(assertions)
|
40
|
+
super(assertions)
|
41
|
+
|
42
|
+
if @covered&.record?
|
43
|
+
@covered.disable
|
44
|
+
@covered.call(self.output.io)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/covered/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- Adam Daniels
|
8
9
|
- Cyril Roelandt
|
9
10
|
- Shannon Skipper
|
10
11
|
- chocolateboy
|
@@ -13,33 +14,34 @@ bindir: bin
|
|
13
14
|
cert_chain:
|
14
15
|
- |
|
15
16
|
-----BEGIN CERTIFICATE-----
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
17
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
18
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
19
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
20
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
21
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
22
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
23
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
24
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
25
|
+
sGkaOY0eqsQ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qEUe+yo6DKIT3MtGE2+CP
|
40
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
41
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
41
43
|
-----END CERTIFICATE-----
|
42
|
-
date: 2022-
|
44
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
43
45
|
dependencies:
|
44
46
|
- !ruby/object:Gem::Dependency
|
45
47
|
name: async-rest
|
@@ -112,19 +114,19 @@ dependencies:
|
|
112
114
|
- !ruby/object:Gem::Version
|
113
115
|
version: '0'
|
114
116
|
- !ruby/object:Gem::Dependency
|
115
|
-
name:
|
117
|
+
name: sus
|
116
118
|
requirement: !ruby/object:Gem::Requirement
|
117
119
|
requirements:
|
118
120
|
- - "~>"
|
119
121
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
122
|
+
version: '0.12'
|
121
123
|
type: :development
|
122
124
|
prerelease: false
|
123
125
|
version_requirements: !ruby/object:Gem::Requirement
|
124
126
|
requirements:
|
125
127
|
- - "~>"
|
126
128
|
- !ruby/object:Gem::Version
|
127
|
-
version: '
|
129
|
+
version: '0.12'
|
128
130
|
- !ruby/object:Gem::Dependency
|
129
131
|
name: rspec
|
130
132
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,13 +161,13 @@ executables: []
|
|
159
161
|
extensions: []
|
160
162
|
extra_rdoc_files: []
|
161
163
|
files:
|
164
|
+
- bake/covered/debug.rb
|
162
165
|
- bake/covered/validate.rb
|
163
166
|
- lib/covered.rb
|
164
167
|
- lib/covered/cache.rb
|
165
168
|
- lib/covered/capture.rb
|
166
169
|
- lib/covered/config.rb
|
167
170
|
- lib/covered/coverage.rb
|
168
|
-
- lib/covered/coveralls.rb
|
169
171
|
- lib/covered/files.rb
|
170
172
|
- lib/covered/markdown_summary.rb
|
171
173
|
- lib/covered/minitest.rb
|
@@ -175,6 +177,7 @@ files:
|
|
175
177
|
- lib/covered/source.rb
|
176
178
|
- lib/covered/statistics.rb
|
177
179
|
- lib/covered/summary.rb
|
180
|
+
- lib/covered/sus.rb
|
178
181
|
- lib/covered/version.rb
|
179
182
|
- lib/covered/wrapper.rb
|
180
183
|
homepage: https://github.com/ioquatix/covered
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/covered/coveralls.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
# Copyright, 2019, 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 'async'
|
22
|
-
require 'async/rest/representation'
|
23
|
-
|
24
|
-
require 'securerandom'
|
25
|
-
|
26
|
-
module Covered
|
27
|
-
class Coveralls
|
28
|
-
class Wrapper < Async::REST::Wrapper::JSON
|
29
|
-
def prepare_request(payload, headers)
|
30
|
-
headers['accept'] ||= @content_type
|
31
|
-
boundary = SecureRandom.hex(32)
|
32
|
-
|
33
|
-
# This is a pretty messed up API. Don't change anything below. It's fragile.
|
34
|
-
if payload
|
35
|
-
headers['content-type'] = "multipart/form-data, boundary=#{boundary}"
|
36
|
-
|
37
|
-
Async::HTTP::Body::Buffered.new([
|
38
|
-
"--#{boundary}\r\n",
|
39
|
-
"Content-Disposition: form-data; name=\"json_file\"; filename=\"body.json\"\r\n",
|
40
|
-
"Content-Type: text/plain\r\n\r\n",
|
41
|
-
::JSON.dump(payload),
|
42
|
-
"\r\n--#{boundary}--\r\n",
|
43
|
-
])
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
URL = "https://coveralls.io/api/v1/jobs"
|
49
|
-
|
50
|
-
def initialize(token: nil, service: nil, job_id: nil)
|
51
|
-
@token = token
|
52
|
-
@service = service
|
53
|
-
@job_id = job_id
|
54
|
-
end
|
55
|
-
|
56
|
-
def detect_service
|
57
|
-
if token = ENV.fetch('COVERALLS_REPO_TOKEN', @token)
|
58
|
-
return {"repo_token" => token}
|
59
|
-
elsif @service && @job_id
|
60
|
-
return {"service_name" => @service, "service_job_id" => @job_id}
|
61
|
-
elsif job_id = ENV['TRAVIS_JOB_ID']
|
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}
|
65
|
-
else
|
66
|
-
warn "#{self.class} can't detect service! Please specify COVERALLS_REPO_TOKEN."
|
67
|
-
end
|
68
|
-
|
69
|
-
return nil
|
70
|
-
end
|
71
|
-
|
72
|
-
def call(wrapper, output = $stderr)
|
73
|
-
if body = detect_service
|
74
|
-
output.puts "Submitting data using #{body.inspect}..."
|
75
|
-
|
76
|
-
source_files = []
|
77
|
-
|
78
|
-
wrapper.each do |coverage|
|
79
|
-
path = wrapper.relative_path(coverage.path)
|
80
|
-
|
81
|
-
source_files << {
|
82
|
-
name: path,
|
83
|
-
source_digest: Digest::MD5.hexdigest(coverage.read),
|
84
|
-
coverage: coverage.to_a,
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
body[:source_files] = source_files
|
89
|
-
|
90
|
-
Async do
|
91
|
-
representation = Async::REST::Representation.new(
|
92
|
-
Async::REST::Resource.for(URL),
|
93
|
-
wrapper: Wrapper.new
|
94
|
-
)
|
95
|
-
|
96
|
-
begin
|
97
|
-
response = representation.post(body)
|
98
|
-
|
99
|
-
output.puts "Got response: #{response.read}"
|
100
|
-
|
101
|
-
ensure
|
102
|
-
representation.close
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|