Sha256: 9ab07df8fab4aa58539ade3f61daa4ab2214a59e35e79228a23b6babdac979d4
Contents?: true
Size: 689 Bytes
Versions: 21
Compression:
Stored size: 689 Bytes
Contents
module Overcommit::Hook::PreCommit # Checks the format of an author's email address. class AuthorEmail < Base def run email = if ENV.key?('GIT_AUTHOR_EMAIL') ENV['GIT_AUTHOR_EMAIL'] else result = execute(%w[git config --get user.email]) result.stdout.chomp end unless email =~ /#{config['pattern']}/ return :fail, "Author has an invalid email address: '#{email}'\n" \ 'Set your email with ' \ '`git config --global user.email your_email@example.com` ' \ 'or via the GIT_AUTHOR_EMAIL environment variable' end :pass end end end
Version data entries
21 entries across 19 versions & 2 rubygems