simplecov 0.18.0.beta2 → 0.18.0.beta3

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: eeee06c5cbeaf6c89000a43641f7a6163d9b267d145698e742089385eae6e2b8
4
- data.tar.gz: 76e7182adc3c8156e021d780618733f6237a81723656f0123b51abf34a63e891
3
+ metadata.gz: a5ac4654ad44859d2e7b68cc5375314766127720e33d51080cc02120d35cc9cb
4
+ data.tar.gz: 89ceeaf8b9b1a76bd05a4f078c50a80050bd247ef067164201f9721ce7378b5b
5
5
  SHA512:
6
- metadata.gz: e5e785e01ff4bf53c9cbdbeaeb7cc5925265e2ec9cacecb9865261150eed13b8c59c43d840588eb6baa0565ce510c74891f535f02bb1db42d2eeea4e61b3cd54
7
- data.tar.gz: d8f29ed7d8ecf8a01d9fcd843a0c2a9845f022a690c8c7096c23077f7e3c2488fce290e099e70083ee44e37d1bb05f1535c2ec1a70b6952929ab92857b38a339
6
+ metadata.gz: 8afee26e98b841b002d097d589afbbc8b892452897423c927b817b51696bb7063e3f2e849f462434b765fb09970fbb6759d31d5362ea5c6e90eb65e82824eb78
7
+ data.tar.gz: ed2f4ffab150fd1da883604eccec94a087184aeaadb4b4d6f1f7273efa6020d1034b9e2eebbc8b88a9c63c54d545ccd6db4f5db58ee29f8182703ed40281342e
@@ -1,10 +1,19 @@
1
- 0.18.0.beta2 (unreleased)
1
+ 0.18.0.beta3 (2020-01-20)
2
+ ========================
3
+
4
+ ## Enhancements
5
+ * Instead of ignoring old `.resultset.json`s that are inside the merge timeout, adapt and respect them
6
+
7
+ ## Bugfixes
8
+ * Remove the constant warning printing if you still have a `.resultset.json` in pre 0.18 layout that is within your merge timeout
9
+
10
+ 0.18.0.beta2 (2020-01-19)
2
11
  ===================
3
12
 
4
13
  ## Enhancements
5
14
  * only turn on the requested coverage criteria (when activating branch coverage before SimpleCov would also instruct Ruby to take Method coverage)
6
15
  * Change how branch coverage is displayed, now it's `branch_type: hit_count` which should be more self explanatory. See [#830](https://github.com/colszowka/simplecov/pull/830) for an example and feel free to give feedback!
7
- * Allow early running exit tasks and avoid the `at_exit` hook through the `SimpleCov.run_exit_tasks!` method. (thanks [@macumber]: https://github.com/macumber))
16
+ * Allow early running exit tasks and avoid the `at_exit` hook through the `SimpleCov.run_exit_tasks!` method. (thanks [@macumber](https://github.com/macumber))
8
17
  * Allow manual collation of result sets through the `SimpleCov.collate` entrypoint. See the README for more details (thanks [@ticky](https://github.com/ticky))
9
18
  * Within `case`, even if there is no `else` branch declared show missing coverage for it (aka no branch of it). See [#825](https://github.com/colszowka/simplecov/pull/825)
10
19
  * Stop symbolizing all keys when loading cache (should lead to be faster and consume less memory)
@@ -34,11 +34,6 @@ module SimpleCov
34
34
  # @return [Hash]
35
35
  #
36
36
  def combine_result_sets(combined_results, result)
37
- unless correct_format?(result)
38
- warn_wrong_format
39
- return combined_results
40
- end
41
-
42
37
  results_files = combined_results.keys | result.keys
43
38
 
44
39
  results_files.each_with_object({}) do |file_name, file_combination|
@@ -49,41 +44,6 @@ module SimpleCov
49
44
  end
50
45
  end
51
46
 
52
- # We might start a run of a new simplecov version with a new format stored while
53
- # there is still a recent file like this lying around. If it's recent enough (
54
- # see merge_timeout) it will end up here. In order not to crash against this
55
- # we need to do some basic checking of the format of data we expect and
56
- # otherwise ignore it. See #820
57
- #
58
- # Currently correct format is:
59
- # { file_path_string => {coverage_criterion => coverage_date}}
60
- #
61
- # Internal use/reliance only.
62
- def correct_format?(result)
63
- result.empty? || matches_current_format?(result)
64
- end
65
-
66
- def matches_current_format?(result)
67
- # I so wish I could already use pattern matching
68
- key, data = result.first
69
-
70
- key.is_a?(String) && second_level_choice_of_criterion?(data)
71
- end
72
-
73
- SECOND_LEVEL_KEYS = %w[lines branches].freeze
74
- def second_level_choice_of_criterion?(data)
75
- second_level_key, = data.first
76
-
77
- SECOND_LEVEL_KEYS.member?(second_level_key)
78
- end
79
-
80
- def warn_wrong_format
81
- warn "Merging results, encountered an incorrectly formatted value. "\
82
- "This value was ignored.\nIf you just upgraded simplecov this is "\
83
- "likely due to a changed file format. If this happens again please "\
84
- "file a bug. https://github.com/colszowka/simplecov/issues"
85
- end
86
-
87
47
  #
88
48
  # Combine two files coverage results
89
49
  #
@@ -26,8 +26,9 @@ module SimpleCov
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
28
  def initialize(original_result)
29
- @original_result = original_result.freeze
30
- @files = SimpleCov::FileList.new(original_result.map do |filename, coverage|
29
+ result = adapt_result(original_result)
30
+ @original_result = result.freeze
31
+ @files = SimpleCov::FileList.new(result.map do |filename, coverage|
31
32
  SimpleCov::SourceFile.new(filename, JSON.parse(JSON.dump(coverage))) if File.file?(filename)
32
33
  end.compact.sort_by(&:filename))
33
34
  filter!
@@ -82,6 +83,31 @@ module SimpleCov
82
83
 
83
84
  private
84
85
 
86
+ # We changed the format of the raw result data in simplecov, as people are likely
87
+ # to have "old" resultsets lying around (but not too old so that they're still
88
+ # considered we can adapt them).
89
+ # See https://github.com/colszowka/simplecov/pull/824#issuecomment-576049747
90
+ def adapt_result(result)
91
+ if pre_simplecov_0_18_result?(result)
92
+ adapt_pre_simplecov_0_18_result(result)
93
+ else
94
+ result
95
+ end
96
+ end
97
+
98
+ # pre 0.18 coverage data pointed from file directly to an array of line coverage
99
+ def pre_simplecov_0_18_result?(result)
100
+ _key, data = result.first
101
+
102
+ data.is_a?(Array)
103
+ end
104
+
105
+ def adapt_pre_simplecov_0_18_result(result)
106
+ result.map do |file_path, line_coverage_data|
107
+ [file_path, {"lines" => line_coverage_data}]
108
+ end.to_h
109
+ end
110
+
85
111
  def coverage
86
112
  keys = original_result.keys & filenames
87
113
  Hash[keys.zip(original_result.values_at(*keys))]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleCov
4
- VERSION = "0.18.0.beta2"
4
+ VERSION = "0.18.0.beta3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0.beta2
4
+ version: 0.18.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-19 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -95,9 +95,9 @@ licenses:
95
95
  metadata:
96
96
  bug_tracker_uri: https://github.com/colszowka/simplecov/issues
97
97
  changelog_uri: https://github.com/colszowka/simplecov/blob/master/CHANGELOG.md
98
- documentation_uri: https://www.rubydoc.info/gems/simplecov/0.18.0.beta2
98
+ documentation_uri: https://www.rubydoc.info/gems/simplecov/0.18.0.beta3
99
99
  mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
100
- source_code_uri: https://github.com/colszowka/simplecov/tree/v0.18.0.beta2
100
+ source_code_uri: https://github.com/colszowka/simplecov/tree/v0.18.0.beta3
101
101
  post_install_message:
102
102
  rdoc_options: []
103
103
  require_paths: