Sha256: 62953cef718fae6d9aad141025dd735bf756b932cf755686f281f21a3808218d
Contents?: true
Size: 690 Bytes
Versions: 21
Compression:
Stored size: 690 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 name = if ENV.key?('GIT_AUTHOR_NAME') ENV['GIT_AUTHOR_NAME'] else result = execute(%w[git config --get user.name]) result.stdout.chomp end unless name.split(' ').count >= 2 return :fail, "Author must have at least first and last name, but was: #{name}.\n" \ 'Set your name with `git config --global user.name "Your Name"` ' \ 'or via the GIT_AUTHOR_NAME environment variable' end :pass end end end
Version data entries
21 entries across 19 versions & 2 rubygems