Sha256: 00efe2ea5688bd359100d3f56d7bcd1e4044786266b3d1c0e5e854e547a9849d

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 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, :logger, :kernel, :io]

            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|
                io.puts reporter
                kernel.abort if collector.errors?
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.7.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.6.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.5.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.4.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.3.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.2.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.1.0 lib/git/lint/cli/actions/analyze/commit.rb
git-lint-8.0.0 lib/git/lint/cli/actions/analyze/commit.rb