simplecov 0.18.3 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +227 -172
- data/CONTRIBUTING.md +3 -3
- data/ISSUE_TEMPLATE.md +1 -1
- data/README.md +84 -22
- data/doc/alternate-formatters.md +12 -2
- data/doc/commercial-services.md +5 -0
- data/lib/minitest/simplecov_plugin.rb +7 -3
- data/lib/simplecov.rb +118 -125
- data/lib/simplecov/configuration.rb +54 -3
- data/lib/simplecov/default_formatter.rb +20 -0
- data/lib/simplecov/defaults.rb +12 -10
- data/lib/simplecov/exit_codes.rb +5 -0
- data/lib/simplecov/exit_codes/exit_code_handling.rb +29 -0
- data/lib/simplecov/exit_codes/maximum_coverage_drop_check.rb +50 -0
- data/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb +38 -0
- data/lib/simplecov/exit_codes/minimum_overall_coverage_check.rb +53 -0
- data/lib/simplecov/filter.rb +7 -5
- data/lib/simplecov/formatter.rb +2 -2
- data/lib/simplecov/formatter/multi_formatter.rb +5 -7
- data/lib/simplecov/lines_classifier.rb +3 -3
- data/lib/simplecov/no_defaults.rb +1 -1
- data/lib/simplecov/process.rb +19 -0
- data/lib/simplecov/result.rb +14 -12
- data/lib/simplecov/result_merger.rb +2 -7
- data/lib/simplecov/source_file/line.rb +1 -1
- data/lib/simplecov/useless_results_remover.rb +5 -3
- data/lib/simplecov/version.rb +1 -1
- metadata +30 -8
data/lib/simplecov/result.rb
CHANGED
@@ -25,9 +25,11 @@ module SimpleCov
|
|
25
25
|
|
26
26
|
# Initialize a new SimpleCov::Result from given Coverage.result (a Hash of filenames each containing an array of
|
27
27
|
# coverage data)
|
28
|
-
def initialize(original_result)
|
28
|
+
def initialize(original_result, command_name: nil, created_at: nil)
|
29
29
|
result = adapt_result(original_result)
|
30
30
|
@original_result = result.freeze
|
31
|
+
@command_name = command_name
|
32
|
+
@created_at = created_at
|
31
33
|
@files = SimpleCov::FileList.new(result.map do |filename, coverage|
|
32
34
|
SimpleCov::SourceFile.new(filename, JSON.parse(JSON.dump(coverage))) if File.file?(filename)
|
33
35
|
end.compact.sort_by(&:filename))
|
@@ -70,15 +72,15 @@ module SimpleCov
|
|
70
72
|
}
|
71
73
|
end
|
72
74
|
|
75
|
+
def time_since_creation
|
76
|
+
Time.now - created_at
|
77
|
+
end
|
78
|
+
|
73
79
|
# Loads a SimpleCov::Result#to_hash dump
|
74
80
|
def self.from_hash(hash)
|
75
|
-
command_name, data
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
result.command_name = command_name
|
80
|
-
result.created_at = Time.at(data["timestamp"])
|
81
|
-
result
|
81
|
+
hash.map do |command_name, data|
|
82
|
+
new(data.fetch("coverage"), command_name: command_name, created_at: Time.at(data["timestamp"]))
|
83
|
+
end
|
82
84
|
end
|
83
85
|
|
84
86
|
private
|
@@ -86,7 +88,7 @@ module SimpleCov
|
|
86
88
|
# We changed the format of the raw result data in simplecov, as people are likely
|
87
89
|
# to have "old" resultsets lying around (but not too old so that they're still
|
88
90
|
# considered we can adapt them).
|
89
|
-
# See https://github.com/
|
91
|
+
# See https://github.com/simplecov-ruby/simplecov/pull/824#issuecomment-576049747
|
90
92
|
def adapt_result(result)
|
91
93
|
if pre_simplecov_0_18_result?(result)
|
92
94
|
adapt_pre_simplecov_0_18_result(result)
|
@@ -103,9 +105,9 @@ module SimpleCov
|
|
103
105
|
end
|
104
106
|
|
105
107
|
def adapt_pre_simplecov_0_18_result(result)
|
106
|
-
result.
|
107
|
-
|
108
|
-
end
|
108
|
+
result.transform_values do |line_coverage_data|
|
109
|
+
{"lines" => line_coverage_data}
|
110
|
+
end
|
109
111
|
end
|
110
112
|
|
111
113
|
def coverage
|
@@ -53,13 +53,8 @@ module SimpleCov
|
|
53
53
|
# All results that are above the SimpleCov.merge_timeout will be
|
54
54
|
# dropped. Returns an array of SimpleCov::Result items.
|
55
55
|
def results
|
56
|
-
results =
|
57
|
-
|
58
|
-
result = SimpleCov::Result.from_hash(command_name => data)
|
59
|
-
# Only add result if the timeout is above the configured threshold
|
60
|
-
results << result if (Time.now - result.created_at) < SimpleCov.merge_timeout
|
61
|
-
end
|
62
|
-
results
|
56
|
+
results = Result.from_hash(resultset)
|
57
|
+
results.select { |result| result.time_since_creation < SimpleCov.merge_timeout }
|
63
58
|
end
|
64
59
|
|
65
60
|
def merge_and_store(*results)
|
@@ -56,7 +56,7 @@ module SimpleCov
|
|
56
56
|
# Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with
|
57
57
|
# # :nocov: comment lines.
|
58
58
|
def skipped?
|
59
|
-
|
59
|
+
skipped
|
60
60
|
end
|
61
61
|
|
62
62
|
# The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use
|
@@ -5,12 +5,14 @@ module SimpleCov
|
|
5
5
|
# Select the files that related to working scope directory of SimpleCov
|
6
6
|
#
|
7
7
|
module UselessResultsRemover
|
8
|
-
ROOT_REGX = /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/io.freeze
|
9
|
-
|
10
8
|
def self.call(coverage_result)
|
11
9
|
coverage_result.select do |path, _coverage|
|
12
|
-
path =~
|
10
|
+
path =~ root_regx
|
13
11
|
end
|
14
12
|
end
|
13
|
+
|
14
|
+
def self.root_regx
|
15
|
+
@root_regx ||= /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/i.freeze
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
data/lib/simplecov/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
|
+
- Tobias Pfeiffer
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2020-
|
12
|
+
date: 2020-11-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: docile
|
@@ -38,10 +39,25 @@ dependencies:
|
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '0.11'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: simplecov_json_formatter
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.1'
|
41
56
|
description: Code coverage for Ruby with a powerful configuration library and automatic
|
42
57
|
merging of coverage across test suites
|
43
58
|
email:
|
44
59
|
- christoph at olszowka de
|
60
|
+
- pragtob@gmail.com
|
45
61
|
executables: []
|
46
62
|
extensions: []
|
47
63
|
extra_rdoc_files: []
|
@@ -65,8 +81,13 @@ files:
|
|
65
81
|
- lib/simplecov/command_guesser.rb
|
66
82
|
- lib/simplecov/configuration.rb
|
67
83
|
- lib/simplecov/coverage_statistics.rb
|
84
|
+
- lib/simplecov/default_formatter.rb
|
68
85
|
- lib/simplecov/defaults.rb
|
69
86
|
- lib/simplecov/exit_codes.rb
|
87
|
+
- lib/simplecov/exit_codes/exit_code_handling.rb
|
88
|
+
- lib/simplecov/exit_codes/maximum_coverage_drop_check.rb
|
89
|
+
- lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb
|
90
|
+
- lib/simplecov/exit_codes/minimum_overall_coverage_check.rb
|
70
91
|
- lib/simplecov/file_list.rb
|
71
92
|
- lib/simplecov/filter.rb
|
72
93
|
- lib/simplecov/formatter.rb
|
@@ -76,6 +97,7 @@ files:
|
|
76
97
|
- lib/simplecov/lines_classifier.rb
|
77
98
|
- lib/simplecov/load_global_config.rb
|
78
99
|
- lib/simplecov/no_defaults.rb
|
100
|
+
- lib/simplecov/process.rb
|
79
101
|
- lib/simplecov/profiles.rb
|
80
102
|
- lib/simplecov/profiles/bundler_filter.rb
|
81
103
|
- lib/simplecov/profiles/hidden_filter.rb
|
@@ -91,15 +113,15 @@ files:
|
|
91
113
|
- lib/simplecov/source_file/line.rb
|
92
114
|
- lib/simplecov/useless_results_remover.rb
|
93
115
|
- lib/simplecov/version.rb
|
94
|
-
homepage: https://github.com/
|
116
|
+
homepage: https://github.com/simplecov-ruby/simplecov
|
95
117
|
licenses:
|
96
118
|
- MIT
|
97
119
|
metadata:
|
98
|
-
bug_tracker_uri: https://github.com/
|
99
|
-
changelog_uri: https://github.com/
|
100
|
-
documentation_uri: https://www.rubydoc.info/gems/simplecov/0.
|
120
|
+
bug_tracker_uri: https://github.com/simplecov-ruby/simplecov/issues
|
121
|
+
changelog_uri: https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md
|
122
|
+
documentation_uri: https://www.rubydoc.info/gems/simplecov/0.20.0
|
101
123
|
mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
|
102
|
-
source_code_uri: https://github.com/
|
124
|
+
source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.20.0
|
103
125
|
post_install_message:
|
104
126
|
rdoc_options: []
|
105
127
|
require_paths:
|
@@ -108,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
130
|
requirements:
|
109
131
|
- - ">="
|
110
132
|
- !ruby/object:Gem::Version
|
111
|
-
version: 2.
|
133
|
+
version: 2.5.0
|
112
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
135
|
requirements:
|
114
136
|
- - ">="
|