Sha256: 739d4050c1c669c563f066dcb9f15ef4ec2ebda887cf51bdd6ca580c04a70697

Contents?: true

Size: 692 Bytes

Versions: 26

Compression:

Stored size: 692 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.authored_relative_at}): " \
          "#{commit.subject}\n#{report}\n"
        end

        alias to_str to_s

        private

        attr_reader :commit, :analyzers

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/reporters/commit.rb
git-lint-5.2.0 lib/git/lint/reporters/commit.rb
git-lint-5.1.2 lib/git/lint/reporters/commit.rb
git-lint-5.1.1 lib/git/lint/reporters/commit.rb
git-lint-5.1.0 lib/git/lint/reporters/commit.rb
git-lint-5.0.0 lib/git/lint/reporters/commit.rb