covered 0.16.2 → 0.16.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80e616e80e33e55aa999b041dd1fa8c8bc4c6681bf3ed9634d058eb844693332
4
- data.tar.gz: ee659443a9957432bb3a9f27d81cd302fb80780205282a9cf45796de57885b61
3
+ metadata.gz: 866c111f17bb03b47aed6e71a6439f3847e08d0352ba82eac169269d072820c7
4
+ data.tar.gz: a16bb2c36bcf50f0d26ce4576e741e512a144725a3c2b0f3c8724476fb64c7d4
5
5
  SHA512:
6
- metadata.gz: 5e7b2019674c223768d2cce4f7a24f5c654dcfaccf44a0ffc8909ab159eea9aa653db7367274f96aae02e41edd3e1d6fbeff66d3f022e7a177a04a11dfd66412
7
- data.tar.gz: 11f142830471687a135d541b345fc423b385c940204c49db2d94f99a4cf575511cfa6738bc6db2f9bab23797d598a12145fe21d371b4f1b9a395382ec69087d9
6
+ metadata.gz: 22f7f294cf342ae163dd9f1ba8f3f812e193f5f233592c274f84bd1d18e99b5ca0041d5391b88a6df3f21032779e5ebcc399131ab03bb295988c9a178f3d26fa
7
+ data.tar.gz: 35d94a1e76a3640a22ad794c47c41a98562b1343964b5637d477b390875a4997cf054345470e7c2076f81fd182a344793f24bc2ebe67eca190c0737ff4274ef4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -18,7 +18,7 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative 'policy'
21
+ require_relative 'config'
22
22
 
23
23
  require 'minitest'
24
24
 
@@ -71,10 +71,14 @@ module Covered
71
71
  EXECUTABLE = {
72
72
  send: true,
73
73
  yield: true,
74
- return: true,
74
+ # Line trace point is not triggered for return statements.
75
+ # return: true,
75
76
  def: true,
76
77
  if: true,
77
- lvasgn: true, ivasgn: true, cvasgn: true, gvasgn: true,
78
+ lvasgn: true,
79
+ ivasgn: true,
80
+ cvasgn: true,
81
+ gvasgn: true,
78
82
  match_pattern: true
79
83
  }
80
84
 
@@ -82,8 +86,14 @@ module Covered
82
86
  EXECUTABLE[node.type]
83
87
  end
84
88
 
89
+ IGNORE = {
90
+ arg: true,
91
+ # Ruby doesn't appear to execute rescue lines.
92
+ rescue: true
93
+ }
94
+
85
95
  def ignore?(node)
86
- node.nil? or node.type == :arg
96
+ node.nil? || IGNORE[node.type]
87
97
  end
88
98
 
89
99
  def expand(node, coverage, level = 0)
@@ -91,16 +101,19 @@ module Covered
91
101
  if ignore?(node)
92
102
  # coverage.annotate(node.location.line, "ignoring #{node.type}")
93
103
  else
94
- if executable?(node)
104
+ if node.type == :send
105
+ # We want to mark the line which has the method on it:
106
+ coverage.counts[node.location.selector.line] ||= 0
107
+ elsif executable?(node)
95
108
  # coverage.annotate(node.location.line, "executable #{node.type}")
96
109
  coverage.counts[node.location.line] ||= 0
97
- elsif node.location
98
- # coverage.annotate(node.location.line, "not executable #{node.type}") rescue nil
110
+ # elsif location = node.location
111
+ # coverage.annotate(location.line, "not executable #{node.type}") rescue nil
99
112
  end
100
113
 
101
- if node.type == :send
102
- # coverage.annotate(node.location.line, "ignoring #{node.type} children")
103
- end
114
+ # if node.type == :send
115
+ # coverage.annotate(node.location.line, "ignoring #{node.type} children")
116
+ # end
104
117
 
105
118
  expand(node.children, coverage, level + 1)
106
119
  end
@@ -0,0 +1,43 @@
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_relative 'config'
22
+
23
+ module Covered
24
+ module Sus
25
+ def initialize(...)
26
+ super
27
+
28
+ @covered = Covered::Config.load(root: self.root)
29
+ if @covered.record?
30
+ @covered.enable
31
+ end
32
+ end
33
+
34
+ def after_tests(assertions)
35
+ super(assertions)
36
+
37
+ if @covered.record?
38
+ @covered.disable
39
+ @covered.call(self.output.io)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.16.2"
22
+ VERSION = "0.16.5"
23
23
  end
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.2
4
+ version: 0.16.5
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
- MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
17
- ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9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Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
42
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
43
  -----END CERTIFICATE-----
42
- date: 2022-06-15 00:00:00.000000000 Z
44
+ date: 2022-08-24 00:00:00.000000000 Z
43
45
  dependencies:
44
46
  - !ruby/object:Gem::Dependency
45
47
  name: async-rest
@@ -165,7 +167,6 @@ files:
165
167
  - lib/covered/capture.rb
166
168
  - lib/covered/config.rb
167
169
  - lib/covered/coverage.rb
168
- - lib/covered/coveralls.rb
169
170
  - lib/covered/files.rb
170
171
  - lib/covered/markdown_summary.rb
171
172
  - lib/covered/minitest.rb
@@ -175,6 +176,7 @@ files:
175
176
  - lib/covered/source.rb
176
177
  - lib/covered/statistics.rb
177
178
  - lib/covered/summary.rb
179
+ - lib/covered/sus.rb
178
180
  - lib/covered/version.rb
179
181
  - lib/covered/wrapper.rb
180
182
  homepage: https://github.com/ioquatix/covered
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  - !ruby/object:Gem::Version
198
200
  version: '0'
199
201
  requirements: []
200
- rubygems_version: 3.1.6
202
+ rubygems_version: 3.3.7
201
203
  signing_key:
202
204
  specification_version: 4
203
205
  summary: A modern approach to code coverage.
metadata.gz.sig CHANGED
Binary file
@@ -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