Sha256: c3c189e96b63065d29f6c7ca5e95c7a8bb81fd936dba0f3c78eee9c789c95f41
Contents?: true
Size: 899 Bytes
Versions: 11
Compression:
Stored size: 899 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 Git::Lint::Import[:git, :kernel, :logger] 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| 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
11 entries across 11 versions & 1 rubygems