firespring_dev_commands 2.1.21.pre.alpha.5 → 2.1.21.pre.alpha.7

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: 831bd71e091dc6ad04f4ce368c343207845a6d9ae175fe12f40e36dee14717c3
4
- data.tar.gz: 5eb6f226edc9309bb1a6873127decc4b678aea8d3e8005c5686d9c082096b05d
3
+ metadata.gz: 8854ab66747e26c22780c4e6756df86dac09bc5a8029fae51f1382d29d18c27f
4
+ data.tar.gz: ca3ddd354a8faddb180d827891886ce78483accb7e7f1e2e5b5b9d6bcc9d36f7
5
5
  SHA512:
6
- metadata.gz: 7fb65d68db2549227de42ee2f5921e7a2586020aabfe9fcd54d1e923f089c9ba0e3e16338c8d800c0e526dc18e49d38819364df4a99db209140b13c19cb58680
7
- data.tar.gz: e8da4354c580c083584c7e2850bce7865e99ecb4646224170e4a5b519e8a0b0d09557c6125e5fde99f29980eb917ec5b4218bd465c352250b101e564944bd835
6
+ metadata.gz: 4aace4ef89ab6ec98008184ffb58d71febc920bcc85195a3fe2fa645a4109f8523348cdfae5e281a731d6ce6ddac3769a101800ee7b6e63ad31f4efcfa2f84c4
7
+ data.tar.gz: c700fd928018dc384757fddeae412eb4990323b94b47a16026736738d43e4a8ff12202b15014ebd0b92d30f5705dcffeab439a78e61ea711e0074ecff22d6cec
@@ -5,11 +5,11 @@ module Dev
5
5
  class Cobertura
6
6
  attr_reader :local_filename, :container_filename, :filename, :threshold
7
7
 
8
- def initialize(filename: 'cobertura.xml', threshold: nil, container_path: nil, local_path: nil)
8
+ def initialize(filename: File.join('coverage', 'cobertura.xml'), threshold: nil, container_path: nil, local_path: nil)
9
9
  @filename = filename
10
10
  @local_filename = File.join(local_path || '.', @filename)
11
11
  @container_filename = File.join(container_path || '.', @filename)
12
- @threshold = threshold.to_f
12
+ @threshold = threshold
13
13
  end
14
14
 
15
15
  # Remove any previous versions of the local file that will be output
@@ -32,10 +32,24 @@ module Dev
32
32
 
33
33
  # Load the file from disk and parse with ox
34
34
  report = Ox.load(File.read(local_filename), mode: :hash)
35
- attrs, = report[:coverage]
36
- cov_pct = attrs[:'line-rate'].to_f * 100
37
- puts format('Line coverage was %.2f%%. Configured threshold was %.2f%%', cov_pct, threshold)
38
- raise 'Code coverage not met' if cov_pct < threshold
35
+ _, _, files = report[:coverage]
36
+
37
+ covered = missed = 0
38
+ files.dig(:packages, :package)&.each do |_attrs, packages|
39
+ _, _, lines = *packages&.dig(:classes, :class)
40
+ lines&.dig(:lines, :line)&.each do |it|
41
+ it = it&.first if it.is_a?(Array)
42
+ if it&.dig(:hits).to_i.positive?
43
+ covered += 1
44
+ else
45
+ missed += 1
46
+ end
47
+ end
48
+ end
49
+
50
+ puts "Lines missing coverage was #{missed}"
51
+ puts "Configured threshold was #{threshold}" if threshold
52
+ raise 'Code coverage not met' if threshold && missed > threshold
39
53
  end
40
54
  end
41
55
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.21.pre.alpha.5'.freeze
9
+ VERSION = '2.1.21.pre.alpha.7'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.21.pre.alpha.5
4
+ version: 2.1.21.pre.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport