Sha256: 971d1aab2e29ceb15e2be32b2d8cb7bb10374643377be41014d1953703929069

Contents?: true

Size: 692 Bytes

Versions: 16

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.author_date_relative}): " \
          "#{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

16 entries across 16 versions & 1 rubygems

Version Path
git-lint-4.6.0 lib/git/lint/reporters/commit.rb
git-lint-4.5.0 lib/git/lint/reporters/commit.rb
git-lint-4.4.0 lib/git/lint/reporters/commit.rb
git-lint-4.3.0 lib/git/lint/reporters/commit.rb
git-lint-4.2.0 lib/git/lint/reporters/commit.rb
git-lint-4.1.0 lib/git/lint/reporters/commit.rb
git-lint-4.0.1 lib/git/lint/reporters/commit.rb
git-lint-4.0.0 lib/git/lint/reporters/commit.rb
git-lint-3.3.2 lib/git/lint/reporters/commit.rb
git-lint-3.3.1 lib/git/lint/reporters/commit.rb
git-lint-3.3.0 lib/git/lint/reporters/commit.rb
git-lint-3.2.0 lib/git/lint/reporters/commit.rb
git-lint-3.1.0 lib/git/lint/reporters/commit.rb
git-lint-3.0.2 lib/git/lint/reporters/commit.rb
git-lint-3.0.1 lib/git/lint/reporters/commit.rb
git-lint-3.0.0 lib/git/lint/reporters/commit.rb