simplecov 0.17.1 → 0.18.0.beta1

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.
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SimpleCov
4
+ class SourceFile
5
+ #
6
+ # Representing single branch that has been detected in coverage report.
7
+ # Give us support methods that handle needed calculations.
8
+ class Branch
9
+ attr_reader :start_line, :end_line, :coverage
10
+
11
+ # rubocop:disable Metrics/ParameterLists
12
+ def initialize(start_line:, end_line:, coverage:, inline:, positive:)
13
+ @start_line = start_line
14
+ @end_line = end_line
15
+ @coverage = coverage
16
+ @inline = inline
17
+ @positive = positive
18
+ @skipped = false
19
+ end
20
+ # rubocop:enable Metrics/ParameterLists
21
+
22
+ def inline?
23
+ @inline
24
+ end
25
+
26
+ def positive?
27
+ @positive
28
+ end
29
+
30
+ #
31
+ # Branch is negative
32
+ #
33
+ # @return [Boolean]
34
+ #
35
+ def negative?
36
+ !positive?
37
+ end
38
+
39
+ #
40
+ # Return true if there is relevant count defined > 0
41
+ #
42
+ # @return [Boolean]
43
+ #
44
+ def covered?
45
+ !skipped? && coverage.positive?
46
+ end
47
+
48
+ #
49
+ # Check if branche missed or not
50
+ #
51
+ # @return [Boolean]
52
+ #
53
+ def missed?
54
+ !skipped? && coverage.zero?
55
+ end
56
+
57
+ #
58
+ # Return the sign depends on branch is positive or negative
59
+ #
60
+ # @return [String]
61
+ #
62
+ def badge
63
+ positive? ? "+" : "-"
64
+ end
65
+
66
+ # The line on which we want to report the coverage
67
+ #
68
+ # Usually we choose the line above the start of the branch (so that it shows up
69
+ # at if/else) because that
70
+ # * highlights the condition
71
+ # * makes it distinguishable if the first line of the branch is an inline branch
72
+ # (see the nested_branches fixture)
73
+ #
74
+ def report_line
75
+ if inline?
76
+ start_line
77
+ else
78
+ start_line - 1
79
+ end
80
+ end
81
+
82
+ # Flags the branch as skipped
83
+ def skipped!
84
+ @skipped = true
85
+ end
86
+
87
+ # Returns true if the branch was marked skipped by virtue of nocov comments.
88
+ def skipped?
89
+ @skipped
90
+ end
91
+
92
+ def overlaps_with?(line_range)
93
+ start_line <= line_range.end && end_line >= line_range.begin
94
+ end
95
+
96
+ #
97
+ # Return array with coverage count and badge
98
+ #
99
+ # @return [Array]
100
+ #
101
+ def report
102
+ [coverage, badge]
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SimpleCov
4
+ class SourceFile
5
+ # Representation of a single line in a source file including
6
+ # this specific line's source code, line_number and code coverage,
7
+ # with the coverage being either nil (coverage not applicable, e.g. comment
8
+ # line), 0 (line not covered) or >1 (the amount of times the line was
9
+ # executed)
10
+ class Line
11
+ # The source code for this line. Aliased as :source
12
+ attr_reader :src
13
+ # The line number in the source file. Aliased as :line, :number
14
+ attr_reader :line_number
15
+ # The coverage data for this line: either nil (never), 0 (missed) or >=1 (times covered)
16
+ attr_reader :coverage
17
+ # Whether this line was skipped
18
+ attr_reader :skipped
19
+
20
+ # Lets grab some fancy aliases, shall we?
21
+ alias source src
22
+ alias line line_number
23
+ alias number line_number
24
+
25
+ def initialize(src, line_number, coverage)
26
+ raise ArgumentError, "Only String accepted for source" unless src.is_a?(String)
27
+ raise ArgumentError, "Only Integer accepted for line_number" unless line_number.is_a?(Integer)
28
+ raise ArgumentError, "Only Integer and nil accepted for coverage" unless coverage.is_a?(Integer) || coverage.nil?
29
+
30
+ @src = src
31
+ @line_number = line_number
32
+ @coverage = coverage
33
+ @skipped = false
34
+ end
35
+
36
+ # Returns true if this is a line that should have been covered, but was not
37
+ def missed?
38
+ !never? && !skipped? && coverage.zero?
39
+ end
40
+
41
+ # Returns true if this is a line that has been covered
42
+ def covered?
43
+ !never? && !skipped? && coverage.positive?
44
+ end
45
+
46
+ # Returns true if this line is not relevant for coverage
47
+ def never?
48
+ !skipped? && coverage.nil?
49
+ end
50
+
51
+ # Flags this line as skipped
52
+ def skipped!
53
+ @skipped = true
54
+ end
55
+
56
+ # Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with
57
+ # # :nocov: comment lines.
58
+ def skipped?
59
+ !!skipped
60
+ end
61
+
62
+ # The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use
63
+ # as a css class in report generation
64
+ def status
65
+ return "skipped" if skipped?
66
+ return "never" if never?
67
+ return "missed" if missed?
68
+ return "covered" if covered?
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SimpleCov
4
+ #
5
+ # Selection the files that related to working scope directory of SimpleCov
6
+ #
7
+ module UselessResultsRemover
8
+ ROOT_REGX = /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/io.freeze
9
+
10
+ def self.call(coverage_result)
11
+ coverage_result.select do |path, _coverage|
12
+ path =~ ROOT_REGX
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleCov
4
- VERSION = "0.17.1".freeze
4
+ VERSION = "0.18.0.beta1"
5
5
  end
metadata CHANGED
@@ -1,49 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2020-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.8'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3'
33
- - !ruby/object:Gem::Dependency
34
- name: simplecov-html
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 0.10.0
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 0.10.0
47
13
  - !ruby/object:Gem::Dependency
48
14
  name: docile
49
15
  requirement: !ruby/object:Gem::Requirement
@@ -59,133 +25,21 @@ dependencies:
59
25
  - !ruby/object:Gem::Version
60
26
  version: '1.1'
61
27
  - !ruby/object:Gem::Dependency
62
- name: bundler
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: rake
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rspec
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- - !ruby/object:Gem::Dependency
104
- name: test-unit
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- - !ruby/object:Gem::Dependency
118
- name: cucumber
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "<"
122
- - !ruby/object:Gem::Version
123
- version: '3'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "<"
129
- - !ruby/object:Gem::Version
130
- version: '3'
131
- - !ruby/object:Gem::Dependency
132
- name: aruba
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: '0'
145
- - !ruby/object:Gem::Dependency
146
- name: capybara
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "<"
150
- - !ruby/object:Gem::Version
151
- version: '3'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "<"
157
- - !ruby/object:Gem::Version
158
- version: '3'
159
- - !ruby/object:Gem::Dependency
160
- name: phantomjs
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: '0'
173
- - !ruby/object:Gem::Dependency
174
- name: poltergeist
28
+ name: simplecov-html
175
29
  requirement: !ruby/object:Gem::Requirement
176
30
  requirements:
177
- - - ">="
31
+ - - "~>"
178
32
  - !ruby/object:Gem::Version
179
- version: '0'
180
- type: :development
33
+ version: 0.11.0.beta1
34
+ type: :runtime
181
35
  prerelease: false
182
36
  version_requirements: !ruby/object:Gem::Requirement
183
37
  requirements:
184
- - - ">="
38
+ - - "~>"
185
39
  - !ruby/object:Gem::Version
186
- version: '0'
187
- description: Code coverage for Ruby 1.9+ with a powerful configuration library and
188
- automatic merging of coverage across test suites
40
+ version: 0.11.0.beta1
41
+ description: Code coverage for Ruby with a powerful configuration library and automatic
42
+ merging of coverage across test suites
189
43
  email:
190
44
  - christoph at olszowka de
191
45
  executables: []
@@ -193,6 +47,7 @@ extensions: []
193
47
  extra_rdoc_files: []
194
48
  files:
195
49
  - CHANGELOG.md
50
+ - CODE_OF_CONDUCT.md
196
51
  - CONTRIBUTING.md
197
52
  - ISSUE_TEMPLATE.md
198
53
  - LICENSE
@@ -201,6 +56,11 @@ files:
201
56
  - doc/commercial-services.md
202
57
  - doc/editor-integration.md
203
58
  - lib/simplecov.rb
59
+ - lib/simplecov/combine.rb
60
+ - lib/simplecov/combine/branches_combiner.rb
61
+ - lib/simplecov/combine/files_combiner.rb
62
+ - lib/simplecov/combine/lines_combiner.rb
63
+ - lib/simplecov/combine/results_combiner.rb
204
64
  - lib/simplecov/command_guesser.rb
205
65
  - lib/simplecov/configuration.rb
206
66
  - lib/simplecov/defaults.rb
@@ -210,7 +70,6 @@ files:
210
70
  - lib/simplecov/formatter.rb
211
71
  - lib/simplecov/formatter/multi_formatter.rb
212
72
  - lib/simplecov/formatter/simple_formatter.rb
213
- - lib/simplecov/jruby_fix.rb
214
73
  - lib/simplecov/last_run.rb
215
74
  - lib/simplecov/lines_classifier.rb
216
75
  - lib/simplecov/load_global_config.rb
@@ -221,17 +80,24 @@ files:
221
80
  - lib/simplecov/profiles/rails.rb
222
81
  - lib/simplecov/profiles/root_filter.rb
223
82
  - lib/simplecov/profiles/test_frameworks.rb
224
- - lib/simplecov/railtie.rb
225
- - lib/simplecov/railties/tasks.rake
226
- - lib/simplecov/raw_coverage.rb
227
83
  - lib/simplecov/result.rb
84
+ - lib/simplecov/result_adapter.rb
228
85
  - lib/simplecov/result_merger.rb
86
+ - lib/simplecov/simulate_coverage.rb
229
87
  - lib/simplecov/source_file.rb
88
+ - lib/simplecov/source_file/branch.rb
89
+ - lib/simplecov/source_file/line.rb
90
+ - lib/simplecov/useless_results_remover.rb
230
91
  - lib/simplecov/version.rb
231
- homepage: http://github.com/colszowka/simplecov
92
+ homepage: https://github.com/colszowka/simplecov
232
93
  licenses:
233
94
  - MIT
234
- metadata: {}
95
+ metadata:
96
+ bug_tracker_uri: https://github.com/colszowka/simplecov/issues
97
+ changelog_uri: https://github.com/colszowka/simplecov/blob/master/CHANGELOG.md
98
+ documentation_uri: https://www.rubydoc.info/gems/simplecov/0.18.0.beta1
99
+ mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
100
+ source_code_uri: https://github.com/colszowka/simplecov/tree/v0.18.0.beta1
235
101
  post_install_message:
236
102
  rdoc_options: []
237
103
  require_paths:
@@ -240,16 +106,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
106
  requirements:
241
107
  - - ">="
242
108
  - !ruby/object:Gem::Version
243
- version: 1.8.7
109
+ version: 2.4.0
244
110
  required_rubygems_version: !ruby/object:Gem::Requirement
245
111
  requirements:
246
- - - ">="
112
+ - - ">"
247
113
  - !ruby/object:Gem::Version
248
- version: '0'
114
+ version: 1.3.1
249
115
  requirements: []
250
- rubygems_version: 3.0.6
116
+ rubygems_version: 3.1.2
251
117
  signing_key:
252
118
  specification_version: 4
253
- summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
254
- merging of coverage across test suites
119
+ summary: Code coverage for Ruby
255
120
  test_files: []