Class: CodeStats::Metrics::Reporter::Simplecov
- Inherits:
-
Object
- Object
- CodeStats::Metrics::Reporter::Simplecov
- Defined in:
- lib/code_stats/metrics/reporter/simplecov.rb
Class Method Summary collapse
Class Method Details
.empty_value(metric) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/code_stats/metrics/reporter/simplecov.rb', line 19 def empty_value(metric) { metric_name: metric.data['name'], value: 0, minimum: metric.data['minimum'] } end |
.generate_data(metric, _config_store) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/code_stats/metrics/reporter/simplecov.rb', line 8 def generate_data(metric, _config_store) return empty_value(metric) unless File.directory?('coverage') && File.file?('coverage/.last_run.json') json = JSON.parse(File.read('coverage/.last_run.json')) code_coverage = json['result']['covered_percent'] { metric_name: metric.data['name'], value: code_coverage, minimum: metric.data['minimum'] } end |