Sha256: 352654a40e3b822bc925a5316807273e65733ec4546b0c9329d30e76f5744a76

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Git
  module Lint
    module CLI
      module Actions
        module Analyze
          # Handles analyze action for commit(s) by SHA.
          class Commit
            def initialize analyzer: Analyzer.new,
                           parser: GitPlus::Parsers::Commits::Saved::History.with_show,
                           container: Container
              @analyzer = analyzer
              @parser = parser
              @container = container
            end

            def call sha = nil
              process sha
            rescue Errors::Base => error
              logger.error { error.message }
              kernel.abort
            end

            private

            attr_reader :analyzer, :parser, :container

            def process sha
              analyzer.call commits: parser.call(*sha) do |collector, reporter|
                kernel.puts reporter
                kernel.abort if collector.errors?
              end
            end

            def kernel = container[__method__]

            def logger = container[__method__]
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
git-lint-3.3.2 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.3.1 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.3.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.2.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.1.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.0.2 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.0.1 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-3.0.0 lib/git/lint/cli/actions/analyze/commit.rb