Sha256: 6b443070fbe3d4630481ed7d5f5d20ac1c848453cb0c7d7dcff50a1027f1b448
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true require "sod" require "sod/types/pathname" module Git module Lint module CLI module Actions # Handles unsaved Git commit action. class Hook < Sod::Action include Dependencies[:git, :logger, :kernel, :io] description "Hook for analyzing unsaved commits." on "--hook", argument: "PATH", type: Pathname def initialize(analyzer: Analyzer.new, **) super(**) @analyzer = analyzer end def call path analyzer.call commits: commits(path) do |collector, reporter| io.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-lint-9.1.0 | lib/git/lint/cli/actions/hook.rb |
git-lint-9.0.0 | lib/git/lint/cli/actions/hook.rb |