Sha256: 32502392d5ebdbe0862408f7a4f038a5a28269ca94f7d18ffdea43af9c727d43

Contents?: true

Size: 947 Bytes

Versions: 4

Compression:

Stored size: 947 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, **)
              super(**)
              @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

4 entries across 4 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-5.2.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-5.1.2 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-5.1.1 lib/git/lint/cli/actions/analyze/commit.rb