Sha256: d1a2d6d3f906cd4e45d66edd2f8e5f9d7790dd0ebf3bcbdb80f14407c0860310
Contents?: true
Size: 1.08 KB
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-lint-5.3.0 | lib/git/lint/reporters/style.rb |
git-lint-5.2.0 | lib/git/lint/reporters/style.rb |