Sha256: 2b54308812adb36ec2d327265cc82fb82eb3cb0978d4c764bfab7d0081d04964

Contents?: true

Size: 511 Bytes

Versions: 11

Compression:

Stored size: 511 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Ensures that a commit author has a name with at least first and last names.
  class AuthorName < Base
    def run
      result = execute(%w[git config --get user.name])
      name = result.stdout.chomp

      unless name.split(' ').count >= 2
        return :fail,
               "Author must have at least first and last name, but was: #{name}." \
               "\nSet your name with `git config --global user.name 'Your Name'`"
      end

      :pass
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
overcommit-0.24.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.23.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.22.0 lib/overcommit/hook/pre_commit/author_name.rb
jawshooah-overcommit-0.22.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.21.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.20.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.19.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.18.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.17.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.16.0 lib/overcommit/hook/pre_commit/author_name.rb
overcommit-0.15.0 lib/overcommit/hook/pre_commit/author_name.rb