Class: Git::Lint::CLI::Actions::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/cli/actions/hook.rb

Overview

Handles unsaved Git commit action.

Instance Method Summary collapse

Constructor Details

#initialize(analyzer: Analyzer.new, **dependencies) ⇒ Hook

Returns a new instance of Hook.



11
12
13
14
# File 'lib/git/lint/cli/actions/hook.rb', line 11

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

Instance Method Details

#call(path) ⇒ Object



16
17
18
19
20
21
# File 'lib/git/lint/cli/actions/hook.rb', line 16

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