Sha256: 1b101d491ebcf169d6446c85d06cf5ce9ae62e91b76249bd0efe0e3acf6980d0

Contents?: true

Size: 965 Bytes

Versions: 11

Compression:

Stored size: 965 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[:kernel, :logger]

            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|
                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/branch.rb
git-lint-7.3.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-7.2.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-7.1.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-7.0.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.2.1 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.2.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.1.0 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.0.2 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.0.1 lib/git/lint/cli/actions/analyze/branch.rb
git-lint-6.0.0 lib/git/lint/cli/actions/analyze/branch.rb