Sha256: e486586a3c5a438b36a5db391de03b9c8f6222423ada58ddef6250d498c5c963
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Git module Lint module Reporters # Reports issues related to a single style. class Style include Dependencies[: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-9.1.0 | lib/git/lint/reporters/style.rb |
git-lint-9.0.0 | lib/git/lint/reporters/style.rb |