Sha256: a19adfda1546b8d6b83f19137ef5b88e61688552d7e30917bfebcd3ad493948d

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require "sod"

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

            description "Analyze specific commits."

            on %w[-c --commit], argument: "a,b,c"

            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

11 entries across 11 versions & 1 rubygems

Version Path
git-lint-7.5.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-7.3.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-7.2.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-7.1.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-7.0.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.2.1 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.2.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.1.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.0.2 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.0.1 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-6.0.0 lib/git/lint/cli/actions/analyze/commit.rb