Sha256: cdeaecfece58abbd57fac929eb3be8414069017545a7f001e680f5b3879e2615
Contents?: true
Size: 1.08 KB
Versions: 20
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Git module Lint module Reporters # Reports issues related to a single style. class Style include Import[:color] def initialize(analyzer, **) super(**) @analyzer = analyzer @issue = analyzer.issue end def to_s = color[message, style] alias to_str to_s private attr_reader :analyzer, :issue def message " #{analyzer.class.label}#{severity_suffix}. " \ "#{issue.fetch :hint}\n" \ "#{affected_lines}" end def severity_suffix case analyzer.severity when "warn" then " Warning" when "error" then " Error" else "" end end def style case analyzer.severity when "warn" then :yellow when "error" then :red else :white end end def affected_lines issue.fetch(:lines, []).reduce("") { |lines, line| lines + Line.new(line) } end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems