gitlab_quality-test_tooling 3.23.1 → 3.23.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49a063bdf7dc0b0055d926d178df7a5274c067f352a5feae0d5f04695702ea01
4
- data.tar.gz: 426701ca7b4f8b55c433bfd78b173f1e731c1f55dafd099584acb0366b6f77de
3
+ metadata.gz: 29d0d651f4a6124b15e28a2800326169ac564f24dd3e28bd006ae90ff89eaf59
4
+ data.tar.gz: 9fd40df7ec874c8784dc1859125483b8af11578ac589898a616dd74930ed504f
5
5
  SHA512:
6
- metadata.gz: a3a5eb95bc469a879dacb6db1e3a456b35373391ed034df6a4adec4840533666613367de04510f4a8b9e1c60f755bfc5140b6a32048a597ec822bfc1c10cfd92
7
- data.tar.gz: 00136e319209d433a0ff36c7c4a583ea54848653a5b1290244ba8d9108e47c0e3f7aad4a736cd7f3b51d42afe8d3beb16074c655cb41939f0135e555cfd96efb
6
+ metadata.gz: dd9575af1e50ccc41c5c75f7d6a11b899a4d5ed8540eac8e3ec9d9db8d20ba937c0b8f4424a62d39f43b0795374b41da38d18a1e7a083412297c2f570bf45b25
7
+ data.tar.gz: e0b7ba73f98a35bdc037c35239c1b28c329c15862fbf976b1ec49aad3c4cdf660cd77aa3b5cbfdc4b618edb8cf54d0c7e20a7e0b5ba8ed08d581d4b12121a76e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (3.23.1)
4
+ gitlab_quality-test_tooling (3.23.2)
5
5
  activesupport (>= 7.0)
6
6
  amatch (~> 0.4.1)
7
7
  csv (~> 3.0)
@@ -273,7 +273,7 @@ GEM
273
273
  pstore (0.2.1)
274
274
  public_suffix (7.0.5)
275
275
  racc (1.8.1)
276
- rack (3.2.7)
276
+ rack (3.2.8)
277
277
  rainbow (3.1.1)
278
278
  rake (13.2.1)
279
279
  rb-fsevent (0.11.2)
@@ -33,9 +33,13 @@ module GitlabQuality
33
33
  # also produced by any per-test capture that emits one line-hit array
34
34
  # per (test, file) pair.
35
35
  #
36
+ # The inner value may instead be a map from 1-based line number to hits,
37
+ # as Coverband writes it: `{"3": 0, "26": 103}`. Only executable lines
38
+ # appear in the map.
39
+ #
36
40
  # This class:
37
41
  # - strips `[<example_uid>]` from the example id to get a per-test-file key
38
- # - converts each line-hit array into a (covered_lines, total_lines) pair
42
+ # - converts each line-hit cell into a (covered_lines, total_lines) pair
39
43
  # - pre-aggregates within (test_file, source_file): unions covered
40
44
  # lines across all examples in the same test file, takes the max
41
45
  # total_lines
@@ -157,26 +161,40 @@ module GitlabQuality
157
161
  stripped.split(':').first
158
162
  end
159
163
 
160
- # Walk the per-line hit array. Returns (Set<Integer> covered_lines,
161
- # Integer total_executable_lines). Indexes are 0-based; line numbers
162
- # are 1-based. `nil` entries are non-executable lines.
163
- # A `nil` value at the file level (file loaded but never recorded
164
- # under this example) yields an empty result rather than raising,
165
- # so a single odd cell doesn't fail the whole export.
164
+ # Returns (Set<Integer> covered_lines, Integer total_executable_lines)
165
+ # for one (test, source file) cell. `nil` hits are non-executable lines.
166
+ # A cell that is neither an Array nor a Hash (e.g. `nil`: file loaded
167
+ # but never recorded under this example) yields an empty result rather
168
+ # than raising, so a single odd cell doesn't fail the whole export.
166
169
  def parse_line_hits(line_hits)
167
- return [Set.new, 0] unless line_hits.is_a?(Array)
168
-
169
170
  covered = Set.new
170
171
  total = 0
171
- line_hits.each_with_index do |hits, index|
172
+ each_line_hit(line_hits) do |line, hits|
172
173
  next if hits.nil?
173
174
 
174
175
  total += 1
175
- covered.add(index + 1) if hits.is_a?(Numeric) && hits.positive?
176
+ covered.add(line) if hits.is_a?(Numeric) && hits.positive?
176
177
  end
177
178
  [covered, total]
178
179
  end
179
180
 
181
+ # Yields (1-based line number, hits) for either cell form:
182
+ # - Array, as written by Ruby's `Coverage`: index 0 is line 1.
183
+ # - Hash, as written by Coverband: `{"26" => 103}`. Keys that are not
184
+ # positive integers are skipped rather than raising.
185
+ def each_line_hit(line_hits)
186
+ case line_hits
187
+ when Array
188
+ line_hits.each_with_index { |hits, index| yield index + 1, hits }
189
+ when Hash
190
+ line_hits.each do |line, hits|
191
+ # Base 10 so a zero-padded key like "08" is not read as octal.
192
+ line = Integer(line.to_s, 10, exception: false)
193
+ yield line, hits if line&.positive?
194
+ end
195
+ end
196
+ end
197
+
180
198
  # True for source files excluded from coverage entirely (e.g. vendored
181
199
  # gems). Strips a leading ./ so both "vendor/..." and "./vendor/..."
182
200
  # match.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "3.23.1"
5
+ VERSION = "3.23.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.23.1
4
+ version: 3.23.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-28 00:00:00.000000000 Z
11
+ date: 2026-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control