Sha256: fabb131d495c9f44deacb9dc9d96c465e34582cfbbfc001f9c5896bd12cc7b9e

Contents?: true

Size: 966 Bytes

Versions: 9

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Git
  module Lint
    module CLI
      module Actions
        module Analyze
          # Handles analyze action for branch.
          class Branch < Sod::Action
            include Git::Lint::Import[:logger, :kernel, :io]

            description "Analyze current branch."

            on %w[-b --branch]

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

            def call(*)
              parse
            rescue Errors::Base => error
              logger.error { error.message }
              kernel.abort
            end

            private

            attr_reader :analyzer

            def parse
              analyzer.call 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/branch.rb
git-lint-8.7.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.6.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.5.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.4.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.3.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.2.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.1.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-8.0.0 lib/git/lint/cli/actions/analyze/branch.rb