Sha256: 477ca623422fe3661eba90f6f2823b71c67688c90ea95d0f13212671e5a02478

Contents?: true

Size: 690 Bytes

Versions: 11

Compression:

Stored size: 690 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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-2.2.1 lib/git/lint/reporters/commit.rb
git-lint-2.2.0 lib/git/lint/reporters/commit.rb
git-lint-2.1.0 lib/git/lint/reporters/commit.rb
git-lint-2.0.0 lib/git/lint/reporters/commit.rb
git-lint-1.4.0 lib/git/lint/reporters/commit.rb
git-lint-1.3.0 lib/git/lint/reporters/commit.rb
git-lint-1.2.0 lib/git/lint/reporters/commit.rb
git-lint-1.1.1 lib/git/lint/reporters/commit.rb
git-lint-1.1.0 lib/git/lint/reporters/commit.rb
git-lint-1.0.1 lib/git/lint/reporters/commit.rb
git-lint-1.0.0 lib/git/lint/reporters/commit.rb