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-8.8.0 lib/git/lint/reporters/commit.rb
git-lint-8.7.0 lib/git/lint/reporters/commit.rb
git-lint-8.6.0 lib/git/lint/reporters/commit.rb
git-lint-8.5.0 lib/git/lint/reporters/commit.rb
git-lint-8.4.0 lib/git/lint/reporters/commit.rb
git-lint-8.3.0 lib/git/lint/reporters/commit.rb
git-lint-8.2.0 lib/git/lint/reporters/commit.rb
git-lint-8.1.0 lib/git/lint/reporters/commit.rb
git-lint-8.0.0 lib/git/lint/reporters/commit.rb
git-lint-7.5.0 lib/git/lint/reporters/commit.rb
git-lint-7.3.0 lib/git/lint/reporters/commit.rb
git-lint-7.2.0 lib/git/lint/reporters/commit.rb
git-lint-7.1.0 lib/git/lint/reporters/commit.rb
git-lint-7.0.0 lib/git/lint/reporters/commit.rb
git-lint-6.2.1 lib/git/lint/reporters/commit.rb
git-lint-6.2.0 lib/git/lint/reporters/commit.rb
git-lint-6.1.0 lib/git/lint/reporters/commit.rb
git-lint-6.0.2 lib/git/lint/reporters/commit.rb
git-lint-6.0.1 lib/git/lint/reporters/commit.rb
git-lint-6.0.0 lib/git/lint/reporters/commit.rb