codemonitor 0.5.0 → 0.6.0

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: f85a1e1dbcae9d0bd26c461505a12449283dbf2029ee34ba59b36a2277e00321
4
- data.tar.gz: 2cc548a6646d98cbeab3b72ce2dff06fd0d40175bf599fec2db5e12659aec7c4
3
+ metadata.gz: 6f946bb06520000b874d580db3b60204aa8d243f8ca38777168c12e8a54946ec
4
+ data.tar.gz: c4ce7a7a962ab314ca4d9c381eb93642902f0c054500585b41bfd2a6c37161be
5
5
  SHA512:
6
- metadata.gz: 7af9d278c2c2fcbba028ecb161cf7ee49b374ef701aee25bbb2ccfc3fe714a2fcf54d05c18a43653dee3e3d7263904668b38fa74569c8168c22a87be4bd6b4e2
7
- data.tar.gz: f928807e202db2c1b60b3cec7e5df66abd44b04c8c4ddc165a201476c8e04a36ac3f3bd036abc5e3eb54aac66299bc99ac8827aae822d4587d00a1d22a6ff96d
6
+ metadata.gz: 9c7029e7553b6ecbe9d707f40f38b8fa657bd78c67efc05572502729923e832020ea6eff0c77fc80d48e5f394463ba961d51303a8d2c2e874300a10aa4eb6b4a
7
+ data.tar.gz: 74ea78d12f4252d6a24d8d81c7ba9db88985b93cfc0f78547377edf97b6f4d72f52f7f3ff5d035d96c5f01564013d76668edec27036b4874e3c8bd8e6a9a21dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codemonitor (0.5.0)
4
+ codemonitor (0.6.0)
5
5
  dogapi (~> 1.45)
6
6
  octokit (~> 4.0)
7
7
 
@@ -56,7 +56,7 @@ module Engines
56
56
 
57
57
  def flatten(member, rename = nil)
58
58
  json_summary['total'][member].map do |key, value|
59
- ["jest_json_summary_#{rename || member}_#{key}", value.to_i]
59
+ ["jest_json_summary_#{rename || member}_#{key}", value.to_f]
60
60
  end.to_h
61
61
  end
62
62
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module Engines
6
+ module SimpleCovJsonCoverage
7
+ class Extractor
8
+ METRICS = %i[
9
+ simplecov_json_coverage_metrics_covered_percent
10
+ simplecov_json_coverage_metrics_covered_strength
11
+ simplecov_json_coverage_metrics_covered_lines
12
+ simplecov_json_coverage_metrics_total_lines
13
+ ].freeze
14
+
15
+ def initialize; end
16
+
17
+ def call(provider)
18
+ metrics = METRICS.map do |metric|
19
+ [metric, send(metric)]
20
+ end.to_h
21
+
22
+ provider.emit(metrics)
23
+ end
24
+
25
+ def requirements?
26
+ File.exist?('simplecov_json_coverage.output.json')
27
+ end
28
+
29
+ private
30
+
31
+ def json_summary
32
+ @json_summary ||= JSON.parse(File.read('simplecov_json_coverage.output.json'))
33
+ end
34
+
35
+ def metrics
36
+ @metrics ||= json_summary['metrics']
37
+ end
38
+
39
+ def simplecov_json_coverage_metrics_covered_percent
40
+ metrics['covered_percent']
41
+ end
42
+
43
+ def simplecov_json_coverage_metrics_covered_strength
44
+ metrics['covered_strength']
45
+ end
46
+
47
+ def simplecov_json_coverage_metrics_covered_lines
48
+ metrics['covered_lines']
49
+ end
50
+
51
+ def simplecov_json_coverage_metrics_total_lines
52
+ metrics['total_lines']
53
+ end
54
+ end
55
+ end
56
+ end
data/exe/codemonitor CHANGED
@@ -16,6 +16,7 @@ require_relative '../engines/sorbet/extractor'
16
16
  require_relative '../engines/scc/extractor'
17
17
  require_relative '../engines/custom/extractor'
18
18
  require_relative '../engines/jest-json-summary/extractor'
19
+ require_relative '../engines/simplecov-json-coverage/extractor'
19
20
 
20
21
  PROVIDERS = {
21
22
  console: Providers::Console,
@@ -34,7 +35,8 @@ EXTRACTORS = {
34
35
  sorbet: Engines::Sorbet::Extractor,
35
36
  scc: Engines::Scc::Extractor,
36
37
  custom: Engines::Custom::Extractor,
37
- jest_json_summary: Engines::JestJsonSummary::Extractor
38
+ jest_json_summary: Engines::JestJsonSummary::Extractor,
39
+ simplecov_json_coverage: Engines::SimpleCovJsonCoverage::Extractor
38
40
  }.freeze
39
41
 
40
42
  config_provider = ENV['CODEMONITOR_PROVIDER'] || 'console'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodeMonitor
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codemonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferran Basora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dogapi
@@ -140,6 +140,7 @@ files:
140
140
  - engines/rubocop/extractor.rb
141
141
  - engines/scc/extractor.rb
142
142
  - engines/semgrep/extractor.rb
143
+ - engines/simplecov-json-coverage/extractor.rb
143
144
  - engines/sorbet/extractor.rb
144
145
  - exe/codemonitor
145
146
  - lib/codemonitor/version.rb