Sha256: 1940d3a2da6c4dfb7ac81a64033a0d90f5000cd6ae53e51f63f5748af74e560f
Contents?: true
Size: 1003 Bytes
Versions: 5
Compression:
Stored size: 1003 Bytes
Contents
# frozen_string_literal: true module Undercover class Formatter def initialize(results) @results = results end def to_s return success unless @results.any? ([warnings_header] + formatted_warnings).join("\n") end private def formatted_warnings @results.map.with_index(1) do |res, idx| "🚨 #{idx}) node `#{res.node.name}` type: #{res.node.human_name},\n" + (' ' * pad_size) + "loc: #{res.file_path_with_lines}, " \ "coverage: #{res.coverage_f * 100}%\n" + res.pretty_print end end def success "#{Rainbow('undercover').bold.green}: ✅ No coverage " \ 'is missing in latest changes' end def warnings_header "#{Rainbow('undercover').bold.red}: " \ '👮♂️ some methods have no test coverage! Please add specs for ' \ 'methods listed below' end def pad_size 5 + (@results.size - 1).to_s.length end end end
Version data entries
5 entries across 5 versions & 1 rubygems