Sha256: d6ceb105a0affbc6f34ef064e572744dd67419da07e028931b20c15ce15bdfd6

Contents?: true

Size: 970 Bytes

Versions: 2

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module CLI
      module Actions
        module Analyze
          # Handles analyze action for single commit SHA
          class Commit
            include Git::Lint::Import[:git, :kernel, :logger]

            def initialize analyzer: Analyzer.new, **dependencies
              super(**dependencies)
              @analyzer = analyzer
            end

            def call *arguments
              process arguments.unshift "-1"
            rescue Errors::Base => error
              logger.error { error.message }
              kernel.abort
            end

            private

            attr_reader :analyzer

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-lint-5.1.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-5.0.0 lib/git/lint/cli/actions/analyze/commit.rb