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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -1
- data/CODE_OF_CONDUCT.md +76 -0
- data/README.md +167 -63
- data/doc/alternate-formatters.md +5 -0
- data/lib/simplecov.rb +147 -65
- data/lib/simplecov/combine.rb +30 -0
- data/lib/simplecov/combine/branches_combiner.rb +32 -0
- data/lib/simplecov/combine/files_combiner.rb +25 -0
- data/lib/simplecov/combine/lines_combiner.rb +43 -0
- data/lib/simplecov/combine/results_combiner.rb +60 -0
- data/lib/simplecov/command_guesser.rb +6 -3
- data/lib/simplecov/configuration.rb +77 -8
- data/lib/simplecov/defaults.rb +1 -1
- data/lib/simplecov/file_list.rb +30 -3
- data/lib/simplecov/filter.rb +2 -1
- data/lib/simplecov/formatter/multi_formatter.rb +2 -2
- data/lib/simplecov/formatter/simple_formatter.rb +4 -4
- data/lib/simplecov/last_run.rb +2 -0
- data/lib/simplecov/lines_classifier.rb +2 -2
- data/lib/simplecov/profiles.rb +9 -7
- data/lib/simplecov/result.rb +21 -4
- data/lib/simplecov/result_adapter.rb +30 -0
- data/lib/simplecov/result_merger.rb +12 -11
- data/lib/simplecov/simulate_coverage.rb +29 -0
- data/lib/simplecov/source_file.rb +219 -109
- data/lib/simplecov/source_file/branch.rb +106 -0
- data/lib/simplecov/source_file/line.rb +72 -0
- data/lib/simplecov/useless_results_remover.rb +16 -0
- data/lib/simplecov/version.rb +1 -1
- metadata +33 -168
- data/lib/simplecov/jruby_fix.rb +0 -44
- data/lib/simplecov/railtie.rb +0 -9
- data/lib/simplecov/railties/tasks.rake +0 -13
- data/lib/simplecov/raw_coverage.rb +0 -41
data/lib/simplecov/jruby_fix.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if defined?(JRUBY_VERSION) && JRUBY_VERSION.to_f < 1.7
|
4
|
-
require "jruby"
|
5
|
-
java_import "org.jruby.ast.NodeType"
|
6
|
-
|
7
|
-
# Coverage for JRuby < 1.7.0 does not work correctly
|
8
|
-
#
|
9
|
-
# - does not distinguish lines that cannot be executed
|
10
|
-
# - does (partial) coverage for files loaded before `Coverage.start`.
|
11
|
-
# - does not expand a path like `lib/../spec` to `spec`.
|
12
|
-
#
|
13
|
-
# This monkey patches Coverage to address those issues
|
14
|
-
module Coverage
|
15
|
-
class << self
|
16
|
-
alias __broken_result__ result
|
17
|
-
|
18
|
-
def result # rubocop:disable Metrics/MethodLength
|
19
|
-
fixed = {}
|
20
|
-
__broken_result__.each do |path, executed_lines|
|
21
|
-
next unless File.file? path
|
22
|
-
|
23
|
-
covered_lines = executed_lines.dup
|
24
|
-
|
25
|
-
process = lambda do |node|
|
26
|
-
if node.node_type == NodeType::NEWLINENODE
|
27
|
-
pos = node.position
|
28
|
-
covered_lines[pos.line] ||= 0
|
29
|
-
end
|
30
|
-
node.child_nodes.each(&process)
|
31
|
-
end
|
32
|
-
|
33
|
-
process[JRuby.parse(File.read(path), path)]
|
34
|
-
|
35
|
-
if (first = covered_lines.detect { |x| x }) && first > 0
|
36
|
-
fixed[File.expand_path(path)] = covered_lines
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
fixed
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/lib/simplecov/railtie.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rake/testtask"
|
4
|
-
Rake::TestTask.new do |t|
|
5
|
-
t.name = "simplecov"
|
6
|
-
t.loader = :direct # uses require() which skips PWD in Ruby 1.9
|
7
|
-
t.libs.push "test", "spec", Dir.pwd
|
8
|
-
t.test_files = FileList["{test,spec}/**/*_{test,spec}.rb"]
|
9
|
-
t.ruby_opts.push "-r", "simplecov", "-e", "SimpleCov.start(:rails)".inspect
|
10
|
-
end
|
11
|
-
|
12
|
-
require "rake/clean"
|
13
|
-
CLOBBER.include "coverage"
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SimpleCov
|
4
|
-
module RawCoverage
|
5
|
-
module_function
|
6
|
-
|
7
|
-
# Merges multiple Coverage.result hashes
|
8
|
-
def merge_results(*results)
|
9
|
-
results.reduce({}) do |result, merged|
|
10
|
-
merge_resultsets(result, merged)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# Merges two Coverage.result hashes
|
15
|
-
def merge_resultsets(result1, result2)
|
16
|
-
(result1.keys | result2.keys).each_with_object({}) do |filename, merged|
|
17
|
-
file1 = result1[filename]
|
18
|
-
file2 = result2[filename]
|
19
|
-
merged[filename] = merge_file_coverage(file1, file2)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def merge_file_coverage(file1, file2)
|
24
|
-
return (file1 || file2).dup unless file1 && file2
|
25
|
-
|
26
|
-
file1.map.with_index do |count1, index|
|
27
|
-
count2 = file2[index]
|
28
|
-
merge_line_coverage(count1, count2)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def merge_line_coverage(count1, count2)
|
33
|
-
sum = count1.to_i + count2.to_i
|
34
|
-
if sum.zero? && (count1.nil? || count2.nil?)
|
35
|
-
nil
|
36
|
-
else
|
37
|
-
sum
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|