Sha256: 17d542e799bbeedb5dce71da5e7060d4cea7cf7f97c868d940709a47f8046f1b
Contents?: true
Size: 900 Bytes
Versions: 9
Compression:
Stored size: 900 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, :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
9 entries across 9 versions & 1 rubygems