Sha256: e1bd8cbd176d0834dc82e209a9c1dc479fa324ed93f425206ef2df1a3e9c79bf

Contents?: true

Size: 723 Bytes

Versions: 4

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module CLI
      module Actions
        # Handles unsaved Git commit action.
        class Hook
          include Git::Lint::Import[:git, :kernel, :logger]

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

          def call path
            analyzer.call commits: commits(path) do |collector, reporter|
              kernel.puts reporter
              kernel.abort if collector.errors?
            end
          end

          private

          attr_reader :analyzer

          def commits(path) = git.uncommitted(path).fmap { |commit| [commit] }
        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/hook.rb
git-lint-5.2.0 lib/git/lint/cli/actions/hook.rb
git-lint-5.1.2 lib/git/lint/cli/actions/hook.rb
git-lint-5.1.1 lib/git/lint/cli/actions/hook.rb