Sha256: 1f3d48765d6ad24406c76789cd847dba2e55dd7d4aea5869bb8b187d1726e9ef

Contents?: true

Size: 670 Bytes

Versions: 5

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Reporters
      # Reports issues related to a single commit.
      class Commit
        def initialize commit:, analyzers: []
          @commit = commit
          @analyzers = analyzers.select(&:invalid?)
        end

        def to_s
          return "" if analyzers.empty?

          "#{commit.sha} (#{commit.author_name}, #{commit.author_date_relative}): " \
          "#{commit.subject}\n#{report}\n"
        end

        private

        attr_reader :commit, :analyzers

        def report = analyzers.reduce("") { |report, analyzer| report + Style.new(analyzer).to_s }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/reporters/commit.rb
git-lint-2.3.3 lib/git/lint/reporters/commit.rb
git-lint-2.3.2 lib/git/lint/reporters/commit.rb
git-lint-2.3.1 lib/git/lint/reporters/commit.rb
git-lint-2.3.0 lib/git/lint/reporters/commit.rb