Class: Overcommit::Hook::PreCommit::AuthorEmail
- Defined in:
- lib/overcommit/hook/pre_commit/author_email.rb
Overview
Checks the format of an author’s email address.
Instance Method Summary collapse
Methods inherited from Base
#applicable_files, #description, #enabled?, #execute, #in_path?, #initialize, #name, #quiet?, #required?, #run?, #skip?
Constructor Details
This class inherits a constructor from Overcommit::Hook::Base
Instance Method Details
#run ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/overcommit/hook/pre_commit/author_email.rb', line 4 def run result = execute(%w[git config --get user.email]) email = result.stdout.chomp unless email =~ /#{@config['pattern']}/ return :bad, "Author has an invalid email address: '#{email}'\n" \ 'Set your email with ' \ '`git config --global user.email [email protected]`' end :good end |